s6
Software
skarnet.org

# The `s6-fdholder-store` program

`s6-fdholder-store` connects to a fd-holding daemon listening on a Unix domain socket, and gives it a copy of one of its open file descriptors for the daemon to hold.

## Interface

         s6-fdholder-store [ -d fd ] [ -T fdtimeout ] [ -t timeout ] path id

- `s6-fdholder-store` connects to a s6-fdholderd server process listening on path.
- It attempts to pass a copy of its standard input, or of its descriptor fd, to the server, with identifier id.

## Options

- `-d fd` : store descriptor number fd. By default, fd is 0 (i.e. the program's stdin will be stored).
- `-T fdtimeout` : the descriptor is stored with an expiration time of fdtimeout milliseconds, which means the s6-fdholderd daemon will close and get rid of the descriptor after this time. By default, fdtimeout is 0, which means infinite - no expiration time.
- `-t timeout` : if the operation cannot be processed in timeout milliseconds, then fail with an error message. Communications with the server should be near-instant, so this option is only here to protect users against programming errors (connecting to the wrong socket, for instance).

## Exit codes

- 0: success.
- 1: the server denied the operation. The meaning of the error messages is explained here.
- 100: wrong usage.
- 111: system call failed - this includes attempting to connect to a nonexistent socket, or one where no s6-fdholderd daemon is listening.

## Usage example

       s6-ipcserver-socketbinder /tmp/mysocket s6-fdholder-store /service/fdholderd/s MYSOCKET

will open a Unix domain socket, bind it to `/tmp/mysocket` and listen to incoming connections, then give it to a s6-fdholderd instance listening on `/service/fdholderd/s`, with no expiration date, with the "MYSOCKET" identifier. Another program will be able to retrieve the socket later, using s6-fdholder-retrieve.