This is the mail archive of the
mailing list for the Cygwin project.
Patch to pass file descriptors
- From: Mauro Canova Zaccarias <maurocz at yahoo dot com dot br>
- To: cygwin-patches at cygwin dot com
- Date: Tue, 4 Apr 2006 20:04:35 -0300 (ART)
- Subject: Patch to pass file descriptors
Have you found any solution for the problem of passing descriptors on
cygwin? How did this discussion end up?
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
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 Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:firstname.lastname@example.org
Red Hat, Inc.
Abra sua conta no Yahoo! Mail: 1GB de espaço, alertas de e-mail no celular e anti-spam realmente eficaz.