From 1919d92d850f247d70cb6821724c4908bf70eeda Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 20 May 2004 18:45:16 +0000 Subject: Patch from Jon Trowbridge : * 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. --- bus/driver.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'bus/driver.c') 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 -- cgit