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()


On Thu, May 24, 2001 at 09:18:53AM -0600, Craig Nelson wrote:
>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".

It tells cygwin what the type of the file is.  "/dev/conin" would be a
console.  "/dev/piper" for the read end of a pipe, "/dev/pipew" for the
write end.  The list of devices is in path.cc.

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

I don't know.  Use the source.

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

As usual, "loads of grief" is not an adequate bug report.  You probably
don't think you're providing a bug report, but you are.  Cygwin is supposed
to be a UNIX emulation package.  If you can't use fork/exec for some reason
then that's a serious problem.

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

That is what I would suggest, actually.  Rather than ask "What happens
if I use NULL?" just TRY IT.  Debug the process if it isn't doing what
you want.  I don't have much more insight to provide without actually
doing the debugging myself.  Maybe someone else will be able to provide
some details or will be willing to run gdb...

cgf

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