From c01071b5f778e611047cd60d14e03b56ddc02d5a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 15 Jan 2018 15:31:41 +0000 Subject: [PATCH 3/4] bus: Also tell systemd when we're reloading Signed-off-by: Simon McVittie --- bus/bus.c | 4 ++++ dbus/dbus-sysdeps-util-unix.c | 25 +++++++++++++++++++++++++ dbus/dbus-sysdeps-util-win.c | 10 ++++++++++ dbus/dbus-sysdeps.h | 2 ++ 4 files changed, 41 insertions(+) diff --git a/bus/bus.c b/bus/bus.c index 134d7e1e..8702c5d2 100644 --- a/bus/bus.c +++ b/bus/bus.c @@ -1064,6 +1064,8 @@ bus_context_reload_config (BusContext *context, DBusString config_file; dbus_bool_t ret; + _dbus_daemon_report_reloading (); + /* Flush the user database cache */ _dbus_flush_caches (); @@ -1094,6 +1096,8 @@ bus_context_reload_config (BusContext *context, bus_context_log (context, DBUS_SYSTEM_LOG_INFO, "Unable to reload configuration: %s", error->message); if (parser != NULL) bus_config_parser_unref (parser); + + _dbus_daemon_report_reloaded (); return ret; } diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index 838cd932..8a7c9278 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -1531,3 +1531,28 @@ _dbus_daemon_report_ready (void) sd_notify (0, "READY=1"); #endif } + +/** + * Report to a service manager that the daemon calling this function is + * reloading configuration. This is currently only implemented for systemd. + */ +void +_dbus_daemon_report_reloading (void) +{ +#ifdef HAVE_SYSTEMD + sd_notify (0, "RELOADING=1"); +#endif +} + +/** + * Report to a service manager that the daemon calling this function is + * reloading configuration. This is currently only implemented for systemd. + */ +void +_dbus_daemon_report_reloaded (void) +{ +#ifdef HAVE_SYSTEMD + /* For systemd, this is the same code */ + _dbus_daemon_report_ready (); +#endif +} diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c index f613130e..917dd05e 100644 --- a/dbus/dbus-sysdeps-util-win.c +++ b/dbus/dbus-sysdeps-util-win.c @@ -1659,3 +1659,13 @@ void _dbus_daemon_report_ready (void) { } + +void +_dbus_daemon_report_reloading (void) +{ +} + +void +_dbus_daemon_report_reloaded (void) +{ +} diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h index b2943906..d8e69589 100644 --- a/dbus/dbus-sysdeps.h +++ b/dbus/dbus-sysdeps.h @@ -688,6 +688,8 @@ dbus_bool_t _dbus_rlimit_restore_fd_limit (DBusRLimit *saved, void _dbus_rlimit_free (DBusRLimit *lim); void _dbus_daemon_report_ready (void); +void _dbus_daemon_report_reloading (void); +void _dbus_daemon_report_reloaded (void); /** @} */ -- 2.15.1