Skip to main content

take_activation_fd

Function take_activation_fd 

Source
pub fn take_activation_fd() -> Option<OwnedFd>
Expand description

Take the listening socket systemd passed, if it passed one to us.

Follows sd_listen_fds(3): only when LISTEN_PID is our pid, using the first fd. The env vars are then cleared, and the fd is set close-on-exec so the machine helpers monitord re-execs don’t inherit it.

Call it before starting anything that may spawn a process, as spawn_server does: close-on-exec only protects later spawns, and a helper started earlier keeps its copy of the listener.