passing a file descriptor over a pipe (was: TDsPool)

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
James K. Lowden wrote:
> ZIGLIO, Frediano, VF-IT wrote:
> > 
> > > A file descriptor can be passed over a pipe.  Is that what you mean?
> > >  
> > 
> > I don't know... I mean a sort of dup3(fd_source, pid_dest) or
> > something similar... how can apache pass the socket in prefork from
> > parent to child?? 

Hi Freddy, 

http://www.kohala.com/start/unpv12e.html
http://www.kohala.com/start/unpv12e/unpv12e.tar.gz

Stevens's write_fd function passes a file descriptor from a child to a
parent.  It is used by the unixdomain/mycat program.  The child opens the
file and the parent reads from it.  I know it works on OS X (PPC) and
NetBSD 2.0 (i386).  

In case you want to trace the logic, you need only these files:

unixdomain/mycat.c
unixdomain/myopen.c
unixdomain/openfile.c
lib/read_fd.c
lib/write_fd.c

(To build the code, I had to comment out the IPV6 defines in
config.h.  The attached Makefile implements the instructions in the
README.)

HTH & regards, 

--jkl

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
Makefile.begin (application/octet-stream, 326 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.