apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter N. Lundblad" <pe...@famlundblad.se>
Subject Re: Pipe inheritance
Date Wed, 18 Jan 2006 14:10:59 GMT
On Tue, 17 Jan 2006, Joe Orton wrote:

> On Tue, Jan 17, 2006 at 03:01:35PM +0100, Peter N. Lundblad wrote:
> > While debugging a Subversion problem, I noted that when
> > apr_file_pipe_create is called on Linux, the created file descriptors are
> > inherited to child processes by default (luckily, one can reset this).
> > This is inconsistent with the default for apr_file_open.  If I understand
> > it correctly, the Windows code also does *not* make the pipe ends
> > inherited by default (it zero-inits the apr_file_t struct and doesn't seem
> > to touch the flags, leaving INHERIT unset.
> > Nothing of this is documented in apr_file_io.h.
> >
> > While I can see the reason for pipes to be inherited by default, it seems
> > inconsistent to do so, and you normally only want one end to be inherited,
> > so you don't save any code by having that default.
> >
> > I could easily provide a patch for this if you want to.  Any thoughts?
>
> Having *both* ends not inherited doesn't seem like a good default since
> the pipe is not very useful for IPC in that case, unless you've dup'ed
> the fds? It wouldn't be reasonable to change that behaviour in APR 1.x
> either, I'd say.
>
There is no default that is good in all cases here, but, at a closer look
I discovered that Windows is consistent, and I agree about the problem of
an API change.

Please find attached a docstring patch that states the defaults in both
apr_file_open and apr_file_pipe_create.

Thanks,
//Peter
Mime
View raw message