Function sd_notify::listen_fds [−][src]
pub fn listen_fds() -> Result<impl Iterator<Item = RawFd>>
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.
Example
let socket = sd_notify::listen_fds().map(|mut fds| fds.next().expect("missing fd"));