unix-domain-socket · shipping · also AF_UNIX socket, local-domain socket

Unix-domain socket

A Unix-domain socket is an operating-system communication endpoint for exchanging data between processes on the same host.

Address: AF_UNIX (AF_LOCAL) supports pathname and unnamed sockets; Linux adds abstract names outside the filesystem. After the leading null byte, address length selects the name bytes; further nulls are not terminators. [1]

Unnamed channel: socketpair(AF_UNIX, SOCK_STREAM, 0, sv) returns two connected, unnamed endpoints. It creates no pathname to preserve in a directory backup. [6]

File type: S_ISSOCK(st_mode) identifies a socket node, not a regular file or message archive. [2] bind() assigns an address. [3] Closing a pathname socket does not unlink its name. [1]

Framing: SOCK_STREAM has no record boundaries. A SOCK_SEQPACKET receive call with insufficient application-buffer space can discard the packet remainder. [4] Linux AF_UNIX SOCK_DGRAM preserves reliable, ordered messages; SOCK_SEQPACKET is connection-oriented and preserves message boundaries and order. [1]

Access and lifetime: Linux pathname creation requires parent-directory write and search permission. Socket write permission gates stream connection and datagram sending; this check is not portable. Abstract names use neither pathname permissions nor umask and disappear after all open references close. [1]

Descriptor handoff: SCM_RIGHTS transfers references to open file descriptions, not file-content copies. [1]

Persistence: Successful send() is not an acknowledgment of peer processing or durable storage. Requiring an application completion and recovery contract is an engineering inference, not a crash experiment. [5]

Historical scope: Berkeley's July 1983 4.2BSD primer separates domain from type and describes generic datagrams without guaranteed reliability; today's Linux AF_UNIX guarantee is domain-specific. [7] [1]

Relations

related
Inode, Open file description

Limitations

  • Linux abstract addresses are not a portable filesystem namespace.
  • Reliable local communication is not a durable-storage guarantee.

Citations

  1. Linux man-pages: unix(7), local addresses, permissions and descriptor passing (accessed 2026-11-15)
  2. Linux man-pages: inode(7), socket and regular-file types (accessed 2026-11-15)
  3. Linux man-pages: bind(2), address assignment and pathname cleanup (accessed 2026-11-15)
  4. Linux man-pages: socket(2), endpoint and socket-type contracts (accessed 2026-11-15)
  5. Linux man-pages: send(2), local completion and error reporting (accessed 2026-11-15)
  6. Linux man-pages: socketpair(2), connected unnamed endpoints (accessed 2026-11-15)
  7. Leffler, Fabry and Joy: A 4.2bsd Interprocess Communication Primer, UCB/CSD-83-145 (July 27, 1983), sections 2 and 2.1 (accessed 2026-11-15)

Further reading

  1. Hesela: a socket name is not stored payload (accessed 2026-11-15)
Sources & caveats
  • Primary-source documentation synthesis; no new socket, permission or crash experiment.
  • Linux-specific address and access rules are distinguished from portable application guarantees.

JSON: /data/terms/unix-domain-socket.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Unix-domain socket. Hesela. 2026-11-15. https://hesela.dev/terms/unix-domain-socket/