2005-11-14 David Zeuthen <davidz@redhat.com>
authorDavid Zeuthen <davidz@redhat.com>
Mon, 14 Nov 2005 20:51:25 +0000 (20:51 +0000)
committerDavid Zeuthen <davidz@redhat.com>
Mon, 14 Nov 2005 20:51:25 +0000 (20:51 +0000)
        Patch from Timo Hoenig <thoenig@suse.de>.

        * bus/bus.c: I've recently investigated why the automatic reload
        of configuration files does not work as expected.

        Currently, reloading configuration files does only work when
        running dbus-daemon with --nodaemon.  If we are running as daemon
        we're hitting a dnotify bug once we fork the process.

        We're initializing the dnotify fds before calling fork().  Once
        the child process forked it does still have the fds (and they
        still show up in /proc/`pidof dbus-daemon`/fd/) but we're not
        getting SIGIO as changes are made to the configuration files.

        The attached patch moves the initialization of the dnotify fds to
        process_config_postinit().  This is safe for all current code
        paths and solves the dnotify disfunction.  If we're running
        dbus-daemon as daemon the fds for dnotify are now being
        initialized after fork() for the child process.

        * configure.in: The current configure.in check for dnotify probes
        'x$target_os' for being 'xlinux-gnu'.  I've changed the check to
        match for 'xlinux', too. Additionally I have adapted the configure
        option's style to match with the others.

ChangeLog
bus/bus.c
configure.in

index dbef4c0..8f40bc2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2005-11-14  David Zeuthen  <davidz@redhat.com>
+
+       Patch from Timo Hoenig <thoenig@suse.de>.
+
+       * bus/bus.c: I've recently investigated why the automatic reload
+       of configuration files does not work as expected.
+
+       Currently, reloading configuration files does only work when
+       running dbus-daemon with --nodaemon.  If we are running as daemon
+       we're hitting a dnotify bug once we fork the process.
+
+       We're initializing the dnotify fds before calling fork().  Once
+       the child process forked it does still have the fds (and they
+       still show up in /proc/`pidof dbus-daemon`/fd/) but we're not
+       getting SIGIO as changes are made to the configuration files.
+
+       The attached patch moves the initialization of the dnotify fds to
+       process_config_postinit().  This is safe for all current code
+       paths and solves the dnotify disfunction.  If we're running
+       dbus-daemon as daemon the fds for dnotify are now being
+       initialized after fork() for the child process.
+
+       * configure.in: The current configure.in check for dnotify probes
+       'x$target_os' for being 'xlinux-gnu'.  I've changed the check to
+       match for 'xlinux', too. Additionally I have adapted the configure
+       option's style to match with the others.
+
 2005-11-14  Robert McQueen  <robot101@debian.org>
 
        * python/decorators.py, python/service.py: Add a new argument to the
index de880cf..48aae8e 100644 (file)
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -479,15 +479,11 @@ process_config_every_time (BusContext      *context,
       goto failed;
     }
 
-  /* Drop existing conf-dir watches (if applicable) and watch all conf directories */
+  /* Drop existing conf-dir watches (if applicable) */
 
   if (is_reload)
     bus_drop_all_directory_watches ();
 
-  _dbus_list_foreach (bus_config_parser_get_conf_dirs (parser),
-                     (DBusForeachFunction) bus_watch_directory,
-                     NULL);
-
   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   retval = TRUE;
 
@@ -497,9 +493,9 @@ process_config_every_time (BusContext      *context,
 }
 
 static dbus_bool_t
-process_config_postinit (BusContext *context,
+process_config_postinit (BusContext      *context,
                         BusConfigParser *parser,
-                        DBusError *error)
+                        DBusError       *error)
 {
   DBusHashTable *service_context_table;
 
@@ -512,6 +508,12 @@ process_config_postinit (BusContext *context,
     }
 
   _dbus_hash_table_unref (service_context_table);
+
+  /* Watch all conf directories */
+  _dbus_list_foreach (bus_config_parser_get_conf_dirs (parser),
+                     (DBusForeachFunction) bus_watch_directory,
+                     NULL);
+
   return TRUE;
 }
 
index 9f049bb..1a82654 100644 (file)
@@ -64,6 +64,7 @@ AC_ARG_ENABLE(mono,             [  --enable-mono         build mono bindings],en
 AC_ARG_ENABLE(mono_docs,        [  --enable-mono-docs    build mono docs],enable_mono_docs=$enableval,enable_mono_docs=no)
 AC_ARG_ENABLE(python,           [  --enable-python       build python bindings],enable_python=$enableval,enable_python=auto)
 AC_ARG_ENABLE(selinux,          [  --enable-selinux      build with SELinux support],enable_selinux=$enableval,enable_selinux=auto)
+AC_ARG_ENABLE(dnotify,          [  --enable-dnotify      build with dnotify support (linux only)],enable_dnotify=$enableval,enable_dnotify=auto)
 
 AC_ARG_WITH(xml,                [  --with-xml=[libxml/expat]           XML library to use])
 AC_ARG_WITH(init-scripts,       [  --with-init-scripts=[redhat]        Style of init scripts to install])
@@ -829,21 +830,21 @@ else
 fi
 
 # dnotify checks
-if test x$target_os = xlinux-gnu; then
-       AC_ARG_ENABLE(dnotify,
-       [  --disable-dnotify         Disable using dnotify on Linux],
-       [case "${enableval}" in
-         yes) dnotify=false ;;
-         no)  dnotify=true ;;
-         *) AC_MSG_ERROR(bad value ${enableval} for --disable-dnotify) ;;
-       esac],[dnotify=true])
+if test x$enable_dnotify = xno ; then
+    have_dnotify=no;
+else
+    if test x$target_os = xlinux-gnu -o x$target_os = xlinux; then
+        have_dnotify=yes;      
+    else
+        have_dnotify=no;
+    fi
 fi
+
 dnl check if dnotify backend is enabled
-if test x$dnotify = xtrue; then
+if test x$have_dnotify = xyes; then
    AC_DEFINE(DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX,1,[Use dnotify on Linux])
 fi
 
-
 #### Set up final flags
 DBUS_CLIENT_CFLAGS=
 DBUS_CLIENT_LIBS=
@@ -1421,6 +1422,7 @@ echo "
         Building GLib bindings:   ${have_glib}
         Building Python bindings: ${have_python}
         Building SELinux support: ${have_selinux}
+        Building dnotify support: ${have_dnotify}
        Building Mono bindings:   ${enable_mono}
        Building Mono docs:       ${enable_mono_docs}
         Building GTK+ tools:      ${have_gtk}