]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
bus: Notify systemd when we are ready
authorSimon McVittie <smcv@collabora.com>
Mon, 15 Jan 2018 15:15:52 +0000 (15:15 +0000)
committerSimon McVittie <smcv@collabora.com>
Fri, 2 Mar 2018 14:48:49 +0000 (14:48 +0000)
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104641
Reviewed-by: Philip Withnall <withnall@endlessm.com>
bus/dbus.service.in
bus/main.c
bus/systemd-user/dbus.service.in
dbus/dbus-sysdeps-util-unix.c
dbus/dbus-sysdeps-util-win.c
dbus/dbus-sysdeps.h

index ca0b7e96733e59a95b8a01378cfc679325701611..3713810bababbeef18854d40c8e720446756f0fb 100644 (file)
@@ -4,6 +4,8 @@ Documentation=man:dbus-daemon(1)
 Requires=dbus.socket
 
 [Service]
+Type=notify
+NotifyAccess=main
 ExecStart=@EXPANDED_BINDIR@/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
 ExecReload=@EXPANDED_BINDIR@/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
 OOMScoreAdjust=-900
index b3fcddd0298a5e4fe101733faf719d8f328fc861..578aa989b4ca6b734007fbe2cd345512a3436d13 100644 (file)
@@ -716,6 +716,7 @@ main (int argc, char **argv)
 #endif /* DBUS_UNIX */
 
   _dbus_verbose ("We are on D-Bus...\n");
+  _dbus_daemon_report_ready ();
   _dbus_loop_run (bus_context_get_loop (context));
 
   bus_context_shutdown (context);
index 7ceffbeec03d86b58aef7ec5a4d3e9e07e0386f9..b291b92348ad60afbca58ebe0c37250228f4cd11 100644 (file)
@@ -4,5 +4,7 @@ Documentation=man:dbus-daemon(1)
 Requires=dbus.socket
 
 [Service]
+Type=notify
+NotifyAccess=main
 ExecStart=@EXPANDED_BINDIR@/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
 ExecReload=@EXPANDED_BINDIR@/dbus-send --print-reply --session --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
index b841bf63fb83c189920ee4dd4c6066ed504ad982..838cd932e4edba7f22721d860cf1c3be7f45cfef 100644 (file)
@@ -1519,3 +1519,15 @@ _dbus_get_session_config_file (DBusString *str)
 
   return _dbus_string_append (str, DBUS_SESSION_CONFIG_FILE);
 }
+
+/**
+ * Report to a service manager that the daemon calling this function is
+ * ready for use. This is currently only implemented for systemd.
+ */
+void
+_dbus_daemon_report_ready (void)
+{
+#ifdef HAVE_SYSTEMD
+  sd_notify (0, "READY=1");
+#endif
+}
index 1ef4ae6cdc8d71dc40d95430525b8180a324f4f7..f613130e3a0310307229f8e6638de9cb17cd038c 100644 (file)
@@ -1654,3 +1654,8 @@ _dbus_get_session_config_file (DBusString *str)
 
   return _dbus_get_config_file_name(str, "session.conf");
 }
+
+void
+_dbus_daemon_report_ready (void)
+{
+}
index b9b0c4401c1b3bd026f97cf74ebabac10e21a473..b2943906bc36e7c625103c871f6113fa78740723 100644 (file)
@@ -687,6 +687,8 @@ dbus_bool_t     _dbus_rlimit_restore_fd_limit              (DBusRLimit   *saved,
                                                             DBusError    *error);
 void            _dbus_rlimit_free                          (DBusRLimit   *lim);
 
+void            _dbus_daemon_report_ready                  (void);
+
 /** @} */
 
 DBUS_END_DECLS