On Thu, 6 Feb 2003, Dave McMurtrie wrote:

> On Thu, 6 Feb 2003, Henrique de Moraes Holschuh wrote:
>
> > On Wed, 05 Feb 2003, Igor Brezac wrote:
> > > > descriptors down to a child via a unix domain socket using sendmsg() or
> > > > recvmsg(). In this case the master accepts the connection, passes the
> > > > descriptor to a child via sendmsg(), closes the socket (the child should now
> > > > be servicing it), and goes back to listening.
> > >
> > > This is not very portable.  ;(
> >
> > Would it work on Linux and Solaris? If the answer is yes to both, then I
> > would vote for adding that suport conditional to a configure.in check.
> >
> > I guess if it can be done on Linux, the BSDs can almost certainly do it as
> > well.
>
> Would this actually work anyway?  If the parent were to pass a file
> descriptor (by putmsg or any other means) to the child, isn't he really
> just passing an integer value?  In other words, the integer value 5 in
> process B is not the same thing as file descriptor 5 in process A.
>

Not that simple.  ;)  Check out http://www.kohala.com/start/apue.html.

> When the parent initally forks the child, (if close on exec isn't set) the
> child and parent will have the same file descriptors available to them.
> Wouldn't any fd's opened in the parent after the child exec()s be unique
> to the running instance of the parent process?
>
> Just asking -- I could be wrong & it wouldn't be the first time.

master and spawned daemons will have to have some kind of communication
channel (unix domain sockets or named pipes) in order for this to work.
apache uses passing file-descriptor model.

-- 
Igor



Reply via email to