summaryrefslogtreecommitdiffstats
path: root/bus/driver.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2004-05-20 18:45:16 +0000
committerKristian Høgsberg <krh@redhat.com>2004-05-20 18:45:16 +0000
commit1919d92d850f247d70cb6821724c4908bf70eeda (patch)
tree34386861a6674be7204038867a2028083e0dcb9a /bus/driver.c
parentce11c651a07e75c5a78fa66d8294003a65291c89 (diff)
Patch from Jon Trowbridge <trow@ximian.com>:
* bus/main.c (setup_reload_pipe): Added. Creates a pipe and sets up a watch that triggers a config reload when one end of the pipe becomes readable. (signal_handler): Instead of doing the config reload in our SIGHUP handler, just write to the reload pipe and let the associated watch handle the reload when control returns to the main loop. * bus/driver.c (bus_driver_handle_reload_config): Added. Implements a ReloadConfig method for requesting a configuration file reload via the bus driver.
Diffstat (limited to 'bus/driver.c')
-rw-r--r--bus/driver.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/bus/driver.c b/bus/driver.c
index a9dddd19..9b444486 100644
--- a/bus/driver.c
+++ b/bus/driver.c
@@ -829,6 +829,32 @@ bus_driver_handle_get_service_owner (DBusConnection *connection,
return FALSE;
}
+static dbus_bool_t
+bus_driver_handle_reload_config (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error)
+{
+ BusContext *context;
+ dbus_bool_t retval;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ retval = FALSE;
+
+ context = bus_connection_get_context (connection);
+ if (!bus_context_reload_config (context, error))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ goto out;
+ }
+
+ retval = TRUE;
+
+ out:
+ return retval;
+}
+
/* For speed it might be useful to sort this in order of
* frequency of use (but doesn't matter with only a few items
* anyhow)
@@ -848,7 +874,8 @@ struct
{ "ListServices", bus_driver_handle_list_services },
{ "AddMatch", bus_driver_handle_add_match },
{ "RemoveMatch", bus_driver_handle_remove_match },
- { "GetServiceOwner", bus_driver_handle_get_service_owner }
+ { "GetServiceOwner", bus_driver_handle_get_service_owner },
+ { "ReloadConfig", bus_driver_handle_reload_config }
};
dbus_bool_t