This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
cygwin_attach_handle_to_fd()
- To: cygwin at cygwin dot com
- Subject: cygwin_attach_handle_to_fd()
- From: Craig Nelson <nelson at reversion dot ca>
- Date: Wed, 23 May 2001 16:12:36 -0600
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@reversion.ca (and the list, if desired)
Thanks in advance.
Craig Nelson, Cameo Systems Inc.
nelson@reversion.ca
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple