Mailing Lists: Apple Mailing Lists

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

Detecting broken pipe.



Hi y'all,

I'm setting up a process that communicates with another module through two pipes (i.e. master->slave, slave->master). The master fires off the slave module using a fork() and execl() sequence after creating the two pipes and re-wiring stdin, stdout. That's all good and works fine, but the one error condition that gets a little screwy is the case where the execl() fails and continues on as the copy of the master process. It's easy to handle the errored slave and terminate the process but the master thinks everything is all good since there is no failure from the fork(). I'm currently relying on reading the stdin pipe and expecting a "hello" message from the slave, which, if it actually ran, sends to the master at init. If it's not there then there's a problem and I can handle the error.

What I want to know is what other ways there are to detect whether the other end of the pipe has a process connected to it or not.

This is sort of an experiment at this point but I want to discover the various issues with using this type of communications channel.

Thanks,
Rich
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >More on SCDynamicStoreCopyConsoleUser returning 510184? (From: Finlay Dobbie <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.