Re: bootstrap_register replacement
Re: bootstrap_register replacement
- Subject: Re: bootstrap_register replacement
- From: Jean-Daniel Dupas <email@hidden>
- Date: Thu, 15 Jan 2009 20:50:12 +0100
Le 15 janv. 09 à 20:40, Damien Sorresso a écrit :
On Jan 15, 2009, at 4:13 AM, Jean-Daniel Dupas wrote:
Hello,
I just have a question. On 10.5, the bootstrap_register() doc said
this method should not longer be used and give some alternatives
like this one:
2) 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.
My question is simple. To send the Mach send right, I need a send
right to the target process. But to get a send right from the
target process, it need a send right on the first process.
That's why the bootstrap server exists.
Maybe I miss something, but I do not understand how I can upgrade
an app that was using the scenarios describe in 2).
Is there some magic way to give a send right to another process ?
AFAK, even passing an arbitrary port to a child process is not
possible.
Task special ports are inherited across fork(2).
0. In parent, create a new port (Port A) to which you hold a receive
right.
1. Insert a send right into that port.
2. Cache your current task bootstrap port.
3. Set the task bootstrap port to Port A.
4. fork(2) / exec(2) your child.
5. In the parent, set your task bootstrap port back to the cached
port.
6. Have the child send a message to the parent (via its bootstrap
port) requesting all the information it needs, perhaps including the
parent's bootstrap port.
7. Optionally, have the child reset its bootstrap port to the
parent's bootstrap port.
Hope this helps. Sometimes I think we need a "general purpose
special port" for things like this, but there's nothing particularly
evil about using the bootstrap port for this purpose.
Thank you.
This is exactly what I need.
_______________________________________________
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