This is the mail archive of the cygwin-patches 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]

Patch to pass file descriptors


   Hi folks,

   Have you found any solution for the problem of passing descriptors on
cygwin? How did this discussion end up?

   Many thanks,
   Mauro Zaccarias




-------------------------------
Re: Patch to pass file descriptors

    * From: Corinna Vinschen <cygwin-patches at cygwin dot com>
    * To: cygwin-patches at cygwin dot com
    * Date: Wed, 3 Jul 2002 13:41:15 +0200
    * Subject: Re: Patch to pass file descriptors
    * References:
<Pine.LNX.4.30L.0207021305230.31764-100000@w20-575-40.mit.edu>
<005601c22280$e9e4f610$c9823bd5@dmitry>

On Wed, Jul 03, 2002 at 07:59:59PM +0900, Dmitry Timoshkov wrote:
> Hello all.
> 
> Why not implement passing file descriptors in the following way:
> 
> Somewhere in the structure passed to sendmsg send a handle of
> the calling process created with
> OpenProcess(PROCESS_DUP_HANDLE, FALSE, GetCurrentProcessId());
> OpenProcess will always succed, since the caller is current process.
> 
> recvmsg implementation will just use that process handle
> for the DuplicateHandle call.

recvmsg is in another process.  The open handle is only valid in
the source process.  It would have to be duplicated for the receiving
process using DuplicateHandle(src, target) which only works if
the duplicating process has already PROCESS_DUP_HANDLE access on
the other process.  Therefore the Cygwin internal descriptor
passing code only works if one of the processes is a privileged
process (being member of the admins group is sufficient here).

That means basically, if one needs to pass descriptors between
two non-privileged processes, it still requires a cygserver solution.

For the records:

Please keep in mind that I'm *not* against a cygserver solution.
It's just that I'm still trying to get as much functionality done
in the DLL itself w/o needing the cygserver.  The cygserver should
be only the resort for functionality which can't get implemented
with just the dll.  It's not the panacea to implement every new
functionality w/o having to think about a stand-alone solution.

Corinna

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


		
_______________________________________________________ 
Abra sua conta no Yahoo! Mail: 1GB de espaço, alertas de e-mail no celular e anti-spam realmente eficaz. 
http://br.info.mail.yahoo.com/


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