• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: popen with r+
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: popen with r+


  • Subject: Re: popen with r+
  • From: Ian Lister <email@hidden>
  • Date: Wed, 21 Jun 2006 17:55:42 +1000 (EST)

On Wed, 21 Jun 2006, Markus Hitter wrote:
Am 21.06.2006 um 01:10 schrieb Ian Lister:
pipe() gives you a single, unidirectional pipe.

From popen()'s man page in Tiger:

"Since popen() is now implemented using a bidirectional pipe, the type argument may request a bidirectional data flow."

Note that my comment was about pipe() and the man page you quoted was for popen(). Perhaps you realised that but I'll point it out for the casual observer regardless.


My point was that you're not going to be able to implement a bidirectional popen() with a single unidirectional pipe. In fact, calling pipe() twice doesn't help because you need to wrap them in a single FILE *, so socketpair() and fdopen() is the way to go.

Having had a cursory scan of Libc/gen/popen.c in Jaguar and Panther it seems that the Panther implementation was blindly copied from FreeBSD, which has bidirectional pipes whereas Darwin doesn't (based on the man page), and the Jaguar implementation does call socketpair() but then overwrites the file descriptors by calling pipe() anyway (a silly bug). I have no idea what micro versions of the OS the source I was looking at corresponded to as it was just whatever was lying on my disk.

Cheers,

Ian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >popen with r+ (From: "matt jaffa" <email@hidden>)
 >Re: popen with r+ (From: Ian Lister <email@hidden>)
 >Re: popen with r+ (From: Markus Hitter <email@hidden>)

  • Prev by Date: Re: popen with r+
  • Next by Date: Tcldom3.1/domtext.tcl,domtree.tcl are version 2.5
  • Previous by thread: Re: popen with r+
  • Next by thread: Tcldom3.1/domtext.tcl,domtree.tcl are version 2.5
  • Index(es):
    • Date
    • Thread