[launchd-dev] The MachService key

Damien Sorresso dsorresso at apple.com
Tue Nov 22 10:47:46 PST 2011


On Nov 22, 2011, at 7:56 AM, Rainer Brockerhoff wrote:
> On 22/11/2011, at 13:00, launchd-dev-request at lists.macosforge.org wrote:
>> Date: Tue, 22 Nov 2011 10:02:56 +0000
>> From: "Quinn \"The Eskimo!\"" <eskimo1 at apple.com>
>> Message-ID: <86B0B3BF-8627-40C7-9B29-24A38F3608E8 at apple.com>
>> 
>> XPC makes this much easier.  Much of the focus of XPC is in providing XPC services, that is, small chunks of code that you include in an app that you can talk to from the app.  This makes certain security tasks (sandboxing, privilege separation) much easier.  However, it's also possible to use XPC to talk to a launchd daemon.
>> 
>> With the above in mind, is taking a dependency on 10.7 feasible or not?  If it is, I can explain how you can use XPC to talk to a launchd daemon via the MachServices key.
> 
> 
> I'll have a situation - 10.7 (and successors) only - where I'd like to talk to my launchd daemon, both from an app and perhaps from an XPC service launched by that app. Messages could be either NS/CFDictionaries or a blob of binary data.
> 
> I'm not particularly set on using MachServices, or CFMessagePort, or whatever; but it would be helpful if you, in that explanation, could mention what the easiest (or more reliable?) API for doing so on Lion.

Rainer,

Check out the XPC man pages for more complete documentation about how to use XPC to talk to MachServices. Specifically, xpc_connection_create_mach_service(3). The man pages shipped with Xcode 4.2. There is also extensive HeaderDoc in /usr/include/xpc.
-- 
Damien Sorresso
dsorresso at apple.com 



More information about the launchd-dev mailing list