Name

fifo-listen — open the read end of a FIFO and chain

Synopsis

fifo-listen [--uid number] [--gid number] [--mode number] [--systemd-compatibility] {path} {next-prog}

Description

fifo-listen is a chain-loading utility that opens the read end of the FIFO at path, sets the FIFO to file descriptor 3 (closing whatever that descriptor was), and then chain loads to next-prog with the execvp(3) function.

next-prog may contain its own command line options, which fifo-listen will ignore.

After opening it, using the permissions specified with the [--mode] command line argument (if supplied). fifo-listen changes the owner UID of the FIFO to that specified with the [--uid] command line argument (if supplied), and changes the GID of the FIFO to that specified with the [--gid] command line argument (if supplied). The normal conventions for numbers apply, so for octal permissions use a leading zero. Symbolic permissions and account names are not supported.

The [--systemd-compatibility] option causes fifo-listen to set the LISTEN_FDS environment variable to 1, and the LISTEN_PID environment variable to its own process ID. This is for compatibility with daemons that expect to be run under systemd(1).

For compatibility with daemons that expect to be run under inetd(1), inheriting the listening socket as their standard input, simply use fdmove 0 3 in next-prog. See fdmove(1).

Security

fifo-listen will successfully open, change ownership of, and change permissions of path even if it is not a FIFO. This is to allow its use with non-FIFO files such as /proc/kmsg and /dev/klog.

Author

Jonathan de Boyne Pollard