[launchd-dev] Diagnosing launchd daemon failure to launch

Quinn eskimo1 at apple.com
Mon Nov 10 06:27:22 PST 2008

At 8:37 -0500 7/11/08, Iain Delaney wrote:
>Thanks for the input, but if I want to use Mach services, couldn't I 
>just use a named DO connection (like [NSConnection registerName:] )? 
>Then I don't need to put anything about a Mach service in the plist. 
>I tried this earlier and it seemed to work fine.

This will work, but your daemon will have to run all the time.  If 
you take the path that DaveZ suggests, you can launch on demand.

>Then I read tech note 2083: Daemons and Agents and found that DTS 
>recommends against using Mach messages and suggests UNIX Domain 
>sockets instead. That's how I ended up with my current problem. Are 
>the Mach APIs and Distributed Objects really as dangerous as the 
>tech note leads me to believe?

In general we recommend staying away from the Mach APIs.  However, 
the situation is not cut and dry.  If it was, we'd deprecate the Mach 
APIs, or eliminate them entirely.  The text in TN2083 tries to cover 
some of the subtleties of this situation, but it's hard to do without 
discussing specifics.

In the specific case of using DO for local IPC, I'd definitely 
recommend you use Mach for your transport.  DO was written with the 
Mach IPC model in mind.  DO-over-sockets has to jump through lots of 
hoops to make sockets look like Mach ports, and that produces all 
sorts of wacky edge cases.

Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

More information about the launchd-dev mailing list