pub fn listen_fds() -> Result<impl Iterator<Item = RawFd>>
Expand description

Checks for file descriptors passed by the service manager for socket activation.

The function returns an iterator over file descriptors, starting from SD_LISTEN_FDS_START. The number of descriptors is obtained from the LISTEN_FDS environment variable.

Before returning, the file descriptors are set as O_CLOEXEC.

See sd_listen_fds(3) for details.


let socket = sd_notify::listen_fds().map(|mut fds|"missing fd"));