apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dean gaudet <d...@arctic.org>
Subject Re: Inherited Handles and APR
Date Wed, 18 Jul 2001 00:14:13 GMT
On Fri, 13 Jul 2001, William A. Rowe, Jr. wrote:

> After a respectable lunch at Boudin's, Ryan and I think we have the general answers
> to child handles.
> The apr_foo_open/create calls need an APR_INHERIT flag bit to mark resources as
> inheritable.  This offers two advantages;

this sounds like the wrong approach.

the default should be to assume that all file handles are not inherited.
this is the 99% case for handle creation.

then as a "new process attribute" you list the handles which should be
inherited.  (in general these would be just the 3 standard ones.)

it's possible to write a linux clone()-based fork() which inherits nothing
by default without having to do lame-ass stuff such as setting O_CLOEXEC
on every bloody handle.  then you just open("/proc/parent/fd/n") to get
the handful of descriptors you wanted to inherit (or use other fd passing
methods).  this should be a faster fork() off a large multithreaded, lots
of fds server.

and it's even simpler on windows... your API would seem to be worse for
windows than it needs to be.


View raw message