Unix domain socket

From Wikipedia, the free encyclopedia

Template:Short description A Unix domain socket (UDS), also called a local socket or inter-process communication (IPC) socket, is a communication endpoint used for data exchange between processes running on the same Unix or Unix-like operating system.

The term Unix domain socket refers to the domain argument value AF_UNIX passed to the system call that creates the socket. The same communication domain can also be selected with AF_LOCAL.[1]

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

  • SOCK_STREAM (compare to TCP) – a stream-oriented socket
  • SOCK_DGRAM (compare to UDP) – a datagram-oriented socket that preserves message boundaries; on most Unix implementations, Unix domain datagram sockets are reliable and do not reorder datagrams
  • SOCK_SEQPACKET (compare to SCTP) – a connection-oriented sequenced-packet socket that preserves message boundaries and delivers messages in the order sent

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 instead of using an underlying network protocol, communication takes place entirely within the operating system kernel. A UDS may use the file system as its address namespace. Some operating systems, such as Linux, provide additional namespaces. Processes refer to a UDS through a file system inode, allowing two processes to communicate by opening the same socket.

In addition to sending data, processes can pass file descriptors over a UDS connection by using the sendmsg() and recvmsg() system calls. This allows one process to grant another process access to a file descriptor that it would not otherwise be able to use.[2][3] This can be used to implement a rudimentary form of capability-based security.[4]

See also

References

Page Template:Reflist/styles.css has no content.

  1. a b Script error: No such module "citation/CS1".
  2. Script error: No such module "citation/CS1".
  3. Script error: No such module "citation/CS1".
  4. Script error: No such module "citation/CS1".

Script error: No such module "Check for unknown parameters".

Script error: No such module "Navbox". Script error: No such module "Unsubst".

fr:Berkeley sockets#Socket unix