delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/24/14:47:18

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
Date: Thu, 24 May 2001 14:26:06 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cygwin_attach_handle_to_fd()
Message-ID: <20010524142606.D8694@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <3B0C35D4 DOT 5B3849D0 AT reversion DOT ca> <20010523192540 DOT A15862 AT redhat DOT com> <3B0D265D DOT B4F896FF AT reversion DOT ca>
Mime-Version: 1.0
User-Agent: Mutt/1.3.11i
In-Reply-To: <3B0D265D.B4F896FF@reversion.ca>; from nelson@reversion.ca on Thu, May 24, 2001 at 09:18:53AM -0600

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

- Raw text -


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