This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How about this for passing file descriptors?


On Mon, Jul 15, 2002 at 09:21:50PM +1000, Robert Collins wrote:
> 
> ----- Original Message -----
> From: "Corinna Vinschen" <vinschen@redhat.com>
> To: <cygwin-developers@cygwin.com>
> Sent: Monday, July 15, 2002 9:10 PM
> 
> > Perhaps that's not even needed.  We already have a couple of methods
> > which are involved when duplicating handles between processes, namely
> > dup(), fixup_before_fork(), fixup_after_fork(), fixup_after_exec().
> 
> Hmm, the difference being that these methods are all synchronous. generic
> passing of file descriptors is not synchronous.
> 
> > Basically they are only restricted in their functionality since they
> > only get the *parent* process handle.  If we generalize this stuff
> > to get a *source* and a *destination* process handle instead, the
> > whole stuff would be available for situations besides fork/exec...
> 
> Remember that we don't know the destination process handle for this
> scenario, all we know is that we need to prepare the fd for *some* process
> to recieve.

That's not entirly true.  The sendmsg/recvmsg code needs to send the
pid to the other process and one of the processes has to open the
other process anyway so the handles are always known before the
duplication takes place.  It's just not possible otherwise.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]