httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jos Backus <j...@cncdsl.com>
Subject Re: Running Apache in the foreground
Date Tue, 08 Jan 2002 18:58:33 GMT
On Mon, Jan 07, 2002 at 11:56:28PM -0800, Aaron Bannert wrote:
> On Mon, Jan 07, 2002 at 11:51:10PM -0800, Jos Backus wrote:
> > On Mon, Jan 07, 2002 at 11:27:53PM -0800, Aaron Bannert wrote:
> > > I think we should take the fork() stuff out of apr_proc_detach()
> > > instead. Detach is doing what it's supposed to, creating a new session
> > > (and therefore detaching from the controlling terminal). The only way
> > > it can reliably do that is if it is not a pgrp leader. IMO the way
> > > to handle this is to let apr_proc_deatch() assume it is already a
> > > non pgrp leader and put the fork() calls that ensure this outside.

OK, so we only fork if we are a pgrp leader. Since whether or not to fork is
the only thing NO_DETACH controls and since this decision is now to be based
on the process' pgrp leader status, it seems that NO_DETACH has become
obsolete as we can determine this automatically: when httpd is run by the
shell, it's a pgrp leader so we fork; if run by a process controller, it's not
a pgrp leader so we don't fork. This would mean that the changes to the
current sources amount to:
- remove the NO_DETACH/no_detach code
- only fork() inside apr_proc_detach() if getpgid() == getpgrp().

How does this sound?

> > What about the reopening of fd 0-2 that also happens inside
> > apr_proc_detach()?  We probably don't want that to happen with NO_DETACH
> > (my latest patch fixes this).
> 
> Why not? We redirect to /dev/null and then later reopen stderr to the log
> file (and possible stdout to other places, I don't know). Seems reasonable
> to me when detaching or not.

That was the original NO_DETACH behavior (it didn't call apr_proc_detach() at
all).

> Not necessarily, since this is a native unix implementation -- we just
> have to make sure that getpgid exists on that particular unix.
 
configure doesn't check for getpgid().

Btw, it appears that we use getpgrp() in a number of places already but not
getpgid(). Is it OK if I just use getpgrp()?

-- 
Jos Backus                 _/  _/_/_/        Santa Clara, CA
                          _/  _/   _/
                         _/  _/_/_/             
                    _/  _/  _/    _/
josb@cncdsl.com     _/_/   _/_/_/            use Std::Disclaimer;

Mime
View raw message