Note that there are some explanatory texts on larger screens.

plurals
  1. POSharing Mach ports with child processes
    primarykey
    data
    text
    <p>I am doing a comparison of different IPC mechanisms available on Mac OS X (pipes, sockets, System V IPC, etc.), and I would like to see how Mach ports compare to the higher-level alternatives. However, I've run into a very basic issue: getting send rights to ports across processes (specifically, across a parent process and a child process).</p> <p>Unlike file descriptors, <a href="http://lists.apple.com/archives/darwin-kernel/2002/Dec/msg00063.html" rel="noreferrer">ports are generally not carried over to forked processes</a>. This means that some other way to transfer them must be established. Just about the only relevant page I could find about this was <a href="http://fdiv.net/2011/01/14/machportt-inter-process-communication" rel="noreferrer">this one</a>, and they state in an update that their method no longer works and never was guaranteed to, even though that method was <a href="http://lists.apple.com/archives/darwin-dev/2009/Jan/msg00072.html" rel="noreferrer">suggested by an Apple engineer in 2009</a>. (It implied replacing the bootstrap port, and now doing that breaks XPC.) The replacement they suggest uses deprecated functions, so that's not a very appealing solution.</p> <p>Besides, one thing I liked about the old solution is that ports remained pretty much private between the processes that used it. There was no need to broadcast the existence of the port, just like pipes (from the <code>pipe</code> call) work once forked. (I'll probably live with it if there's another solution, but it's a little annoying.)</p> <p>So, how do you pass a send right to a Mach port from a parent process to a child process?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload