The recvfd program

recvfd socket {fd|$VAR} [...] : command arg ...

recvfd receives one or more file descriptors over a Unix-domain socket (such as those opened with s6-ipcclient/s6-ipcserver or ucspi-unix). Another process that has a descriptor for the other end of the socket can send the descriptors using the fd_xfer_send() library function. The received descriptors will not necessarily have the same numeric values, but will refer to the same open file handles, as if by dup(). After receiving the descriptors, recvfd moves them to the descriptor numbers specified on the command line with dup2(), or sets the given environment variables (prefixed with "$") to indicate what descriptor numbers were received. Finally, recvfd execs the given command. A colon separates the file descriptors and environment variable names from the command.

This is useful, for example, in network clients that want to use UCSPI client programs to establish connections, but which can't have all connections opened at startup.