Unix domain socket explained

A Unix domain socket (UDS), local socket, or inter-process communication (IPC) socket is a communication endpoint for exchanging data between processes executing in the same Unix or Unix-like operating system.

The name Unix domain socket refers to the domain argument value AF_UNIX that is passed to the function that creates a socket system resource. The same communication domain is also selected by AF_LOCAL.

Valid type argument values for a UDS are:[1]

The UDS facility is a standard component of a POSIX operating system.

The API for a UDS is similar to that of an Internet socket, but rather than using an underlying network protocol, all communication occurs entirely within the operating system kernel. A UDS may use the file system as its address namespace. Some operating systems, like Linux, offer additional namespaces. Processes reference a UDS as a file system inode, so two processes can communicate by opening the same socket.

In addition to sending data, processes may send file descriptors across a UDS connection using the sendmsg and recvmsg system calls. This allows the sending processes to grant the receiving process access to a file descriptor for which the receiving process otherwise does not have access.[2] [3] This can be used to implement a rudimentary form of capability-based security.[4]

External links

Notes and References

  1. Web site: Linux Programmer's Manual (unix - sockets for local interprocess communication) . 30 April 2018 . 22 February 2019 . dmy-all.
  2. Web site: Archive of the "Postfix Discussions" mailing list . 30 September 2000 . 29 September 2014 . https://web.archive.org/web/20130518084034/http://archives.neohapsis.com/archives/postfix/2000-09/1476.html . 18 May 2013 . dead . dmy-all.
  3. Web site: Linux man page - cmsg(3): access ancillary data . 9 October 2018 . dmy-all.
  4. Web site: "Secure Programming for Linux and Unix HOWTO", Section 3.4 "Sockets and Network Connections" . 22 August 2004 . dwheeler.com . David A. Wheeler . 29 September 2014.