s6
Software
skarnet.org

# The `s6-ipcserver-socketbinder` program

`s6-ipcserver-socketbinder` binds a Unix domain socket, then executes a program.

## Interface

         s6-ipcserver-socketbinder [ -d | -D ] [ -b backlog ] [ -M | -m ] [ -a perms ] [ -B ] path prog...

- s6-ipcserver-socketbinder creates a Unix domain socket and binds it to path. It prepares the socket to accept connections by calling listen().
- It then execs into prog... with the open socket as its standard input.

## Options

- `-d` : allow instant rebinding to the same path even if it has been used not long ago - this is the SO_REUSEADDR flag to setsockopt() and is generally used with server programs. This is the default. Note that path will be deleted if it already exists at program start time.
- `-D` : disallow instant rebinding to the same path.
- `-b backlog` : set a maximum of backlog backlog connections on the socket - extra connection attempts will rejected by the kernel. The default is SOMAXCONN, i.e. the maximum number allowed by the system. If backlog is 0, then the socket will be created, but it will not be listening.
- `-M` : the type of the socket will be SOCK_STREAM. This is the default.
- `-m` : the type of the socket will be SOCK_DGRAM. Note that by default SOCK_DGRAM sockets are not connection-mode, and `listen()` will fail - so you should always give the `-b0` option to s6-ipcserver-socketbinder along with `-m`.
- `-a perms` : create the socket with permissions perms, which is an octal number from 0000 to 0777. Default is 0777, meaning everyone can connect to it. 0700 means only processes having the same uid as the s6-ipcserver-socketbinder process can connect to it.
- `-B` : the socket will be blocking. The default is nonblocking.

## Notes

- The socket is provided non-blocking by default.
- s6-ipcserver-socketbinder is part of a set of basic blocks used to build a flexible Unix super-server. It normally should be given a command line crafted to make it execute into s6-ipcserverd to accept connections from clients, or into a program such as s6-applyuidgid to drop privileges before doing so.
- The s6-ipcserver program does exactly this. It implements a full Unix super-server by building a command line starting with s6-ipcserver-socketbinder and ending with s6-ipcserverd followed by the application program, and executing into it.