Re: CLONE_PDEATHKILL introduction

From: Jamie Lokier (lk@tantalophile.demon.co.uk)
Date: Sun Mar 12 2000 - 11:16:53 EST


David Wragg wrote:
> I still don't see what is wrong with something like
>
> /* ... block SIGWHATEVER ... */
> prctl(PR_SET_PDEATHSIG, SIGWHATEVER);
> /* Were we orphaned before the prctl? */
> if (__getppid() == 1)
> __kill(__getpid(), SIGWHATEVER);
> /* ... now unblock SIGWHATVER ... */
>
> (If performance is a real issue, the block/unblock can be avoided by
> using an atomic test-and-set, in which case just two system calls are
> needed.)
>
> We have the functionality already, so why take up valuable bits in the
> clone() flags word?

Agreed, though inheriting the DEATHSIG from the parent at clone time is
another adequate solution.

This should go in the man page for prctl or <linux/prctl.h> (which
serves as documentation for pcrtl unfortunately): "For some applications
PR_SET_PDEATHSIG may be called too late. Use the following method to
avoid a race condition when the parent has died already." Followed by
your code.

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Mar 15 2000 - 21:00:21 EST