[freetds] passing a file descriptor over a pipe (was: TDsPool)

James K. Lowden jklowden at freetds.org
Wed Jun 18 00:00:10 EDT 2008


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile.begin
Type: application/octet-stream
Size: 326 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20080618/bbdbc443/attachment.obj 


More information about the FreeTDS mailing list