{
  "slug": "unix-domain-socket",
  "term": "Unix-domain socket",
  "aliases": [
    "AF_UNIX socket",
    "local-domain socket"
  ],
  "definition": "A Unix-domain socket is an operating-system communication endpoint for exchanging data between processes on the same host.",
  "note": "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. [unix]\n\nUnnamed channel: socketpair(AF_UNIX, SOCK_STREAM, 0, sv) returns two connected, unnamed endpoints. It creates no pathname to preserve in a directory backup. [socketpair]\n\nFile type: S_ISSOCK(st_mode) identifies a socket node, not a regular file or message archive. [inode] bind() assigns an address. [bind] Closing a pathname socket does not unlink its name. [unix]\n\nFraming: SOCK_STREAM has no record boundaries. A SOCK_SEQPACKET receive call with insufficient application-buffer space can discard the packet remainder. [socket] Linux AF_UNIX SOCK_DGRAM preserves reliable, ordered messages; SOCK_SEQPACKET is connection-oriented and preserves message boundaries and order. [unix]\n\nAccess 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. [unix]\n\nDescriptor handoff: SCM_RIGHTS transfers references to open file descriptions, not file-content copies. [unix]\n\nPersistence: 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. [send]\n\nHistorical 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. [bsd-primer] [unix]",
  "status": "shipping",
  "advantages": [],
  "limitations": [
    "Linux abstract addresses are not a portable filesystem namespace.",
    "Reliable local communication is not a durable-storage guarantee."
  ],
  "related": [
    "inode",
    "open-file-description"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-15",
  "citations": [
    {
      "id": "unix",
      "title": "Linux man-pages: unix(7), local addresses, permissions and descriptor passing",
      "url": "https://man7.org/linux/man-pages/man7/unix.7.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "inode",
      "title": "Linux man-pages: inode(7), socket and regular-file types",
      "url": "https://man7.org/linux/man-pages/man7/inode.7.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "bind",
      "title": "Linux man-pages: bind(2), address assignment and pathname cleanup",
      "url": "https://man7.org/linux/man-pages/man2/bind.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "socket",
      "title": "Linux man-pages: socket(2), endpoint and socket-type contracts",
      "url": "https://man7.org/linux/man-pages/man2/socket.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "send",
      "title": "Linux man-pages: send(2), local completion and error reporting",
      "url": "https://man7.org/linux/man-pages/man2/send.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "socketpair",
      "title": "Linux man-pages: socketpair(2), connected unnamed endpoints",
      "url": "https://man7.org/linux/man-pages/man2/socketpair.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "bsd-primer",
      "title": "Leffler, Fabry and Joy: A 4.2bsd Interprocess Communication Primer, UCB/CSD-83-145 (July 27, 1983), sections 2 and 2.1",
      "url": "https://www2.eecs.berkeley.edu/Pubs/TechRpts/1983/Archive/CSD-83-145.pdf",
      "accessed": "2026-11-15"
    },
    {
      "id": "hesela",
      "title": "Hesela: a socket name is not stored payload",
      "url": "https://hesela.com/analyses/atomic-rename-directory-durability/#unix-domain-socket",
      "accessed": "2026-11-15"
    }
  ],
  "provenance": [
    "Primary-source documentation synthesis; no new socket, permission or crash experiment.",
    "Linux-specific address and access rules are distinguished from portable application guarantees."
  ]
}
