uds_dist (uds_dist v2.0.0)

Copy Markdown View Source

Erlang distribution over Unix domain sockets via the socket module.

See the README for configuration, release integration, platform support, and local development notes.

This module implements the callbacks OTP requires of a custom distribution protocol (listen/1, accept/1, accept_connection/5, setup/5, close/1, select/1, address/0, plus the optional setopts/2, getopts/2). It is loaded by passing -proto_dist uds to the BEAM at boot; the callbacks are invoked by the kernel's distribution machinery, not by user code, and are not documented here.

The implementation is modelled on the erl_uds_dist example in lib/kernel/examples with several simplifications: the socket NIF rather than gen_tcp, distribution protocol version 6 only, abstract namespace support on Linux, and socket-path resolution driven by application configuration (the :socket_dir value on the :uds_dist application environment), the UDS_DIST_DIR environment variable, or a host-global path derived from the node name under /tmp.

The listen backlog and trusted-peer UID policy are read from the application environment at listen/1 time. The backlog defaults to 5, while :allowed_uids defaults to the process's effective UID and also accepts :any or a list of numeric UIDs. Outbound-only nodes read the same policy when they connect.