home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ulowell!m2c!bu.edu!cvbnet!hsiegel
- From: hsiegel@cvbnet.prime.com (mailhost)
- Newsgroups: comp.unix.programmer
- Subject: Re: More advanced popen()
- Message-ID: <4636@cvbnetPrime.COM>
- Date: 28 Jan 93 15:41:32 GMT
- References: <LUNDMAN.93Jan27223935@kauri.kauri.vuw.ac.nz>
- Sender: postnews@cvbnetPrime.COM
- Lines: 30
-
- From article <LUNDMAN.93Jan27223935@kauri.kauri.vuw.ac.nz>, by lundman@kauri.vuw.ac.nz (L Lundman):
- >
- > After finding out that popen() only read or wrote to a process and not both
- > I was told I had to write one of my own if I wanted one. Can someone
- > inform me why this code doesn't seem to work?
- >
- > (Knowing my luck, it's some dumb mistake ;) )
- ...
- [code deleted to save space]
- ...
-
- In the first place, you would need _two_ pipes, one to write to the
- child process and one to read from it. This can be done, and works.
-
- What frequently munges attempts to do this is a noxious aspect of the
- way pipes work. I quote from "man pipe" on my SunOS 4.1.3 system:
-
- * BUGS
- * Should more than {PIPE_BUF} bytes be necessary in any pipe
- * among a loop of processes, deadlock will occur.
-
- PIPE_BUF, as I recall (I haven't looked it up lately) is 256 (512?)
- bytes. This causes problems surprising often. If you can guarantee
- that you won't exceed this, you may be able to implement a double-
- ended version of popen.
-
- Howard Siegel hsiegel@piano.prime.com
- Computervision hsiegel@primerd.prime.com
- Bedford, Mass. hsiegel%piano.prime.com@RELAY.CS.NET
- (617) 275-1800 x4064 cvbnet!hsiegel@primerd.prime.com
-