diff options
| author | Jeff Roberson <jeff@FreeBSD.org> | 2007-06-12 07:47:09 +0000 |
|---|---|---|
| committer | Jeff Roberson <jeff@FreeBSD.org> | 2007-06-12 07:47:09 +0000 |
| commit | fe54587ffac50b8bb1551562a41367f55eaebc80 (patch) | |
| tree | 036f608c444de2ce81d35f5edb89bcfce3d51790 /sys/kern/kern_fork.c | |
| parent | ec32b37ecdad940d55176cc388455ceb02479d4b (diff) | |
Notes
Diffstat (limited to 'sys/kern/kern_fork.c')
| -rw-r--r-- | sys/kern/kern_fork.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index f20cefeedee4..c0e320495e04 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -768,6 +768,7 @@ fork_exit(callout, arg, frame) { struct proc *p; struct thread *td; + struct thread *dtd; td = curthread; p = td->td_proc; @@ -778,6 +779,17 @@ fork_exit(callout, arg, frame) sched_fork_exit(td); /* + * Processes normally resume in mi_switch() after being + * cpu_switch()'ed to, but when children start up they arrive here + * instead, so we must do much the same things as mi_switch() would. + */ + if ((dtd = PCPU_GET(deadthread))) { + PCPU_SET(deadthread, NULL); + thread_stash(dtd); + } + thread_unlock(td); + + /* * cpu_set_fork_handler intercepts this function call to * have this call a non-return function to stay in kernel mode. * initproc has its own fork handler, but it does return. |
