delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/23/18:58:20

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3B0C35D4.5B3849D0@reversion.ca>
Date: Wed, 23 May 2001 16:12:36 -0600
From: Craig Nelson <nelson AT reversion DOT ca>
X-Mailer: Mozilla 4.08 [en] (X11; I; SunOS 5.8 i86pc)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: cygwin_attach_handle_to_fd()

Hi All, just looking for a bit more info on cygwin_attach_handle_to_fd():  the API references shows it as:

----snip----
extern "C" int cygwin_attach_handle_to_fd(char *name, int fd, HANDLE handle, int bin, int access);

This function can be used to turn a Win32 "handle" into a posix-style file handle. fd may be -1 to make cygwin allocate a handle; the actual handle is
returned in all cases.
----snip----

But I'm wondering what kinds of values BIN, ACCESS, and NAME are expected to have.  In particular:

    -Does NAME have to be a unique string?  if so, unique amongst each invocation of a cygwin process, etc.
    -Should BIN be set to unix things like O_BINARY | O_RDONLY or win32 things like GENERIC_READ, etc.
    -Should ACCESS be set to unix things like S_IRWXU or win32 things like FILE_SHARE_READ, etc.

Any help on all the options for this function would be greatly appreciated.


Incase anybody is wondering why I'm needing this:
The reason is, I'm using CreateProcess(), CreatePipe() and cygwin_attach_handle_to_fd() in order to start up a child process and redirect
its STDIN, STDOUT, and STDERR and use it in my program.  It works great except the fd returned from attach_handle() appears to never
get closed (and therfore read() blocks indefinately because it never gets an EOF).

I've tried setting BIN and ACCESS to constants shown above (without success), and I am wondering If there's something I've not set.
I'm running NT4sp6a with the latest cygwin-1.3.2 release.  please send a reply to nelson AT reversion DOT ca (and the list, if desired)



Thanks in advance.
Craig Nelson, Cameo Systems Inc.
nelson AT reversion DOT ca



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019