diff options
author | Jason Evans <jasone@FreeBSD.org> | 2000-09-07 01:33:02 +0000 |
---|---|---|
committer | Jason Evans <jasone@FreeBSD.org> | 2000-09-07 01:33:02 +0000 |
commit | 0384fff8c5b098545c3db311b0e0aa1ec4c9ae7e (patch) | |
tree | bc6e36e781569f3efe04995c0b0befebb9154ef5 /sys/kern/kern_kthread.c | |
parent | 62ae6c89ad2b03770097d05590093f93b9d94e08 (diff) |
Major update to the way synchronization is done in the kernel. Highlights
include:
* Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The
alpha port is still in transition and currently uses both.)
* Per-CPU idle processes.
* Interrupts are run in their own separate kernel threads and can be
preempted (i386 only).
Partially contributed by: BSDi (BSD/OS)
Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
Notes
Notes:
svn path=/head/; revision=65557
Diffstat (limited to 'sys/kern/kern_kthread.c')
-rw-r--r-- | sys/kern/kern_kthread.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index 6373750e06cd..e684b78c032a 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -52,24 +52,33 @@ kproc_start(udata) int error; error = kthread_create((void (*)(void *))kp->func, NULL, - kp->global_procpp, kp->arg0); + kp->global_procpp, 0, kp->arg0); if (error) panic("kproc_start: %s: error %d", kp->arg0, error); } /* - * Create a kernel process/thread/whatever. It shares it's address space + * Create a kernel process/thread/whatever. It shares its address space * with proc0 - ie: kernel only. + * + * func is the function to start. + * arg is the parameter to pass to function on first startup. + * newpp is the return value pointing to the thread's struct proc. + * flags are flags to fork1 (in unistd.h) + * fmt and following will be *printf'd into (*newpp)->p_comm (for ps, etc.). */ int kthread_create(void (*func)(void *), void *arg, - struct proc **newpp, const char *fmt, ...) + struct proc **newpp, int flags, const char *fmt, ...) { int error; va_list ap; struct proc *p2; - error = fork1(&proc0, RFMEM | RFFDG | RFPROC, &p2); + if (!proc0.p_stats /* || proc0.p_stats->p_start.tv_sec == 0 */) + panic("kthread_create called too soon"); + + error = fork1(&proc0, RFMEM | RFFDG | RFPROC | flags, &p2); if (error) return error; |