🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #1060

Re: Passing open file descriptor to the exec'ed process

#1060
From: Applied Magnetics
Date: Thu, 18 Oct 1990 21:02
17 lines
1211 bytes
In article <16903@thorin.cs.unc.edu> olano@currituck.cs.unc.edu (Thomas Olano) writes:

>In article <34954@cup.portal.com> DeadHead@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.
Technical Details
Message-ID: <6665@hub.ucsb.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!hub.ucsb.edu!ucsbuxa!3003jalp
References: <34954@cup.portal.com> <16903@thorin.cs.unc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!hub.ucsb.edu!ucsbuxa!3003jalp
From: 3003jalp@ucsbuxa.ucsb.edu (Applied Magnetics)
Newsgroups: comp.unix.programmer
Subject: Re: Passing open file descriptor to the exec'ed process
Message-ID: <6665@hub.ucsb.edu>
Date: 18 Oct 90 21:02:15 GMT
References: <34954@cup.portal.com> <16903@thorin.cs.unc.edu>
Sender: news@hub.ucsb.edu
Distribution: na
Lines: 17