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]

Re: cygwin_attach_handle_to_fd()


Christopher Faylor wrote:

> 'name' is the name of the file or device.
> 'bin' is true if the file should be opened in binary mode, false for text mode.
> 'access' is a windows setting like 'GENERIC_READ' or 'GENERIC-WRITE'.

I dont understand why you would need to pass "name".  isnt the point of this function  to simply attach the "int fd" to an
already opened HANDLE?  In my case, HANDLE is merely a result of CreatePipe() so there is no device name.  is it safe to pass NULL?

> It sounds like you're reinventing "popen" to me.

Yes, it's very close.. the bad thing about popen is that you only get one pipe and it is not bidirectional.  I was using the usual fork(), exec() way
of life, but it seems to give me loads of grief.  I've switched to using CreateProcess() and the grief goes away (except for this little problem
I'm having here).  I'll try some new things here and post my findings..

>
> Probably the best thing you could do is inspect the source code.  That's
> what I just did.

looking through there now.. but still unclear on "name"..  Do you know the impact of using it with an already open handle? ie: can I just set
"name" to NULL?

Thanks again for any input.

Craig Nelson, Cameo Systems Inc.


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