Commit 1f9e5d70 authored by Chengwei Yang's avatar Chengwei Yang Committed by Simon McVittie

dir-watch: remove dnotify backend

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=33001Signed-off-by: 's avatarChengwei Yang <chengwei.yang@intel.com>
Reviewed-by: 's avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
parent 2dfb5ff6
...@@ -56,7 +56,6 @@ Core library ...@@ -56,7 +56,6 @@ Core library
Optional: Optional:
- libselinux (for SELinux integration) - libselinux (for SELinux integration)
- dnotify (for automatic service file reload)
- doxygen (for API documentation) - doxygen (for API documentation)
- xmlto or meinproc4 (for Spec & other XML documentation) - xmlto or meinproc4 (for Spec & other XML documentation)
......
...@@ -149,10 +149,6 @@ gcc only: ...@@ -149,10 +149,6 @@ gcc only:
// compile with coverage profiling instrumentation // compile with coverage profiling instrumentation
DBUS_GCOV_ENABLED:BOOL=OFF DBUS_GCOV_ENABLED:BOOL=OFF
linux only:
// build with dnotify support
DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX:BOOL=ON
solaris only: solaris only:
// enable console owner file // enable console owner file
HAVE_CONSOLE_OWNER_FILE:BOOL=ON HAVE_CONSOLE_OWNER_FILE:BOOL=ON
......
...@@ -50,13 +50,9 @@ else ...@@ -50,13 +50,9 @@ else
if DBUS_BUS_ENABLE_INOTIFY if DBUS_BUS_ENABLE_INOTIFY
DIR_WATCH_SOURCE=dir-watch-inotify.c DIR_WATCH_SOURCE=dir-watch-inotify.c
else else
if DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX
DIR_WATCH_SOURCE=dir-watch-dnotify.c
else
DIR_WATCH_SOURCE=dir-watch-default.c DIR_WATCH_SOURCE=dir-watch-default.c
endif endif
endif endif
endif
BUS_SOURCES= \ BUS_SOURCES= \
activation.c \ activation.c \
......
/* -*- 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;
}
...@@ -61,10 +61,6 @@ signal_handler (int sig) ...@@ -61,10 +61,6 @@ signal_handler (int sig)
{ {
switch (sig) switch (sig)
{ {
#ifdef DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX
case SIGIO:
/* explicit fall-through */
#endif /* DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX */
#ifdef SIGHUP #ifdef SIGHUP
case SIGHUP: case SIGHUP:
{ {
...@@ -649,9 +645,6 @@ main (int argc, char **argv) ...@@ -649,9 +645,6 @@ main (int argc, char **argv)
#ifdef SIGHUP #ifdef SIGHUP
_dbus_set_signal_handler (SIGHUP, signal_handler); _dbus_set_signal_handler (SIGHUP, signal_handler);
#endif #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 */ #endif /* DBUS_UNIX */
_dbus_verbose ("We are on D-Bus...\n"); _dbus_verbose ("We are on D-Bus...\n");
......
...@@ -279,11 +279,6 @@ endif(NOT MSVC) ...@@ -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) #AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux],[build with SELinux support]),enable_selinux=$enableval,enable_selinux=auto)
#selinux missing #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) #AC_ARG_ENABLE(kqueue, AS_HELP_STRING([--enable-kqueue],[build with kqueue support (FreeBSD only)]),enable_kqueue=$enableval,enable_kqueue=auto)
#missing #missing
...@@ -561,7 +556,6 @@ message(" Building w/o checks: ${DBUS_DISABLE_CHECKS} " ...@@ -561,7 +556,6 @@ message(" Building w/o checks: ${DBUS_DISABLE_CHECKS} "
message(" Building bus stats API: ${DBUS_ENABLE_STATS} ") message(" Building bus stats API: ${DBUS_ENABLE_STATS} ")
message(" installing system libs: ${DBUS_INSTALL_SYSTEM_LIBS} ") message(" installing system libs: ${DBUS_INSTALL_SYSTEM_LIBS} ")
#message(" Building SELinux support: ${have_selinux} ") #message(" Building SELinux support: ${have_selinux} ")
#message(" Building dnotify support: ${have_dnotify} ")
message(" Building Doxygen docs: ${DBUS_ENABLE_DOXYGEN_DOCS} ") message(" Building Doxygen docs: ${DBUS_ENABLE_DOXYGEN_DOCS} ")
message(" Building XML docs: ${DBUS_ENABLE_XML_DOCS} ") message(" Building XML docs: ${DBUS_ENABLE_XML_DOCS} ")
#message(" Gettext libs (empty OK): ${INTLLIBS} ") #message(" Gettext libs (empty OK): ${INTLLIBS} ")
......
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
#endif #endif
/* selinux */ /* selinux */
#cmakedefine DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX 1
/* kqueue */ /* kqueue */
#cmakedefine HAVE_CONSOLE_OWNER_FILE 1 #cmakedefine HAVE_CONSOLE_OWNER_FILE 1
#define DBUS_CONSOLE_OWNER_FILE "@DBUS_CONSOLE_OWNER_FILE@" #define DBUS_CONSOLE_OWNER_FILE "@DBUS_CONSOLE_OWNER_FILE@"
......
...@@ -150,7 +150,6 @@ AC_ARG_ENABLE(doxygen-docs, AS_HELP_STRING([--enable-doxygen-docs],[build DOXYGE ...@@ -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(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(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(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(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(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) 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 ...@@ -1060,24 +1059,6 @@ fi
AM_CONDITIONAL(DBUS_BUS_ENABLE_INOTIFY, test x$have_inotify = xyes) 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 # 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 # compile-time (glibc 2.9), but we'll run on kernels that turn out
# not to have it at runtime. # not to have it at runtime.
...@@ -1863,7 +1844,6 @@ echo " ...@@ -1863,7 +1844,6 @@ echo "
Building bus stats API: ${enable_stats} Building bus stats API: ${enable_stats}
Building SELinux support: ${have_selinux} Building SELinux support: ${have_selinux}
Building inotify support: ${have_inotify} Building inotify support: ${have_inotify}
Building dnotify support: ${have_dnotify}
Building kqueue support: ${have_kqueue} Building kqueue support: ${have_kqueue}
Building systemd support: ${have_systemd} Building systemd support: ${have_systemd}
Building X11 code: ${have_x11} Building X11 code: ${have_x11}
......
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