6
6
* Copyright (C) 2003 David Zeuthen, <david@fubar.dk>
7
7
* Copyright (C) 2005 Danny Kukawka, <danny.kukawka@web.de>
8
* Copyright (C) 2007 Codethink Ltd. Author Rob Taylor <rob.taylor@codethink.co.uk>
9
10
* Licensed under the Academic Free License version 2.1
119
124
command_line, hal_device_get_udi(device)));
127
for (hal_device_property_strlist_iter_init (device, "info.addons.singleton", &iter);
128
hal_device_property_strlist_iter_is_valid (&iter);
129
hal_device_property_strlist_iter_next (&iter)) {
130
const gchar *command_line;
132
command_line = hal_device_property_strlist_iter_get_value (&iter);
134
if (hald_singleton_device_added (command_line, device))
135
hal_device_inc_num_addons (device);
137
HAL_ERROR(("Couldn't add device to singleton"));
141
HalDeviceStrListIter iter;
123
143
HAL_INFO (("Removed device from GDL; udi=%s", hal_device_get_udi(device)));
144
for (hal_device_property_strlist_iter_init (device, "info.addons.singleton", &iter);
145
hal_device_property_strlist_iter_is_valid (&iter);
146
hal_device_property_strlist_iter_next (&iter)) {
147
const gchar *command_line;
149
command_line = hal_device_property_strlist_iter_get_value (&iter);
151
hald_singleton_device_removed (command_line, device);
124
154
hald_runner_kill_device(device);
265
295
dbus_bool_t hald_use_syslog = FALSE;
266
296
dbus_bool_t hald_debug_exit_after_probing = FALSE;
299
PolKitContext *pk_context;
268
302
static int sigterm_unix_signal_pipe_fds[2];
269
303
static GIOChannel *sigterm_iochn;
383
417
/*--------------------------------------------------------------------------------------------------*/
422
_polkit_io_watch_have_data (GIOChannel *channel, GIOCondition condition, gpointer user_data)
425
PolKitContext *pk_context = user_data;
426
fd = g_io_channel_unix_get_fd (channel);
427
polkit_context_io_func (pk_context, fd);
432
_polkit_io_add_watch (PolKitContext *pk_context, int fd)
436
channel = g_io_channel_unix_new (fd);
439
id = g_io_add_watch (channel, G_IO_IN, _polkit_io_watch_have_data, pk_context);
441
g_io_channel_unref (channel);
444
g_io_channel_unref (channel);
450
_polkit_io_remove_watch (PolKitContext *pk_context, int watch_id)
452
g_source_remove (watch_id);
455
static guint _polkit_cooloff_timer = 0;
458
_polkit_config_really_changed (gpointer user_data)
460
HAL_INFO (("Acting on PolicyKit config change"));
461
_polkit_cooloff_timer = 0;
462
reconfigure_all_policy ();
467
_polkit_config_changed_cb (PolKitContext *pk_context, gpointer user_data)
469
HAL_INFO (("PolicyKit reports that the config have changed; starting cool-off timer"));
471
/* Start a cool-off timer since we get a lot of events within
472
* a short time-frame...
475
if (_polkit_cooloff_timer > 0) {
476
/* cancel old cool-off timer */
477
g_source_remove (_polkit_cooloff_timer);
478
HAL_INFO (("restarting cool-off timer"));
480
_polkit_cooloff_timer = g_timeout_add (1000, /* one second... */
481
_polkit_config_really_changed,
485
#endif /* HAVE_POLKIT */
387
490
* @argc: Number of arguments
632
737
/* initialize privileged operating system specific parts */
633
738
osspec_privileged_init ();
742
pk_context = polkit_context_new ();
743
if (pk_context == NULL)
744
DIE (("Could not create PolicyKit context"));
745
polkit_context_set_config_changed (pk_context,
746
_polkit_config_changed_cb,
748
polkit_context_set_io_watch_functions (pk_context, _polkit_io_add_watch, _polkit_io_remove_watch);
749
if (!polkit_context_init (pk_context, &p_error))
750
DIE (("Could not init PolicyKit context: %s", polkit_error_get_error_message (p_error)));
635
753
/* sometimes we don't want to drop root privs, for instance
636
754
if we are profiling memory usage */
637
755
if (opt_retain_privileges == FALSE) {
641
759
hald_is_initialising = TRUE;
643
/* make sure our fdi rule cache is up to date */
644
di_cache_coherency_check();
761
/* make sure our fdi rule cache is up to date and setup file monitoring */
762
di_cache_coherency_check(TRUE);
646
764
/* initialize operating system specific parts */