Re: Can you pass a file descriptor to another process?
Re: Can you pass a file descriptor to another process?
- Subject: Re: Can you pass a file descriptor to another process?
- From: Chris Suter <email@hidden>
- Date: Wed, 20 Aug 2014 14:47:28 -0700
When I’ve done transferring file descriptors, I’ve usually used the
cmsg stuff and unix domain sockets. The old privileged helper tool
stuff used to do things this way. This looks about right:
http://stackoverflow.com/questions/4489433/sending-file-descriptor-over-unix-domain-socket-and-select
I’ve no experience using I_SENDFD/I_RECVFD.
There’s also a way of sending them via Mach ports, but it’s
undocumented and probably unsupported.
-- Chris
On Wed, Aug 20, 2014 at 1:49 PM, James Bucanek <email@hidden> wrote:
> Random question of the week: Is it possible in OS X/Darwin to use ioctl()
> and the I_SENDFD/I_RECVFD commands to copy a file descriptor to another
> process?
>
> I have a helper process that's started (indirectly) via launchd. I'm now
> writing a command line tool to control it. At some point I'd like to
> redirect the helper's output to the file descriptor of the tool's
> stdout/stderr. In other words, I want to command line tool to tell the the
> helper to do something useful, and then have the helper's output sent to the
> same stdout the tool is connected to.
>
> A little research says this should be possible using ioctl() and the
> I_SENDFD and I_RECVFD commands, but I cannot find these command symbols in
> the OS X frameworks. (Well, there's one in OpenTransportProtocol.h, but I'm
> pretty sure we're not supposed to be using that.)
>
> So let me start by asking if this is even possible in OS X/Darwin.
>
> James
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Filesystem-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden