3 ms·
one lesser known facility I have used with UDS is called SCM_RIGHTS. It is used to send open file descriptors for actual files/shm regions/socket connections. t
by DesiLurker 5y ago
one lesser known facility I have used with UDS is called SCM_RIGHTS. It is used to send open file descriptors for actual files/shm regions/socket connections. the receiving process gets the same file handle as if translated into its process space by a dup by kernel. this is very useful for implementing things like graphics compositor where specialized memory regions need to be passed around to various processing stages.
- xfer 5y agoFor people curious: https://man7.org/linux/man-pages/man3/cmsg.3.html https://man7.org/linux/man-pages/man3/cmsg.3.html This is used by a lot of classic unix tools(dbus). The "modern" api for linux is https://man7.org/linux/man-pages/man2/pidfd_getfd.2.html https://man7.org/linux/man-pages/man2/pidfd_getfd.2.html .
- DesiLurker 5y agoits good to have that api but a significant difference is that it requires clients (and even servers) to know the pid of the process they are sending this fd to. this is unnecessary when you can make do with a socket connection (inherited of otherwise).