dir-watch: remove dnotify backend
authorChengwei Yang <chengwei.yang@intel.com>
Fri, 28 Jun 2013 01:36:32 +0000 (09:36 +0800)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 28 Jun 2013 10:53:29 +0000 (11:53 +0100)
dnotify as a dir watch backend is broken since Jan 2010 (almost 3.5
years). According to fd.o: #33001, it's no harm to remove dnotify from
this project.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33001
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
INSTALL
README.cmake
bus/Makefile.am
bus/dir-watch-dnotify.c [deleted file]
bus/main.c
cmake/CMakeLists.txt
cmake/config.h.cmake
configure.ac

diff --git a/INSTALL b/INSTALL
index 4e905c5..f2f0122 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -56,7 +56,6 @@ Core library
  Optional:
 
   - libselinux           (for SELinux integration)
-  - dnotify              (for automatic service file reload)
   - doxygen              (for API documentation)
   - xmlto or meinproc4   (for Spec & other XML documentation)
 
index 376dac0..4932e66 100644 (file)
@@ -149,10 +149,6 @@ gcc only:
 // compile with coverage profiling instrumentation
 DBUS_GCOV_ENABLED:BOOL=OFF
 
-linux only:
-// build with dnotify support 
-DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX:BOOL=ON
-
 solaris only:
 // enable console owner file 
 HAVE_CONSOLE_OWNER_FILE:BOOL=ON
index 74c62e7..526f110 100644 (file)
@@ -50,13 +50,9 @@ else
 if DBUS_BUS_ENABLE_INOTIFY
 DIR_WATCH_SOURCE=dir-watch-inotify.c
 else
-if DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX
-DIR_WATCH_SOURCE=dir-watch-dnotify.c
-else
 DIR_WATCH_SOURCE=dir-watch-default.c
 endif
 endif
-endif
 
 BUS_SOURCES=                                   \
        activation.c                            \
diff --git a/bus/dir-watch-dnotify.c b/bus/dir-watch-dnotify.c
deleted file mode 100644 (file)
index b38d7d1..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-/* dir-watch-dnotify.c  OS specific directory change notification for message bus
- *
- * Copyright (C) 2003 Red Hat, Inc.
- *
- * Licensed under the Academic Free License version 2.1
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#include <config.h>
-
-#define _GNU_SOURCE
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-
-#include <dbus/dbus-internals.h>
-#include "dir-watch.h"
-
-#define MAX_DIRS_TO_WATCH 128
-
-/* use a static array to avoid handling OOM */
-static int fds[MAX_DIRS_TO_WATCH];
-static int num_fds = 0;
-
-void
-bus_watch_directory (const char *dir, BusContext *context)
-{
-  int fd;
-
-  _dbus_assert (dir != NULL);
-
-  if (num_fds >= MAX_DIRS_TO_WATCH )
-    {
-      _dbus_warn ("Cannot watch config directory '%s'. Already watching %d directories\n", dir, MAX_DIRS_TO_WATCH);
-      goto out;
-    }
-
-  fd = open (dir, O_RDONLY);
-  if (fd < 0)
-    {
-      _dbus_warn ("Cannot open directory '%s'; error '%s'\n", dir, _dbus_strerror (errno));
-      goto out;
-    }
-
-  if (fcntl (fd, F_NOTIFY, DN_CREATE|DN_DELETE|DN_RENAME|DN_MODIFY) == -1)
-    {
-      _dbus_warn ("Cannot setup D_NOTIFY for '%s' error '%s'\n", dir, _dbus_strerror (errno));
-      close (fd);
-      goto out;
-    }
-  
-  fds[num_fds++] = fd;
-  _dbus_verbose ("Added watch on config directory '%s'\n", dir);
-
- out:
-  ;
-}
-
-void 
-bus_drop_all_directory_watches (void)
-{
-  int i;
-  _dbus_verbose ("Dropping all watches on config directories\n");
-  for (i = 0; i < num_fds; i++)
-    {
-      if (close (fds[i]) != 0)
-       {
-         _dbus_verbose ("Error closing fd %d for config directory watch\n", fds[i]);
-       }
-    }
-  
-  num_fds = 0;
-}
index e53e5f8..53a77e2 100644 (file)
@@ -61,10 +61,6 @@ signal_handler (int sig)
 {
   switch (sig)
     {
-#ifdef DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX
-    case SIGIO:
-      /* explicit fall-through */
-#endif /* DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX  */
 #ifdef SIGHUP
     case SIGHUP:
       {
@@ -649,9 +645,6 @@ main (int argc, char **argv)
 #ifdef SIGHUP
   _dbus_set_signal_handler (SIGHUP, signal_handler);
 #endif
-#ifdef DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX
-  _dbus_set_signal_handler (SIGIO, signal_handler);
-#endif /* DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX */
 #endif /* DBUS_UNIX */
 
   _dbus_verbose ("We are on D-Bus...\n");
index c674351..5fcff04 100644 (file)
@@ -279,11 +279,6 @@ endif(NOT MSVC)
 #AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux],[build with SELinux support]),enable_selinux=$enableval,enable_selinux=auto)
 #selinux missing
 
-#AC_ARG_ENABLE(dnotify, AS_HELP_STRING([--enable-dnotify],[build with dnotify support (linux only)]),enable_dnotify=$enableval,enable_dnotify=auto)
-if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
-    option (DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX "build with dnotify support (linux only)" ON) # add a check !
-endif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
-
 #AC_ARG_ENABLE(kqueue, AS_HELP_STRING([--enable-kqueue],[build with kqueue support (FreeBSD only)]),enable_kqueue=$enableval,enable_kqueue=auto)
 #missing
 
@@ -561,7 +556,6 @@ message("        Building w/o checks:      ${DBUS_DISABLE_CHECKS}              "
 message("        Building bus stats API:   ${DBUS_ENABLE_STATS}                ")
 message("        installing system libs:   ${DBUS_INSTALL_SYSTEM_LIBS}         ")
 #message("        Building SELinux support: ${have_selinux}                     ")
-#message("        Building dnotify support: ${have_dnotify}                     ")
 message("        Building Doxygen docs:    ${DBUS_ENABLE_DOXYGEN_DOCS}         ")
 message("        Building XML docs:        ${DBUS_ENABLE_XML_DOCS}             ")
 #message("        Gettext libs (empty OK):  ${INTLLIBS}                         ")
index 7b9d310..969a625 100644 (file)
@@ -69,7 +69,6 @@
 #endif
 
 /* selinux */
-#cmakedefine DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX 1
 /* kqueue */
 #cmakedefine HAVE_CONSOLE_OWNER_FILE 1
 #define DBUS_CONSOLE_OWNER_FILE "@DBUS_CONSOLE_OWNER_FILE@"
index 782dfba..755e4f0 100644 (file)
@@ -150,7 +150,6 @@ AC_ARG_ENABLE(doxygen-docs, AS_HELP_STRING([--enable-doxygen-docs],[build DOXYGE
 AC_ARG_ENABLE(abstract-sockets, AS_HELP_STRING([--enable-abstract-sockets],[use abstract socket namespace (linux only)]),enable_abstract_sockets=$enableval,enable_abstract_sockets=auto)
 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux],[build with SELinux support]),enable_selinux=$enableval,enable_selinux=auto)
 AC_ARG_ENABLE(libaudit,AS_HELP_STRING([--enable-libaudit],[build audit daemon support for SELinux]),enable_libaudit=$enableval,enable_libaudit=auto)
-AC_ARG_ENABLE(dnotify, AS_HELP_STRING([--enable-dnotify],[build with dnotify support (linux only)]),enable_dnotify=$enableval,enable_dnotify=auto)
 AC_ARG_ENABLE(inotify, AS_HELP_STRING([--enable-inotify],[build with inotify support (linux only)]),enable_inotify=$enableval,enable_inotify=auto)
 AC_ARG_ENABLE(kqueue, AS_HELP_STRING([--enable-kqueue],[build with kqueue support]),enable_kqueue=$enableval,enable_kqueue=auto)
 AC_ARG_ENABLE(console-owner-file, AS_HELP_STRING([--enable-console-owner-file],[enable console owner file]),enable_console_owner_file=$enableval,enable_console_owner_file=auto)
@@ -1060,24 +1059,6 @@ fi
 
 AM_CONDITIONAL(DBUS_BUS_ENABLE_INOTIFY, test x$have_inotify = xyes)
 
-# dnotify checks
-if test x$enable_dnotify = xno ; then
-    have_dnotify=no;
-else
-    if test x$have_inotify = xno -a x$host_os = xlinux-gnu -o x$host_os = xlinux; then
-        have_dnotify=yes;
-    else
-        have_dnotify=no;
-    fi
-fi
-
-dnl check if dnotify backend is enabled
-if test x$have_dnotify = xyes; then
-   AC_DEFINE(DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX,1,[Use dnotify on Linux])
-fi
-
-AM_CONDITIONAL(DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX, test x$have_dnotify = xyes)
-
 # For simplicity, we require the userland API for epoll_create1 at
 # compile-time (glibc 2.9), but we'll run on kernels that turn out
 # not to have it at runtime.
@@ -1863,7 +1844,6 @@ echo "
         Building bus stats API:   ${enable_stats}
         Building SELinux support: ${have_selinux}
         Building inotify support: ${have_inotify}
-        Building dnotify support: ${have_dnotify}
         Building kqueue support:  ${have_kqueue}
         Building systemd support: ${have_systemd}
         Building X11 code:        ${have_x11}