Commit 600e411f authored by Jon Trowbridge's avatar Jon Trowbridge

2004-04-15 Jon Trowbridge <trow@ximian.com>

	    * bus/main.c (signal_handler): Reload the configuration files
	    on SIGHUP.
	    (main): Set up our SIGHUP handler.

	    * bus/bus.c (struct BusContext): Store the config file, user and
	    fork flag in the BusContext.
	    (process_config_first_time_only): Added.  Contains the code
	    (previously in bus_context_new) for setting up the BusContext from
	    the BusConfigParser that should only be run the first time the
	    config files are read.
	    (process_config_every_time): Added.  Contains the code (previously
	    in bus_context_new) for setting up the BusContext from the
	    BusConfigParser that should be run every time the config files are
	    read.
	    (load_config): Added.  Builds a BusConfigParser from the config
	    files and passes the resulting structure off to
	    process_config_first_time_only (assuming this is the first time)
	    and process_config_every_time.
	    (bus_context_new): All of the config-related code has been moved
	    to process_config_first_time_only and process_config_every_time.
	    Now this function just does the non-config-related initializations
	    and calls load_config.
	    (bus_context_reload_config): Added.
parent a470eaa0
2004-04-15 Jon Trowbridge <trow@ximian.com>
* bus/main.c (signal_handler): Reload the configuration files
on SIGHUP.
(main): Set up our SIGHUP handler.
* bus/bus.c (struct BusContext): Store the config file, user and
fork flag in the BusContext.
(process_config_first_time_only): Added. Contains the code
(previously in bus_context_new) for setting up the BusContext from
the BusConfigParser that should only be run the first time the
config files are read.
(process_config_every_time): Added. Contains the code (previously
in bus_context_new) for setting up the BusContext from the
BusConfigParser that should be run every time the config files are
read.
(load_config): Added. Builds a BusConfigParser from the config
files and passes the resulting structure off to
process_config_first_time_only (assuming this is the first time)
and process_config_every_time.
(bus_context_new): All of the config-related code has been moved
to process_config_first_time_only and process_config_every_time.
Now this function just does the non-config-related initializations
and calls load_config.
(bus_context_reload_config): Added.
2004-04-15 Olivier Andrieu <oliv__a@users.sourceforge.net>
* bus/driver.c (bus_driver_handle_get_service_owner):
......
This diff is collapsed.
......@@ -65,6 +65,8 @@ BusContext* bus_context_new (const DBusStri
int print_addr_fd,
int print_pid_fd,
DBusError *error);
dbus_bool_t bus_context_reload_config (BusContext *context,
DBusError *error);
void bus_context_shutdown (BusContext *context);
BusContext* bus_context_ref (BusContext *context);
void bus_context_unref (BusContext *context);
......
......@@ -29,15 +29,28 @@
#include <errno.h>
static BusContext *context;
static dbus_bool_t got_sighup = FALSE;
static void
signal_handler (int sig)
{
DBusError error;
switch (sig)
{
case SIGHUP:
got_sighup = TRUE;
/* FIXME: We shouldn't be reloading the config in the
signal handler. We should use a pipe or something to
make the reload happen in the main loop. */
dbus_error_init (&error);
if (!bus_context_reload_config (context, &error))
{
_dbus_warn ("Unable to reload configuration: %s\n",
error.message);
dbus_error_free (&error);
exit (1);
}
break;
case SIGTERM:
_dbus_loop_quit (bus_context_get_loop (context));
break;
......@@ -297,7 +310,7 @@ main (int argc, char **argv)
exit (1);
}
/* FIXME we have to handle this properly below _dbus_set_signal_handler (SIGHUP, signal_handler); */
_dbus_set_signal_handler (SIGHUP, signal_handler);
_dbus_set_signal_handler (SIGTERM, signal_handler);
_dbus_verbose ("We are on D-Bus...\n");
......@@ -306,13 +319,5 @@ main (int argc, char **argv)
bus_context_shutdown (context);
bus_context_unref (context);
/* If we exited on TERM we just exit, if we exited on
* HUP we restart the daemon.
*/
if (got_sighup)
{
/* FIXME execv (argv) basically */
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment