Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fork, pipes, and Tiger



Terry Lambert wrote:
pipefd[0] is out and pipefd[1] is in.

You have them backwards, which incorrectly assumes bidirectional pipes.

Hmm, I don't see this. In the code, "out=fromchild[IN]" is read and "in=tochild[OUT]" is written to, so this seems correct.


Either fix your code, or use socketpair() instead of pipe().

The code was originally written for linux, I am not the author, I am only trying to port it to Mac OSX. It never worked on OSX 10.1, because of double buffered stdout problems. On 10.2 it worked with a terrible hack, because the shell gave a spurious warning at each line, and this warning had to be discarded. On 10.3 it worked as it was supposed to, and now on 10.4 it is broken again.


I'll try to read about socketpair(), but I'd prefer not to have to rewrite the code too much.

--
Martin

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/unix-porting/email@hidden

This email sent to email@hidden
References: 
 >fork, pipes, and Tiger (From: Martin Costabel <email@hidden>)
 >Re: fork, pipes, and Tiger (From: Terry Lambert <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.