On Mon, Apr 01, 2002 at 04:53:29PM -0500, Jeff Trawick wrote: > This gets -DNO_DETACH working for me with Apache's prefork MPM on > Linux and FreeBSD. But from Aaron's commit log for revision > 1.34 I gather that this will break daemontools-like programs. > > How should I get "./httpd -DNO_DETACH" to work? Calling setsid() is > bogus. > > This patch avoids the setsid() logic if we don't daemonize.
I don't understand how this is broken. If you don't want to daemonize but you still want to detach, you must be sure that httpd will not be a process group leader when it is started. This can be done by running httpd from a shell script or as a child of another process (like from daemontools). Running "./httpd -DNO_DETACH" from the command line will cause httpd to be a process group leader [in most modern shells], which causes setsid() to fail and httpd to spit out an error. This seems correct to me. What am I missing? Perhaps apr_proc_detach needs to fail with a more specific error, and httpd should detect that error and write a more appropriate message? -aaron
