]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
bus: Also tell systemd before we shut down
authorSimon McVittie <smcv@collabora.com>
Mon, 15 Jan 2018 15:31:55 +0000 (15:31 +0000)
committerSimon McVittie <smcv@collabora.com>
Fri, 2 Mar 2018 14:49:15 +0000 (14:49 +0000)
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104641

bus/main.c
dbus/dbus-sysdeps-util-unix.c
dbus/dbus-sysdeps-util-win.c
dbus/dbus-sysdeps.h

index 578aa989b4ca6b734007fbe2cd345512a3436d13..28223899c31485fd85b1ff1695cb24cf954232cc 100644 (file)
@@ -320,6 +320,7 @@ handle_reload_watch (DBusWatch    *watch,
         loop = bus_context_get_loop (context);
         if (loop != NULL)
           {
+            _dbus_daemon_report_stopping ();
             _dbus_loop_quit (loop);
           }
       }
index 8a7c92782982411a5fdb37422fa2ae8475496cd8..24eba4e319208c7b5e8b3c1661c65b6a8a97b71d 100644 (file)
@@ -1556,3 +1556,15 @@ _dbus_daemon_report_reloaded (void)
   _dbus_daemon_report_ready ();
 #endif
 }
+
+/**
+ * Report to a service manager that the daemon calling this function is
+ * shutting down. This is currently only implemented for systemd.
+ */
+void
+_dbus_daemon_report_stopping (void)
+{
+#ifdef HAVE_SYSTEMD
+  sd_notify (0, "STOPPING=1");
+#endif
+}
index 917dd05e9e4bbc933615b5a7ed8200ae6ce02b79..a5c3bba6377c56ec1ee6cce7b4089378b1e07896 100644 (file)
@@ -1669,3 +1669,8 @@ void
 _dbus_daemon_report_reloaded (void)
 {
 }
+
+void
+_dbus_daemon_report_stopping (void)
+{
+}
index d8e695898395ee79ccc9339576ea4a5cdad83832..0d1ff7c46a4e46b9a2b3cb3fe51b25b738cebd62 100644 (file)
@@ -690,6 +690,7 @@ void            _dbus_rlimit_free                          (DBusRLimit   *lim);
 void            _dbus_daemon_report_ready                  (void);
 void            _dbus_daemon_report_reloading              (void);
 void            _dbus_daemon_report_reloaded               (void);
+void            _dbus_daemon_report_stopping               (void);
 
 /** @} */