diff options
author | John Baldwin <jhb@FreeBSD.org> | 2002-10-15 00:14:32 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2002-10-15 00:14:32 +0000 |
commit | c65440644e38f43606b6ddfd894a2c08ca3c8969 (patch) | |
tree | d9e7f15a07b01e094393816a21e214800c2bec47 /sys/kern/kern_proc.c | |
parent | 60a6965a88ac54f35a0b1f9562b5191657d74d04 (diff) | |
download | src-c65440644e38f43606b6ddfd894a2c08ca3c8969.tar.gz src-c65440644e38f43606b6ddfd894a2c08ca3c8969.zip |
- Add a new global mutex 'ppeers_lock' to protect the p_peers list of
processes forked with RFTHREAD.
- Use a goto to a label for common code when exiting from fork1() in case
of an error.
- Move the RFTHREAD linkage setup code later in fork since the ppeers_lock
cannot be locked while holding a proc lock. Handle the race of a task
leader exiting and killing its peers while a peer is forking a new child.
In that case, go ahead and let the peer process proceed normally as the
parent is about to kill it. However, the task leader may have already
gone to sleep to wait for the peers to die, so the new child process may
not receive a SIGKILL from the task leader. Rather than try to destruct
the new child process, just go ahead and send it a SIGKILL directly and
add it to the p_peers list. This ensures that the task leader will wait
until both the peer process doing the fork() and the new child process
have received their KILL signals and exited.
Discussed with: truckman (earlier versions)
Notes
Notes:
svn path=/head/; revision=105141
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r-- | sys/kern/kern_proc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 82138a5ef8f8..345ee22c119e 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -96,6 +96,7 @@ struct proclist zombproc; struct sx allproc_lock; struct sx proctree_lock; struct mtx pargs_ref_lock; +struct mtx ppeers_lock; uma_zone_t proc_zone; uma_zone_t ithread_zone; @@ -118,6 +119,7 @@ procinit() sx_init(&allproc_lock, "allproc"); sx_init(&proctree_lock, "proctree"); mtx_init(&pargs_ref_lock, "struct pargs.ref", NULL, MTX_DEF); + mtx_init(&ppeers_lock, "p_peers", NULL, MTX_DEF); LIST_INIT(&allproc); LIST_INIT(&zombproc); pidhashtbl = hashinit(maxproc / 4, M_PROC, &pidhash); |