Re: Alternative to bootstrap_register?
Re: Alternative to bootstrap_register?
- Subject: Re: Alternative to bootstrap_register?
- From: Alastair Houghton <email@hidden>
- Date: Wed, 18 Nov 2009 15:35:02 +0000
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.)
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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