On Mon, May 13, 2002 at 02:45:12PM -0700, [EMAIL PROTECTED] wrote: > > Hmm - not entirely trivial; it turns out that most unix-es do not take > kindly to > > setsid() > > when not detached/non-root. So I changed Jos/Michaels patch. See below. > Anyone any comments ?
Which platforms disallow non-root calls to setsid()? I thought the only requirement for calling setsid() was that the calling process wasn't already the leader of a process group. Daemontools ensurs this by forking and exec()ing the process it is going to manage, meaning that if the parent was a process group leader than the child is guaranteed to not be. OTOH, simply calling httpd from the command line (or exec'ing it from a shell script) will usually mean that the process is the leader of a new process group, meaning setsid() will fail. I think we should just fail with an error if the user wished to start up under daemontools mode (no_detach mode) but somehow started httpd as a process group leader. -aaron
