Subject: how to determine success of daemon(3)
To: None <current-users@NetBSD.ORG>
From: Rolf Grossmann <email@example.com>
Date: 12/27/1996 18:39:57
while writing a small deamon that's supposed to check system status, I
noticed, that it's quite hard to determine if it was started successfully
when using the daemon(3) function. This is, because if it has forked
successfully, the parent returns with exit status 0. However the
function may still fail, when the child's call to setsid(2) fails.
My question is: How critical is such a failure? It's not clear to me,
that it's critical that the daemonized process becomes the session leader
of its own process group. What, if the call was put before the fork, so that
the parent first becomes session leader?
Thanks for any enlightment you can provide.