Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Alternative to bootstrap_register?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alternative to bootstrap_register?



On 17 Nov 2009, at 17:27, Uli Kusterer wrote:

> 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?

:-)  I think paragraph 3 is a bit bonkers, for the reason you give.  You need a send right to a port in the target task in order to send a send right.  Presumably the assumption is that someone may have *had* a send right already and decided to send a name via a separate route for some reason instead, though why you would do that is beyond me.

If you only have a pid, you plainly can't send a send right.  What you need to do is something like the example I posted on my blog the other day:

  <http://alastairs-place.net/2009/11/cross-process_s/>

That is, use a server to register and name your send rights.

As Tyler Sample pointed out to me today, you *could* use the bootstrap server for that purpose, but it's a little evil because you need to use bootstrap_register() (or something similar), and putting random ports in the bootstrap namespace seems a little evil to me.  I prefer the separate server approach.

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

References: 
 >Alternative to bootstrap_register? (From: Uli Kusterer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.