Skip to Content.
Sympa Menu

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

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: [freetds] passing a file descriptor over a pipe (was: TDsPool)
  • Date: Wed, 18 Jun 2008 00:00:10 -0400

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

Attachment: Makefile.begin
Description: Binary data




Archive powered by MHonArc 2.6.24.

Top of Page