Add abstract namespace support for ipc sockets on LInux

Description

The abstract socket namespace on Linux allows one to create Unix domain sockets which are not bound to the filesystem.

Abstract Unix sockets have the following benefits:

  • Reduces filesystem clutter

  • Obviates target directory existence and permissions checks

  • No file to remove on close

  • Access to abstract sockets are not restricted by filesystem permissions checks (it is questionable whether this really is a benefit)

This feature has been discussed previously in the following issues:

  • LIBZMQ-134

  • LIBZMQ-48

  • LIBZMQ-260

The suggested feature would allow specifying the abstract namespace by prefixing the ipc path with a strudel or "at symbol" (@) like ipc://@abstract-socket. Internally, the strudel is replaced with the NULL character ('\0'), indicating a socket in the abstract namespace. The use of the strudel as the first character prevents premature termination of the string on systems where strings are NULL terminated. It is used elsewhere, including the Linux version of netstat.

On non-Linux systems, the strudel is not replaced and an error will likely occur if a slash is included in the path because of the missing directory. Alternately, the use of the strudel as the first character of the path could produce an error on non-Linux systems.

If one needs to create a socket in the local directory with a name starting with the strudel, it can be done by prefixing the path with "./" such as ipc://./@my-socket.

Feature implemented in changeset.
Test implemented in changeset.

Environment

Linux versions of libzmq.

Status

Assignee

Unassigned

Reporter

Brandon Carpenter

Labels

None

Components

Fix versions

Priority

Trivial