[launchd-dev] MachServices

Quinn eskimo1 at apple.com
Tue Apr 1 04:54:42 PDT 2008


At 17:12 +0530 1/4/08, Pradip Patel wrote:
>Yes it works in post boot,
>can you please tell me the name of IOkit service  ? is it com.apple.iokit ?

There is no named I/O Kit Mach service.  You seem to be mixing up two 
uses of the word "service", namely Mach services that are registered 
with the Mach bootstrap name server (which is the usage in the 
launchd property list file) and I/O Kit services which are registered 
in the I/O registry.  These are very different concepts.

If you're trying to find an I/O Kit service and failing to find it at 
early boot time, that's probably because the service hasn't been 
registered yet.  I presume you're looking up the I/O Kit service 
using some simple API, like IOServiceGetMatchingService.  That will 
work post boot, because your daemon has been launchd after I/O Kit 
has fully populated the registry.  However, it may not work in an 
early boot environment because your daemon might be started before 
the I/O registry has been fully populated.  The best solution to this 
problem is to dynamically handle I/O Kit services coming and going, 
by using I/O Kit's async service lookup APIs.  Check out the 
IOServiceAddMatchingNotification routine.  And, as an added benefit, 
you'll be able to handle the service coming and going dynamically.

At 17:15 +0530 1/4/08, Pradip Patel wrote:
>same thing work on 10.4

Yes.  10.5 is even more concurrent than 10.4 was, which means that 
its even more likely that your launchd daemon is starting while the 
kernel is still populating the I/O registry.

S+E
-- 
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