Unix domain socket
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 socketSOCK_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 datagramsSOCK_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
- Network socket – Software-based endpoint of network communications
- Berkeley sockets – Inter-process communication API
- Pipeline (Unix) – Mechanism for inter-process communication using message passing
- Netlink – Linux kernel interface for inter-process communication between processes
References
- ^ a b "Linux Programmer's Manual (unix - sockets for local interprocess communication)". 30 April 2018. Retrieved 22 February 2019.
- ^ "Archive of the "Postfix Discussions" mailing list". 30 September 2000. Archived from the original on 18 May 2013. Retrieved 29 September 2014.
- ^ "Linux man page - cmsg(3): access ancillary data". Retrieved 9 October 2018.
- ^ ""Secure Programming for Linux and Unix HOWTO", Section 3.4 "Sockets and Network Connections"". dwheeler.com. David A. Wheeler. 22 August 2004. Retrieved 29 September 2014.
External links
- – System Interfaces Reference, The Single UNIX Specification, Version 5 from The Open Group
- – System Interfaces Reference, The Single UNIX Specification, Version 5 from The Open Group
- – System Interfaces Reference, The Single UNIX Specification, Version 5 from The Open Group
- – System Interfaces Reference, The Single UNIX Specification, Version 5 from The Open Group
- – Linux Programmer's Manual – Library Functions
- ucspi-unix, UNIX-domain socket client-server command-line tools
- Unix sockets vs Internet sockets
- Unix Sockets - Beej's Guide to Unix IPC
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.