Patch to pass file descriptors

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Patch to pass file descriptors

Mauro Canova Zaccarias
   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:
<[hidden email]>
<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:[hidden email]
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/
Reply | Threaded
Open this post in threaded view
|

Re: Patch to pass file descriptors

Corinna Vinschen-2
On Apr  4 20:04, Mauro Canova Zaccarias wrote:
>    Hi folks,
>
>    Have you found any solution for the problem of passing descriptors on
> cygwin? How did this discussion end up?

Descriptor passing is still on the endless todo list for Cygwin.


Corinna

--
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat