home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / programm / 6077 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.6 KB

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