[launchd-dev] The MachService key
Damien Sorresso
dsorresso at apple.com
Tue Nov 22 10:57:50 PST 2011
On Nov 21, 2011, at 5:28 PM, Jerry Krinock wrote:
> In trying to understand how a process works, I found a launchd plist with a MachService key.
>
> From launchd.plist(5), I learn that that this is to "specify Mach services to be registered with the Mach bootstrap sub-system".
>
> I know a little about the Mach bootstrap sub-system, but I can't find much information about Mach services.
>
> Does anyone know a book or other resource where I could learn about Mach services?
There's really not much to learn. It's a hierarchical namespace that provides way more flexibility than has shown to be practically needed or desirable.
The standard workflow was that, when a daemon advertising MachServices is launched on-demand, it used bootstrap_check_in() to obtain the receive rights to the ports corresponding to those services. It could then dequeue messages from the ports from there, either using mach_msg() directly or MIG.
Anyone who wished to send a message to one of those services used bootstrap_look_up() to obtain a send right to that service, and from there they could send messages. That act of sending a message (NOT the act of looking up the name) would launch the daemon on-demand if it's not already running.
There were a whole host of other APIs that were of dubious value after the introduction of launchd and the MachServices key.
XPC has pretty much rendered all of those APIs obsolete though.
--
Damien Sorresso
dsorresso at apple.com
More information about the launchd-dev
mailing list