This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]