Patch to pass file descriptors

Corinna Vinschen
Wed Jul 3 05:54:00 GMT 2002

On Wed, Jul 03, 2002 at 01:41:15PM +0200, cygpatch wrote:
> 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).

Btw., descriptor passing works w/o cygserver also if both
processes are running under the same unprivileged account.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                      
Red Hat, Inc.

More information about the Cygwin-patches mailing list