Re: Alternative to bootstrap_register?
Re: Alternative to bootstrap_register?
- Subject: Re: Alternative to bootstrap_register?
- From: Damien Sorresso <email@hidden>
- Date: Tue, 17 Nov 2009 11:27:03 -0800
On Nov 17, 2009, at 9:27 AM, Uli Kusterer wrote:
> In <servers/bootstrap.h> there is the following note about the bootstrap_register() call:
>
> * This API is deprecated. Old scenarios and recommendations:
> *
> * 1) Code that used to call bootstrap_check_in() and then bootstrap_register()
> * can now always call bootstrap_check_in().
> *
> * 2) If the code was registering a well known name, please switch to launchd.
> *
> * 3) If the code was registering a dynamically generated string and passing
> * the string to other applications, please rewrite the code to send a Mach
> * send-right directly.
>
> In case of suggestion #3, the application that used to call bootstrap_register only has the pid of the target application to which to "send a Mach send-right directly".
>
> In order to send a Mach send right however one needs a send right itself to a port to which the target application has receive rights. In order to get that send right, the target application itself also needs to send this application a Mach send right, however in order send that send right it also needs a send right to send it and the loop never ends.
>
> Does anyone know what paragraph 3) means to achieve and how, possibly with a short example?
The recommended replacement is to have two launchd jobs, one which advertises a service with a well-known name in the bootstrap namespace. The other (the client) looks up that service and sends a request to it. Part of the response to that request is a send right to whatever port the client needs a send right to.
Can you expand on what you're trying to do?
> To be noted, the open source CFMessagePortCreateLocal() still uses bootstrap_register years later after the API has been marked as deprecated.
Yes, we're aware. ;) Feel free to file a Radar.
--
Damien Sorresso
BSD Engineering
Apple Inc.
_______________________________________________
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