Re: Alternative to bootstrap_register?
Re: Alternative to bootstrap_register?
- Subject: Re: Alternative to bootstrap_register?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Wed, 18 Nov 2009 16:58:19 +0100
Le 18 nov. 2009 à 16:35, Alastair Houghton a écrit :
> On 18 Nov 2009, at 15:22, Jean-Daniel Dupas wrote:
>
> [snip]
>
>> First case:
>> Parent process create a receive right using [NSMachPort port].
>> It register it using an UUID string as the name for example using -[NSMachBootstrapServer registerPort:name:].
>> It starts a child process passing it the service name as argument (or using env variable).
>> The child process get a send right using the -[NSMachBootstrapServer portForName:] method
>>
>> Your Mach channel is up.
>
> [snip]
>
>> Second case. You want to have a send right on a child process.
>>
>> Parent process register a service using launchd API (and pass an UUID string as service name).
>> Parent query a send right using bootstrap_lookup. -> launchd start the child process.
>> Child process retrieves the receive right using the launchd API.
>>
>> Your Mach channel is up.
>>
>> If you need this configuration (child has receive right, parent has send right), an other way is to use method 1 and then the child process can create a port and send a send right to the parent using the first mach channel.
>
> Another alternative is just to use bootstrap_checkin() from the child process, and then you can use the port that that API returns. The parent would then use bootstrap_look_up().
>
> (That's what my sample program does.)
>
Yes, but your server has to checkin before the client can lookup, else the lookup will failed. It work great in your example but this cannot easily be done when the client process is the one that launches the server process.
That's where bootstrap_register was really useful has using this function, a client was able to create the service and lookup without having to wait the server readiness.
> Kind regards,
>
> Alastair.
>
> --
> http://alastairs-place.net
>
>
>
>
-- Jean-Daniel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden