Re: CLONE_PID (was: POSIX.1b semaphores)

David S. Miller (davem@jenolan.rutgers.edu)
Tue, 19 Nov 1996 04:47:33 -0500


From: Xavier Leroy <Xavier.Leroy@inria.fr>
Date: Tue, 19 Nov 1996 10:29:15 +0100 (MET)

As you can see, this CLONE_PID flag, although working fine, opens a
whole can of worms in the area of signal delivery. If anyone has
ideas on how to approach this problem, please let me know.

Add a new mask of signals to task_struct, the implementation then
would be:

kill(p, sig)
{
for_each_thread_with_pid(p, tsk)
p->normal_sig_mask |= (1<<(sig-1));
if(has_threads(p))
find_task(p)->global_sig_mask |= (1<<(sig-1));
}

signal_deliver(tsk)
{
if(tsk->global_sig_mask & (1 << (sig - 1))) {
for_each_thread_with_pid(tsk->pid & PID_MASK, tmp)
tmp->normal_sig_mask &= ~(1<<(sig-1));
tsk->global_sig_mask &= ~(1 << (sig - 1));
} else {
tsk->normal_sig_mask &= ~(1<<(sig-1));
}
}

Thats gross as hell, and doesn't consider possible races, but it is
just the general idea.

--------------------------------------------////
Yow! 10.49 MB/s remote host TCP bandwidth ////
over 100Mb/s ethernet. Beat that! ////
-----------------------------------------////__________ o
David S. Miller, davem@caip.rutgers.edu /_____________/ / // /_/ ><