Check out my first novel, midnight's simulacra!

Questions

From dankwiki
Revision as of 17:25, 21 June 2009 by Dank (talk | contribs) (Created page with 'Some questions I've pondered, and my answers, which may or may not be correct. ==UNIX== Q: Why are PF_UNIX sockets the only means of exchanging file descriptors (why not regular...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Some questions I've pondered, and my answers, which may or may not be correct.

UNIX

Q: Why are PF_UNIX sockets the only means of exchanging file descriptors (why not regular pipes? why not PF_INET or PF_INET6 sockets?) A: The socket infrastructure provided sufficient mechanism -- recvmsg(2)/sendmsg(2), struct msghdr etc. Regular pipes don't have out-of-band signaling capabilities, as used by the SCM_RIGHTS cmsg_type. File descriptors index a kernelspace array, and thus any non-local socket family would introduce the possibility of a copy of those structures (if that is even meaningful and possible in a given context). Furthermore, they're credentials, in that access checks have already been performed; a socket family involving peers not trusted by the local kernel could subvert the access control.