]> git.proxmox.com Git - proxmox-backup.git/commitdiff
rest: daemon: sd notify barrier: avoid barging in between SystemdNotify enum and...
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 1 Oct 2021 14:44:28 +0000 (16:44 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 2 Oct 2021 09:45:34 +0000 (11:45 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
proxmox-rest-server/src/daemon.rs

index 63c57e2f52ec68067c0698fc88b62b005a41f42f..495ff8886ace8cfd4fd51be130e1909aaa9e6f61 100644 (file)
@@ -328,19 +328,6 @@ pub enum SystemdNotify {
     MainPid(nix::unistd::Pid),
 }
 
-/// Waits until all previously sent messages with sd_notify are processed
-pub fn systemd_notify_barrier(timeout: u64) -> Result<(), Error> {
-    let rc = unsafe { sd_notify_barrier(0, timeout) };
-    if rc < 0 {
-        bail!(
-            "systemd_notify_barrier failed: {}",
-            std::io::Error::from_raw_os_error(-rc),
-        );
-    }
-
-    Ok(())
-}
-
 /// Tells systemd the startup state of the service (see: ``man sd_notify``)
 pub fn systemd_notify(state: SystemdNotify) -> Result<(), Error> {
 
@@ -365,3 +352,12 @@ pub fn systemd_notify(state: SystemdNotify) -> Result<(), Error> {
 
     Ok(())
 }
+
+/// Waits until all previously sent messages with sd_notify are processed
+pub fn systemd_notify_barrier(timeout: u64) -> Result<(), Error> {
+    let rc = unsafe { sd_notify_barrier(0, timeout) };
+    if rc < 0 {
+        bail!("systemd_notify_barrier failed: {}", std::io::Error::from_raw_os_error(-rc));
+    }
+    Ok(())
+}