Alan Cox wrote:
On Gwe, 2005-05-27 at 19:55, Davy Durham wrote:
Cool.. I looked at the daemon function and I might be able to use it..
Using daemon() is generally wise - it is basically a double fork and
then one exits so that the orphan child becomes owned by init. However
it also knows about platform specific considerations like setpgrp v
setsid, whether an ioctl must be done to disown the controlling tty etc
which can be fairly OS generation specific.
Well, when I tried using it in a program with some sleeps to test.. I
noticed that the intermediate process that daemon creates is not cleaned
up with a wait() call (so I see a defunct process in the ps listing).
If I manually do the double fork() then I can call waitpid() myself for
the pid that I know it spawned. But if I just call wait() after
calling daemon, then I don't know if I just cleaned up the pid it
spawned (do I?), or some other previously spawned one (for perhaps
totally different reasons)..
For my specifics it may not be a problem, but I guess I'm just whining
about the fact that daemon() doesn't clean it up itself (or can it?)
Thanks much,
Davy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]