[launchd-dev] launchctl unload not working

James Bucanek subscriber at gloaming.com
Thu Nov 29 17:12:43 PST 2007


Kevin Van Vechten <mailto:kvv at apple.com> wrote (Thursday, 
November 29, 2007 5:32 PM -0800):

>Just to clear up some terminology...
>
>A bootstrap is a namespace for looking up mach services by name.  I
>would describe the above as "the helper's port does not appear in the
>root bootstrap."  And "the scheduler is started by the root launchd."

That's correct.

>>crocodile:~ james$ ~/Desktop/seedaemons.sh
>
>>per-user
>>789 -   [0x0-0x4d04d].com.qrecall.client
>>115 -   [0x0-0x16016].com.qrecall.monitor
>>1182    -   0x10df80.QRecallHelper
>>1170    -   0x10dcc0.QRecallScheduler
>>1167    -   0x1109d0.QRecallScheduler
>>per-user namespace
>>A  QRecallMonitor
>>root
>>1182    -   0x10b0b0.QRecallHelper
>>1170    -   0x10be90.QRecallScheduler
>>1167    -   com.qrecall.scheduler.501
>>root namespace
>>A  QRecallScheduler.501
>
>
>This output doesn't actually tell us which bootstrap the QRecallHelper
>or QRecallScheduler are running in.  All it tells us is that both of
>these processes have made themselves known to each of these launchd
>processes (which could have happened a number of ways).
>
>The fact that the lookup fails in the root bootstrap strongly implies
>the helper is registered in the per-user bootstrap (if it's registered
>at all). What is the name of the helper's registration?  (I'm assuming
>it's neither "QRecallScheduler.501" nor "QRecallMonitor" which are the
>only two names you've listed.)

A helper is given a name that includes its user and a job 
number. So it would register a port with a name like "QRecallHelper.501.6f3b21e0".

>As an aside, which API are you using to register the mach port?
>bootstrap_register? CFMessagePort?

Both the scheduler and the helper register their distributed 
object connection using the following code (this is actually in 
a subroutine that's shared by all binaries, so I'm confident 
there are no differences between tasks):

     NSConnection* serverConnection = [NSConnection defaultConnection];
     if (![serverConnection registerName:serviceName])
         {
         // log error
         serverConnection = nil;
         }
     return (serverConnection);

-- 
James Bucanek



More information about the launchd-dev mailing list