Stewart Forster wrote:
>
> > > Above ideas are sound enough, except you can't pass accept'ed
> > > sockets between 2 running processes. This means that much of your model
> > Depending on the version of unix you're using, see
> > unix(4) (SCM_RIGHTS)
> > or
> > streamio(7) (I_SENDFD)
>
> Munch, munch (humble pie). Learning all the time... :)
>
> What happens when the sender closes the FD at it's end? Is this
"Unix network programming" ISBN 0-13-949876-3
has a very good description of this..
Basically there is a central list of open files in the kernel.
When you have a filehandle in your process it just "points" (not in the
traditional C pointer sense) to this table.
When you use a unix socket to give rights to a different process, the
new process gets a filehandle opened for it that simply points to the
same "node" on the internal structure.
If the giver proceeds to write to the filehandle the kernel allows
it, and when it context switches and the receiver tries to write it
will still work... all you get is corrupted output.
> defined? Further, how portable is this really going to be?
Very portable... apache does this (I think - otherwise it couldn't do
pre-forking and so on).
Oskar
Received on Tue Jul 29 2003 - 13:15:41 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:20 MST