Passing open file descriptor to the exec'ed process
Applied Magnetics
3003jalp at ucsbuxa.ucsb.edu
Fri Oct 19 07:02:15 AEST 1990
In article <16903 at thorin.cs.unc.edu> olano at currituck.cs.unc.edu (Thomas Olano) writes:
>In article <34954 at cup.portal.com> DeadHead at cup.portal.com (Bruce M Ong) writes:
>...
>> [wants to open a socket and pass it through an exec()]
>
>When I did something similar, I passed the open socket descriptor to the
>child using environment variables. [...]
Sockets remain open across the exec. If I understand the question
correctly, the problem is to tell the exec'd process which descriptor
carries the socket? You should be able to open the socket, then use
dup2(2) to force it onto a pre-agreed descriptor. This way, you don't
need to pass anything.
Disclaimer: I haven't tried this. Nor has my employer.
--P. Asselin, R&D, Applied Magnetics Corp.
More information about the Comp.unix.programmer
mailing list