Re: DO over unnamed sockets
Re: DO over unnamed sockets
- Subject: Re: DO over unnamed sockets
- From: Dave Keck <email@hidden>
- Date: Sat, 23 Oct 2010 11:41:44 -0400
> You can verify this by breaking on connect() or using dtruss or the like. It's actually getting ENOENT. It appears be using getsockname() on the send port's socket to figure out where to connect, and that's giving a sockaddr_un with an empty sun_path.
Moments after sending my original email I set some breakpoints and
that's exactly what I found, too.
> I don't think that the raw Mach port rights are inherited through a fork-exec, unfortunately. If they were, I think you could create a connection with them successfully.
I looked into this option, but indeed only certain special ports are
inherited by child processes (exception ports, bootstrap port, etc.)
and there doesn't appear to be any way to specify that a port should
be inherited. Bummer. Interestingly though, there's an article that
documents a method of passing a user-created port to a child by way of
temporarily replacing the bootstrap port before the parent forks:
http://www.foldr.org/~michaelw/log/computers/macosx/task-info-fun-with-mach
Unfortunately it's a bit of a hack that won't play nice with other
threads in the parent that use the bootstrap port.
> But, if I'm right that you can't inherit the Mach port rights, then you'd need to register the server with a name server, which is what you're trying to avoid.
I started investigating subclassing NSPort to use an unnamed pipe – my
preliminary tests are promising, and the docs/header for NSPort
suggest that it's designed for subclassing. If you have any thoughts
please let me know – I haven't delved in quite yet.
Should that fail, I guess the only other option is an authentication
scheme combined with the name server dance.
David
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden