apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@ebuilt.com>
Subject Re: Inheritable APR handles.
Date Sun, 15 Jul 2001 00:20:19 GMT
On Sat, Jul 14, 2001 at 04:50:52PM -0700, rbb@covalent.net wrote:
> This patch begins to implement the inherit flag that Will Rowe was talking
> about yesterday on Unix.  Basically, every APR type that can be inherited
> would specify at creation time whether it should be created to be
> inherited or not.  Then, there are two functions, apr_foo_set_inherit and
> apr_foo_unset_inherit that flip the flag.  This will finally get us
> registering child cleanups correctly.  I have created a new APR header,
> apr_inherit.h, which implements some macros to create the
> apr_foo_(un)set_inherit functions for Unix, I have copied that inline in
> this message.
> Unless I hear objections, I will commit this code either tomorrow or
> Monday.  Once it is committed, I will use it to fix a couple of bugs in
> Apache.  :-)

What's the use case for this?  What are the bugs that we're seeing?
Is this relating to CGI?  (I know Win32 has some funny things related to
inheriting listeners from dead parents.)

You have a pipe (or some other type, say socket) that is opened by the 
parent process (like the POD).  When you do the fork, the open
descriptors will be passed to the child (per semantics of fork).  But,
now we want to make sure that certain file descriptors are closed when 
the child starts?  

#define APR_INHERIT    4096        /* Create the file inheritable by the child
                                      process. fork()ed implementations
                                      automatically register a child cleanup
                                      in the _absence_ of this flag. */

What would be the default - inheritied or non-inherited?  It'd seem 
that the default should be inherited.  That follows the typical
convention.  If we must explicitly specify APR_INHERIT, that now runs us
contrary to typical programming practices (in Unix land).  And, that's 
what most people would expect (descriptors are inhreited), but that 
doesn't seem to be the case - the default looks to be non-inherited.
IMHO, the exceptions are the cases when you want it to be *not* inherited.  

Please correct me if I am misunderstanding your and Bill's patches.
-- justin

View raw message