4 ms·
I read this from Wikipedia: "In addition to sending data, processes may send file descriptors across a Unix domain socket". Does this mean you can send a Unix
by galaxyLogic 5y ago
I read this from Wikipedia:
"In addition to sending data, processes may send file descriptors across a Unix domain socket".
Does this mean you can send a Unix domain socket via a Unix domain socket?
https://en.wikipedia.org/wiki/Unix_domain_socket https://en.wikipedia.org/wiki/Unix_domain_socket
- loosescrews 5y agoYes. You can send any file descriptor. You might also be interested in socketpair[1], which creates a pair of FDs connected via an anonymous Unix domain socket. Sending a socketpair over a Unix domain socket is a nice way to establish a new channel of communication. [1] https://man7.org/linux/man-pages/man2/socketpair.2.html https://man7.org/linux/man-pages/man2/socketpair.2.html
- hughrr 5y agoYes although I inherited something that did this once for no good reason and it made me scratch my head for several hours before I understood it properly. YMMV on that.
- markjdb 5y agoYou can even send a Unix socket over itself. The kernel has to be careful to handle that correctly. :)
- galaxyLogic 5y agoThat is pretty far-out, conceptually. But in practice I assume there would be little need for that right? If you have the socket already and you get the same socket again from somebody else, would that give you any new capabilities? If a socket is shared among multiple actors, can a same message be read by all of them? Or does the first reader "remove" the message from it?