Function notify

Source
pub fn notify(unset_env: bool, state: &[NotifyState<'_>]) -> Result<()>
Expand description

Sends the service manager a list of state changes.

If the unset_env parameter is set, the NOTIFY_SOCKET environment variable will be unset before returning. Further calls to sd_notify will fail, but child processes will no longer inherit the variable.

The notification mechanism involves sending a datagram to a Unix domain socket. See sd_notify(3) for details.

§Limitations

The implementation of this function is somewhat naive: it doesn’t support sending notifications on behalf of other processes, doesn’t send credentials, and does not increase the send buffer size. It’s still useful, though, in usual situations.

If you wish to send file descriptors, use the notify_with_fds function.

§Example

let _ = sd_notify::notify(true, &[NotifyState::Ready]);