[launchd-dev] LAUNCH_KEY_GETJOB returns MACH_PORT_NULL?

Damien Sorresso dsorresso at apple.com
Fri Aug 27 12:52:17 PDT 2010


On Aug 27, 2010, at 12:49 PM, Dave MacLachlan wrote:

> 
> On Aug 27, 2010, at 12:34 , Damien Sorresso wrote:
> 
>> On Aug 27, 2010, at 12:27 PM, Dave MacLachlan wrote:
>>> Hey all..
>>> 
>>> So when I send a LAUNCH_KEY_CHECKIN message, I get a dictionary back with all the mach ports filled in for my mach services. However, if I send a LAUNCH_KEY_GETJOB from an external process I get MACH_PORT_NULL for all of the mach ports. I can look them up by using bootstrap_look_up, or NSMachBootstrapServer, but I was wondering what the reasoning was behind not returning them from a LAUNCH_KEY_GETJOB lookup? It appears to be an intentional design decision.
>>> 
>>> (This is what I'm seeing on 10.5 at least. Perhaps it's different on 10.6?)
>> 
>> 
>> Please don't use those APIs. Use bootstrap_check_in() and bootstrap_look_up() instead.
> 
> There seems to be a bit of a mixed message going on here.
> 
> My understanding was that the bootstrap APIs were being deprecated, and being replaced with launch.h (and above that ServiceManagement.framework).


I'm not sure where you heard that launch.h was replacing anything, but that's not the message we've intended to communicate. The stuff in launch.h is solely for checking in to get your listening sockets from launchd.

bootstrap_register(), bootstrap_create_server() and bootstrap_create_service() are legacy and deprecated. bootstrap_check_in() and bootstrap_look_up() are not.

ServiceManagement is the most supported interface for dealing with launchd jobs.
-- 
Damien Sorresso
BSD Engineering
Apple Inc.



More information about the launchd-dev mailing list