diff options
author | jylefort <jylefort@FreeBSD.org> | 2005-05-20 03:42:04 +0800 |
---|---|---|
committer | jylefort <jylefort@FreeBSD.org> | 2005-05-20 03:42:04 +0800 |
commit | 18e0075edf2a858afb3b81dbceb98deea8d8d134 (patch) | |
tree | 2ddbaf1bc07e8c63b884f7d721f4cd404d2538c9 | |
parent | a5089218a417caf5b4fa4b53662a80fb63d0ca64 (diff) | |
download | freebsd-ports-gnome-18e0075edf2a858afb3b81dbceb98deea8d8d134.tar.gz freebsd-ports-gnome-18e0075edf2a858afb3b81dbceb98deea8d8d134.tar.zst freebsd-ports-gnome-18e0075edf2a858afb3b81dbceb98deea8d8d134.zip |
Update to 0.1.0
-rw-r--r-- | devel/gamin/Makefile | 7 | ||||
-rw-r--r-- | devel/gamin/distinfo | 4 | ||||
-rw-r--r-- | devel/gamin/files/patch-config.h.in | 12 | ||||
-rw-r--r-- | devel/gamin/files/patch-configure | 76 | ||||
-rw-r--r-- | devel/gamin/files/patch-configure.in | 31 | ||||
-rw-r--r-- | devel/gamin/files/patch-libgamin_gam_api.c | 109 | ||||
-rw-r--r-- | devel/gamin/files/patch-libgamin_gam_data.c | 11 | ||||
-rw-r--r-- | devel/gamin/files/patch-python_Makefile.in | 15 | ||||
-rw-r--r-- | devel/gamin/files/patch-server_Makefile.in | 47 | ||||
-rw-r--r-- | devel/gamin/files/patch-server_gam_channel.c | 144 | ||||
-rw-r--r-- | devel/gamin/files/patch-server_gam_kqueue.c | 824 | ||||
-rw-r--r-- | devel/gamin/files/patch-server_gam_kqueue.h | 38 | ||||
-rw-r--r-- | devel/gamin/files/patch-server_gam_server.c | 56 | ||||
-rw-r--r-- | devel/gamin/pkg-plist | 2 | ||||
-rw-r--r-- | devel/py-gamin/Makefile | 3 |
15 files changed, 692 insertions, 687 deletions
diff --git a/devel/gamin/Makefile b/devel/gamin/Makefile index 3eaf490d3aa1..1f6b956cf8e5 100644 --- a/devel/gamin/Makefile +++ b/devel/gamin/Makefile @@ -6,8 +6,7 @@ # PORTNAME= gamin -PORTVERSION= 0.0.26 -PORTREVISION?= 13 +PORTVERSION= 0.1.0 CATEGORIES?= devel MASTER_SITES= http://www.gnome.org/~veillard/gamin/sources/ @@ -19,8 +18,8 @@ USE_GNOME?= gnomehack glib20 INSTALLS_SHLIB= yes CONFIGURE_ARGS?=--disable-gtk-doc --with-html-dir=${PREFIX}/share/doc \ --without-python -CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ - LDFLAGS="-L${LOCALBASE}/lib" +CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include ${PTHREAD_CFLAGS}" \ + LDFLAGS="-L${LOCALBASE}/lib ${PTHREAD_LIBS}" CONFLICTS= fam-[0-9]* diff --git a/devel/gamin/distinfo b/devel/gamin/distinfo index 498f60829967..7c3ea60750c5 100644 --- a/devel/gamin/distinfo +++ b/devel/gamin/distinfo @@ -1,2 +1,2 @@ -MD5 (gamin-0.0.26.tar.gz) = 3d716b6533466f9ca69df13c58009981 -SIZE (gamin-0.0.26.tar.gz) = 484070 +MD5 (gamin-0.1.0.tar.gz) = 282f34278af3367150e163136382d22d +SIZE (gamin-0.1.0.tar.gz) = 498055 diff --git a/devel/gamin/files/patch-config.h.in b/devel/gamin/files/patch-config.h.in deleted file mode 100644 index 095ee06375ee..000000000000 --- a/devel/gamin/files/patch-config.h.in +++ /dev/null @@ -1,12 +0,0 @@ ---- config.h.in.orig Thu Mar 24 23:41:54 2005 -+++ config.h.in Thu Mar 24 23:42:12 2005 -@@ -6,6 +6,9 @@ - /* Use inotify as backend */ - #undef ENABLE_INOTIFY - -+/* Use kqueue as backend */ -+#undef ENABLE_KQUEUE -+ - /* Use polling as backend */ - #undef ENABLE_POLLING - diff --git a/devel/gamin/files/patch-configure b/devel/gamin/files/patch-configure deleted file mode 100644 index c26ef854cf2e..000000000000 --- a/devel/gamin/files/patch-configure +++ /dev/null @@ -1,76 +0,0 @@ ---- configure.orig Fri Mar 25 01:48:07 2005 -+++ configure Fri Mar 25 02:17:01 2005 -@@ -463,7 +463,7 @@ - # include <unistd.h> - #endif" - --ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os GAMIN_MAJOR_VERSION GAMIN_MINOR_VERSION GAMIN_MICRO_VERSION GAMIN_VERSION GAMIN_VERSION_INFO FAM_VERSION_INFO INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL RELDATE HTML_DIR ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE PKG_CONFIG DAEMON_CFLAGS DAEMON_LIBS LIBGAMIN_CFLAGS LIBGAMIN_LIBS TEST_CFLAGS TEST_LIBS GAMIN_DEBUG_TRUE GAMIN_DEBUG_FALSE BUILD_DOCS_TRUE BUILD_DOCS_FALSE HAVE_LINUX_TRUE HAVE_LINUX_FALSE ENABLE_DNOTIFY_TRUE ENABLE_DNOTIFY_FALSE ENABLE_INOTIFY_TRUE ENABLE_INOTIFY_FALSE PYTHON WITH_PYTHON_TRUE WITH_PYTHON_FALSE pythondir PYTHON_VERSION PYTHON_SUBDIR PYTHON_INCLUDES PYTHON_PYTHON_SITE_PACKAGES LIBOBJS LTLIBOBJS' -+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os GAMIN_MAJOR_VERSION GAMIN_MINOR_VERSION GAMIN_MICRO_VERSION GAMIN_VERSION GAMIN_VERSION_INFO FAM_VERSION_INFO INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL RELDATE HTML_DIR ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE PKG_CONFIG DAEMON_CFLAGS DAEMON_LIBS LIBGAMIN_CFLAGS LIBGAMIN_LIBS TEST_CFLAGS TEST_LIBS GAMIN_DEBUG_TRUE GAMIN_DEBUG_FALSE BUILD_DOCS_TRUE BUILD_DOCS_FALSE HAVE_LINUX_TRUE HAVE_LINUX_FALSE ENABLE_DNOTIFY_TRUE ENABLE_DNOTIFY_FALSE ENABLE_KQUEUE_TRUE ENABLE_KQUEUE_FALSE ENABLE_INOTIFY_TRUE ENABLE_INOTIFY_FALSE PYTHON WITH_PYTHON_TRUE WITH_PYTHON_FALSE pythondir PYTHON_VERSION PYTHON_SUBDIR PYTHON_INCLUDES PYTHON_SITE_PACKAGES LIBOBJS LTLIBOBJS' - ac_subst_files='' - - # Initialize some variables set by options. -@@ -21926,7 +21926,7 @@ - - - debug_api=no --if test "`hostname`" == "paphio" -a "`pwd`" == "/u/veillard/gamin" -+if test "`hostname`" = "paphio" -a "`pwd`" = "/u/veillard/gamin" - then - debug_api=yes - fi -@@ -22051,6 +22051,37 @@ - backends="${backends}, dnotify" - fi - -+if test "${enable_kqueue+set}" = set; then -+ enableval="$enable_kqueue" -+ case "${enableval}" in -+ yes) kqueue=true ;; -+ no) kqueue=false ;; -+ *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --disable-kqueue" >&5 -+echo "$as_me: error: bad value ${enableval} for --disable-kqueue" >&2;} -+ { (exit 1); exit 1; }; } ;; -+ esac -+else -+ kqueue=true -+fi -+ -+if test x$kqueue = xtrue; then -+ ENABLE_KQUEUE_TRUE= -+ ENABLE_KQUEUE_FALSE='#' -+else -+ ENABLE_KQUEUE_TRUE='#' -+ ENABLE_KQUEUE_FALSE= -+fi -+ -+ -+if test x$kqueue = xtrue; then -+ -+cat >>confdefs.h <<\_ACEOF -+#define ENABLE_KQUEUE 1 -+_ACEOF -+ -+ backends="${backends}, kqueue" -+fi -+ - if test x$os = xlinux-gnu; then - # Check whether --enable-inotify or --disable-inotify was given. - if test "${enable_inotify+set}" = set; then -@@ -23472,6 +23503,8 @@ - s,@HAVE_LINUX_FALSE@,$HAVE_LINUX_FALSE,;t t - s,@ENABLE_DNOTIFY_TRUE@,$ENABLE_DNOTIFY_TRUE,;t t - s,@ENABLE_DNOTIFY_FALSE@,$ENABLE_DNOTIFY_FALSE,;t t -+s,@ENABLE_KQUEUE_TRUE@,$ENABLE_KQUEUE_TRUE,;t t -+s,@ENABLE_KQUEUE_FALSE@,$ENABLE_KQUEUE_FALSE,;t t - s,@ENABLE_INOTIFY_TRUE@,$ENABLE_INOTIFY_TRUE,;t t - s,@ENABLE_INOTIFY_FALSE@,$ENABLE_INOTIFY_FALSE,;t t - s,@PYTHON@,$PYTHON,;t t -@@ -23481,7 +23514,7 @@ - s,@PYTHON_VERSION@,$PYTHON_VERSION,;t t - s,@PYTHON_SUBDIR@,$PYTHON_SUBDIR,;t t - s,@PYTHON_INCLUDES@,$PYTHON_INCLUDES,;t t --s,@PYTHON_PYTHON_SITE_PACKAGES@,$PYTHON_PYTHON_SITE_PACKAGES,;t t -+s,@PYTHON_SITE_PACKAGES@,$PYTHON_SITE_PACKAGES,;t t - s,@LIBOBJS@,$LIBOBJS,;t t - s,@LTLIBOBJS@,$LTLIBOBJS,;t t - CEOF diff --git a/devel/gamin/files/patch-configure.in b/devel/gamin/files/patch-configure.in deleted file mode 100644 index b1e2cdebc85a..000000000000 --- a/devel/gamin/files/patch-configure.in +++ /dev/null @@ -1,31 +0,0 @@ ---- configure.in.orig Wed Mar 30 15:19:06 2005 -+++ configure.in Wed Mar 30 15:38:58 2005 -@@ -230,6 +230,28 @@ - backends="${backends}, inotify" - fi - -+if test x$os != xBogusOS; then -+ AC_CHECK_FUNC(kevent,[have_kevent=1],) -+ if test x$have_kevent = x1 ; then -+ AC_ARG_ENABLE(kqueue, -+ [ --disable-kqueue Disable the KQueue backend], -+ [case "${enableval}" in -+ yes) kqueue=true ;; -+ no) kqueue=false ;; -+ *) AC_MSG_ERROR(bad value ${enableval} for --disable-kqueue) ;; -+ esac],[kqueue=true]) -+ fi -+fi -+ -+dnl check if kqueue backend is enabled -+AM_CONDITIONAL(ENABLE_KQUEUE, test x$kqueue = xtrue) -+ -+if test x$kqueue = xtrue; then -+ AC_CHECK_HEADERS(sys/event.h) -+ AC_DEFINE(ENABLE_KQUEUE,1,[Use kqueue as backend]) -+ backends="${backends}, kqueue" -+fi -+ - dnl check for flavours of varargs macros (test from GLib) - AC_MSG_CHECKING(for ISO C99 varargs macros in C) - AC_TRY_COMPILE([],[ diff --git a/devel/gamin/files/patch-libgamin_gam_api.c b/devel/gamin/files/patch-libgamin_gam_api.c index 3bc8d9d85299..704f97866301 100644 --- a/devel/gamin/files/patch-libgamin_gam_api.c +++ b/devel/gamin/files/patch-libgamin_gam_api.c @@ -1,68 +1,24 @@ ---- libgamin/gam_api.c.orig Mon Apr 25 01:03:31 2005 -+++ libgamin/gam_api.c Mon Apr 25 01:26:45 2005 -@@ -13,6 +13,7 @@ - #include <sys/stat.h> - #include <sys/socket.h> - #include <sys/un.h> -+#include <sys/uio.h> - #include "fam.h" - #include "gam_protocol.h" - #include "gam_data.h" -@@ -181,7 +182,6 @@ gamin_get_socket_dir(void) - snprintf(path, MAXPATHLEN, "/tmp/fam-%s", user); - path[MAXPATHLEN] = 0; - ret = strdup(path); -- free(user); - return (ret); - } - -@@ -421,9 +421,35 @@ gamin_write_credential_byte(int fd) +--- libgamin/gam_api.c.orig Thu May 19 20:40:13 2005 ++++ libgamin/gam_api.c Thu May 19 20:41:38 2005 +@@ -421,7 +421,7 @@ { char data[2] = { 0, 0 }; int written; +-#if defined(HAVE_CMSGCRED) && !defined(LOCAL_CREDS) +#if defined(HAVE_CMSGCRED) && (!defined(LOCAL_CREDS) || defined(__FreeBSD__)) -+ struct { -+ struct cmsghdr hdr; -+ struct cmsgcred cred; -+ } cmsg; -+ struct iovec iov; -+ struct msghdr msg; -+ -+ iov.iov_base = &data[0]; -+ iov.iov_len = 1; -+ -+ memset (&msg, 0, sizeof (msg)); -+ msg.msg_iov = &iov; -+ msg.msg_iovlen = 1; -+ -+ msg.msg_control = &cmsg; -+ msg.msg_controllen = sizeof (cmsg); -+ memset (&cmsg, 0, sizeof (cmsg)); -+ cmsg.hdr.cmsg_len = sizeof (cmsg); -+ cmsg.hdr.cmsg_level = SOL_SOCKET; -+ cmsg.hdr.cmsg_type = SCM_CREDS; -+#endif + struct { + struct cmsghdr hdr; + struct cmsgcred cred; +@@ -445,7 +445,7 @@ + #endif retry: +-#if defined(HAVE_CMSGCRED) && !defined(LOCAL_CREDS) +#if defined(HAVE_CMSGCRED) && (!defined(LOCAL_CREDS) || defined(__FreeBSD__)) -+ written = sendmsg(fd, &msg, 0); -+#else + written = sendmsg(fd, &msg, 0); + #else written = write(fd, &data[0], 1); -+#endif - if (written < 0) { - if (errno == EINTR) - goto retry; -@@ -616,13 +642,15 @@ gamin_check_cred(GAMDataPtr conn, int fd - gid_t c_gid; - - #ifdef HAVE_CMSGCRED -- char cmsgmem[CMSG_SPACE(sizeof(struct cmsgcred))]; -- struct cmsghdr *cmsg = (struct cmsghdr *) cmsgmem; -+ struct { -+ struct cmsghdr hdr; -+ struct cmsgcred cred; -+ } cmsg; - #endif +@@ -650,7 +650,7 @@ s_uid = getuid(); @@ -71,42 +27,3 @@ /* Set the socket to receive credentials on the next message */ { int on = 1; -@@ -642,9 +670,9 @@ gamin_check_cred(GAMDataPtr conn, int fd - msg.msg_iovlen = 1; - - #ifdef HAVE_CMSGCRED -- memset(cmsgmem, 0, sizeof(cmsgmem)); -- msg.msg_control = cmsgmem; -- msg.msg_controllen = sizeof(cmsgmem); -+ memset(&cmsg, 0, sizeof(cmsg)); -+ msg.msg_control = &cmsg; -+ msg.msg_controllen = sizeof(cmsg); - #endif - - retry: -@@ -661,7 +689,7 @@ retry: - goto failed; - } - #ifdef HAVE_CMSGCRED -- if (cmsg->cmsg_len < sizeof(cmsgmem) || cmsg->cmsg_type != SCM_CREDS) { -+ if (cmsg.hdr.cmsg_len < sizeof(cmsg) || cmsg.hdr.cmsg_type != SCM_CREDS) { - GAM_DEBUG(DEBUG_INFO, - "Message from recvmsg() was not SCM_CREDS\n"); - goto failed; -@@ -687,13 +715,9 @@ retry: - goto failed; - } - #elif defined(HAVE_CMSGCRED) -- struct cmsgcred *cred; -- -- cred = (struct cmsgcred *) CMSG_DATA(cmsg); -- -- c_pid = cred->cmcred_pid; -- c_uid = cred->cmcred_euid; -- c_gid = cred->cmcred_groups[0]; -+ c_pid = cmsg.cred.cmcred_pid; -+ c_uid = cmsg.cred.cmcred_euid; -+ c_gid = cmsg.cred.cmcred_groups[0]; - #else /* !SO_PEERCRED && !HAVE_CMSGCRED */ - GAM_DEBUG(DEBUG_INFO, - "Socket credentials not supported on this OS\n"); diff --git a/devel/gamin/files/patch-libgamin_gam_data.c b/devel/gamin/files/patch-libgamin_gam_data.c new file mode 100644 index 000000000000..7a54719ff2c0 --- /dev/null +++ b/devel/gamin/files/patch-libgamin_gam_data.c @@ -0,0 +1,11 @@ +--- libgamin/gam_data.c.orig Thu May 19 20:55:27 2005 ++++ libgamin/gam_data.c Thu May 19 20:55:45 2005 +@@ -471,7 +471,7 @@ + } + if (is_threaded > 0) { + pthread_mutexattr_init(&attr); +- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); ++ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&ret->lock, &attr); + pthread_mutexattr_destroy(&attr); + } diff --git a/devel/gamin/files/patch-python_Makefile.in b/devel/gamin/files/patch-python_Makefile.in index 13580076c7f3..d27f81e98ec4 100644 --- a/devel/gamin/files/patch-python_Makefile.in +++ b/devel/gamin/files/patch-python_Makefile.in @@ -1,5 +1,5 @@ ---- python/Makefile.in.orig Thu Mar 24 19:56:18 2005 -+++ python/Makefile.in Thu Mar 24 19:58:01 2005 +--- python/Makefile.in.orig Thu May 19 20:43:35 2005 ++++ python/Makefile.in Thu May 19 20:44:30 2005 @@ -59,7 +59,7 @@ pythonLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(python_LTLIBRARIES) @@ -9,16 +9,7 @@ @WITH_PYTHON_TRUE@_gamin_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am___gamin_la_SOURCES_DIST = gamin.c @WITH_PYTHON_TRUE@am__gamin_la_OBJECTS = gamin.lo -@@ -162,7 +162,7 @@ - PKG_CONFIG = @PKG_CONFIG@ - PYTHON = @PYTHON@ - PYTHON_INCLUDES = @PYTHON_INCLUDES@ --PYTHON_PYTHON_SITE_PACKAGES = @PYTHON_PYTHON_SITE_PACKAGES@ -+PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@ - PYTHON_SUBDIR = @PYTHON_SUBDIR@ - PYTHON_VERSION = @PYTHON_VERSION@ - RANLIB = @RANLIB@ -@@ -233,9 +233,9 @@ +@@ -237,9 +237,9 @@ gamin.c \ gamin.py diff --git a/devel/gamin/files/patch-server_Makefile.in b/devel/gamin/files/patch-server_Makefile.in deleted file mode 100644 index 233298647382..000000000000 --- a/devel/gamin/files/patch-server_Makefile.in +++ /dev/null @@ -1,47 +0,0 @@ ---- server/Makefile.in.orig Thu Mar 24 23:04:39 2005 -+++ server/Makefile.in Thu Mar 24 23:07:52 2005 -@@ -43,6 +43,7 @@ - libexec_PROGRAMS = gam_server$(EXEEXT) - @ENABLE_INOTIFY_TRUE@am__append_2 = gam_inotify.c gam_inotify.h - @ENABLE_DNOTIFY_TRUE@am__append_3 = gam_dnotify.c gam_dnotify.h -+@ENABLE_KQUEUE_TRUE@am__append_4 = gam_kqueue.c gam_kqueue.h - subdir = server - DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -@@ -63,15 +64,16 @@ - gam_connection.h gam_debugging.h gam_debugging.c \ - gam_excludes.c gam_excludes.h local_inotify.h \ - gam_debug_lists.c gam_inotify.c gam_inotify.h gam_dnotify.c \ -- gam_dnotify.h -+ gam_dnotify.h gam_kqueue.c gam_kqueue.h - @ENABLE_INOTIFY_TRUE@am__objects_1 = gam_inotify.$(OBJEXT) - @ENABLE_DNOTIFY_TRUE@am__objects_2 = gam_dnotify.$(OBJEXT) -+@ENABLE_KQUEUE_TRUE@am__objects_3 = gam_kqueue.$(OBJEXT) - am_gam_server_OBJECTS = gam_subscription.$(OBJEXT) \ - gam_listener.$(OBJEXT) gam_server.$(OBJEXT) gam_node.$(OBJEXT) \ - gam_tree.$(OBJEXT) gam_poll.$(OBJEXT) gam_channel.$(OBJEXT) \ - gam_connection.$(OBJEXT) gam_debugging.$(OBJEXT) \ - gam_excludes.$(OBJEXT) gam_debug_lists.$(OBJEXT) \ -- $(am__objects_1) $(am__objects_2) -+ $(am__objects_1) $(am__objects_2) $(am__objects_3) - gam_server_OBJECTS = $(am_gam_server_OBJECTS) - am__DEPENDENCIES_1 = - DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -@@ -236,7 +238,8 @@ - gam_poll.h gam_channel.c gam_channel.h gam_connection.c \ - gam_connection.h gam_debugging.h gam_debugging.c \ - gam_excludes.c gam_excludes.h local_inotify.h \ -- gam_debug_lists.c $(am__append_2) $(am__append_3) -+ gam_debug_lists.c $(am__append_2) $(am__append_3) \ -+ $(am__append_4) - gam_server_LDFLAGS = - gam_server_DEPENDENCIES = $(DEPS) - gam_server_LDADD = $(top_builddir)/lib/libgamin_shared.a $(LDADDS) $(LIBGAMIN_LIBS) -@@ -316,6 +319,7 @@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gam_debug_lists.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gam_debugging.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gam_dnotify.Po@am__quote@ -+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gam_kqueue.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gam_excludes.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gam_inotify.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gam_listener.Po@am__quote@ diff --git a/devel/gamin/files/patch-server_gam_channel.c b/devel/gamin/files/patch-server_gam_channel.c index 2ee33f3dfb25..d50203ff7ef6 100644 --- a/devel/gamin/files/patch-server_gam_channel.c +++ b/devel/gamin/files/patch-server_gam_channel.c @@ -1,80 +1,24 @@ ---- server/gam_channel.c.orig Mon Apr 25 01:03:31 2005 -+++ server/gam_channel.c Mon Apr 25 01:26:09 2005 -@@ -6,6 +6,7 @@ - #include <sys/socket.h> - #include <sys/stat.h> - #include <sys/un.h> -+#include <sys/uio.h> - #include "gam_error.h" - #include "gam_connection.h" - #include "gam_channel.h" -@@ -24,11 +25,53 @@ - * to check the server credentials early on. - */ - static gboolean --gam_client_conn_send_cred(GIOChannel * source, int fd) -+gam_client_conn_send_cred(int fd) +--- server/gam_channel.c.orig Thu May 19 20:45:51 2005 ++++ server/gam_channel.c Thu May 19 20:47:36 2005 +@@ -29,7 +29,7 @@ { char data[2] = { 0, 0 }; -+ int written; + int written; +-#if defined(HAVE_CMSGCRED) && !defined(LOCAL_CREDS) +#if defined(HAVE_CMSGCRED) && (!defined(LOCAL_CREDS) || defined(__FreeBSD__)) -+ struct { -+ struct cmsghdr hdr; -+ struct cmsgcred cred; -+ } cmsg; -+ struct iovec iov; -+ struct msghdr msg; -+ -+ iov.iov_base = &data[0]; -+ iov.iov_len = 1; -+ -+ memset (&msg, 0, sizeof (msg)); -+ msg.msg_iov = &iov; -+ msg.msg_iovlen = 1; -+ -+ msg.msg_control = &cmsg; -+ msg.msg_controllen = sizeof (cmsg); -+ memset (&cmsg, 0, sizeof (cmsg)); -+ cmsg.hdr.cmsg_len = sizeof (cmsg); -+ cmsg.hdr.cmsg_level = SOL_SOCKET; -+ cmsg.hdr.cmsg_type = SCM_CREDS; -+#endif + struct { + struct cmsghdr hdr; + struct cmsgcred cred; +@@ -53,7 +53,7 @@ + #endif -- return(gam_client_conn_write(source, fd, &data[0], 1)); -+retry: + retry: +-#if defined(HAVE_CMSGCRED) && !defined(LOCAL_CREDS) +#if defined(HAVE_CMSGCRED) && (!defined(LOCAL_CREDS) || defined(__FreeBSD__)) -+ written = sendmsg(fd, &msg, 0); -+#else -+ written = write(fd, &data[0], 1); -+#endif -+ if (written < 0) { -+ if (errno == EINTR) -+ goto retry; -+ gam_error(DEBUG_INFO, -+ "Failed to write credential bytes to socket %d\n", fd); -+ return (-1); -+ } -+ if (written != 1) { -+ gam_error(DEBUG_INFO, "Wrote %d credential bytes to socket %d\n", -+ written, fd); -+ return (-1); -+ } -+ GAM_DEBUG(DEBUG_INFO, "Wrote credential bytes to socket %d\n", fd); -+ return (written); - } - - /** -@@ -49,13 +92,15 @@ gam_client_conn_check_cred(GIOChannel * - gid_t c_gid; - - #ifdef HAVE_CMSGCRED -- char cmsgmem[CMSG_SPACE(sizeof(struct cmsgcred))]; -- struct cmsghdr *cmsg = (struct cmsghdr *) cmsgmem; -+ struct { -+ struct cmsghdr hdr; -+ struct cmsgcred cred; -+ } cmsg; - #endif + written = sendmsg(fd, &msg, 0); + #else + written = write(fd, &data[0], 1); +@@ -100,7 +100,7 @@ s_uid = getuid(); @@ -83,59 +27,3 @@ /* Set the socket to receive credentials on the next message */ { int on = 1; -@@ -75,9 +120,9 @@ gam_client_conn_check_cred(GIOChannel * - msg.msg_iovlen = 1; - - #ifdef HAVE_CMSGCRED -- memset(cmsgmem, 0, sizeof(cmsgmem)); -- msg.msg_control = cmsgmem; -- msg.msg_controllen = sizeof(cmsgmem); -+ memset(&cmsg, 0, sizeof(cmsg)); -+ msg.msg_control = &cmsg; -+ msg.msg_controllen = sizeof(cmsg); - #endif - - retry: -@@ -94,7 +139,7 @@ gam_client_conn_check_cred(GIOChannel * - goto failed; - } - #ifdef HAVE_CMSGCRED -- if (cmsg->cmsg_len < sizeof(cmsgmem) || cmsg->cmsg_type != SCM_CREDS) { -+ if (cmsg.hdr.cmsg_len < sizeof(cmsg) || cmsg.hdr.cmsg_type != SCM_CREDS) { - GAM_DEBUG(DEBUG_INFO, - "Message from recvmsg() was not SCM_CREDS\n"); - goto failed; -@@ -120,13 +165,9 @@ gam_client_conn_check_cred(GIOChannel * - goto failed; - } - #elif defined(HAVE_CMSGCRED) -- struct cmsgcred *cred; -- -- cred = (struct cmsgcred *) CMSG_DATA(cmsg); -- -- c_pid = cred->cmcred_pid; -- c_uid = cred->cmcred_euid; -- c_gid = cred->cmcred_groups[0]; -+ c_pid = cmsg.cred.cmcred_pid; -+ c_uid = cmsg.cred.cmcred_euid; -+ c_gid = cmsg.cred.cmcred_groups[0]; - #else /* !SO_PEERCRED && !HAVE_CMSGCRED */ - GAM_DEBUG(DEBUG_INFO, - "Socket credentials not supported on this OS\n"); -@@ -149,7 +190,7 @@ gam_client_conn_check_cred(GIOChannel * - goto failed; - } - -- if (!gam_client_conn_send_cred(source, fd)) { -+ if (!gam_client_conn_send_cred(fd)) { - GAM_DEBUG(DEBUG_INFO, "Failed to send credential byte to client\n"); - goto failed; - } -@@ -305,6 +346,7 @@ gam_get_socket_path(const char *session) - gam_client_id = g_getenv("GAM_CLIENT_ID"); - if (gam_client_id == NULL) { - GAM_DEBUG(DEBUG_INFO, "Error getting GAM_CLIENT_ID\n"); -+ gam_client_id = ""; - } - } else { - gam_client_id = session; diff --git a/devel/gamin/files/patch-server_gam_kqueue.c b/devel/gamin/files/patch-server_gam_kqueue.c index 9edf541d131b..6ea99a963283 100644 --- a/devel/gamin/files/patch-server_gam_kqueue.c +++ b/devel/gamin/files/patch-server_gam_kqueue.c @@ -1,7 +1,7 @@ ---- server/gam_kqueue.c.orig Sat Apr 30 12:26:31 2005 -+++ server/gam_kqueue.c Sun May 1 08:18:47 2005 -@@ -0,0 +1,1262 @@ -+/* +--- server/gam_kqueue.c.orig Thu May 19 20:34:55 2005 ++++ server/gam_kqueue.c Thu May 19 20:35:11 2005 +@@ -1,5 +1,37 @@ + /* + * gam_kqueue.c - a kqueue(2) Gamin backend + * + * Notes: @@ -33,41 +33,54 @@ + * + * - kqueue needs to be moved out the UFS code. + * -+ * Copyright (C) 2005 Joe Marcus Clarke <marcus@FreeBSD.org> + * Copyright (C) 2005 Joe Marcus Clarke <marcus@FreeBSD.org> + * Copyright (C) 2005 Jean-Yves Lefort <jylefort@FreeBSD.org> -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free -+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -16,508 +48,1068 @@ + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +- +-#include "server_config.h" +#include "config.h" +#include <string.h> +#include <fcntl.h> +#include <unistd.h> -+#include <sys/types.h> + #include <sys/types.h> +#include <sys/sysctl.h> +#include <sys/stat.h> -+#include <sys/event.h> -+#include <sys/time.h> + #include <sys/event.h> + #include <sys/time.h> +-#include <fcntl.h> +-#include <sys/ioctl.h> +-#include <signal.h> +-#include <unistd.h> +-#include <stdio.h> +-#include <string.h> +-#include <glib.h> +#include <errno.h> -+#include "gam_error.h" -+#include "gam_kqueue.h" -+#include "gam_event.h" -+#include "gam_server.h" -+ + #include "gam_error.h" + #include "gam_kqueue.h" +-#include "gam_tree.h" + #include "gam_event.h" + #include "gam_server.h" +-#include "gam_event.h" + +-typedef struct { +- char *path; +- int fd; +- int refcount; +- gboolean isdir; +- GList *subs; +- GSList *dirlist; +-} KQueueData; +/*** tunable constants, modify to tweak the backend aggressivity *************/ -+ + +-static GHashTable *dir_path_hash = NULL; +-static GHashTable *file_path_hash = NULL; +-static GHashTable *fd_hash = NULL; +/* + * The backend will use at most n file descriptors, where n is the + * minimum value between (kern.maxfiles * CFG_GLOBAL_FILE_RESERVE_RATIO) @@ -75,7 +88,8 @@ + */ +#define CFG_GLOBAL_FILE_RESERVE_RATIO 0.7 +#define CFG_SELF_FILE_RESERVE 200 -+ + +-static GSList *exist_list = NULL; +/* + * If a SubMonitor or FileMonitor is not supported by kqueue and has + * to be polled, the backend will re-attempt to enable kqueue @@ -83,7 +97,11 @@ + */ +#define CFG_UNSUPPORTED_SMON_KQUEUE_RETRY_FREQUENCY 10 +#define CFG_UNSUPPORTED_FMON_KQUEUE_RETRY_FREQUENCY 10 -+ + +-static GList *new_subs = NULL; +-G_LOCK_DEFINE_STATIC(new_subs); +-static GList *removed_subs = NULL; +-G_LOCK_DEFINE_STATIC(removed_subs); +/* + * The various poll intervals, in milliseconds. The default interval + * for each poller is based on the poller's expected usage. @@ -97,7 +115,8 @@ +#define VN_NOTE_CHANGED (NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_LINK) +#define VN_NOTE_DELETED (NOTE_DELETE | NOTE_REVOKE) +#define VN_NOTE_ALL (VN_NOTE_CHANGED | VN_NOTE_DELETED | NOTE_RENAME) -+ + +-G_LOCK_DEFINE_STATIC(kqueue); +/* + * A barebone stat structure, only containing the fields we need. + */ @@ -123,7 +142,8 @@ + gpointer user_data); +typedef void (*HashTablePostRemoveFunc) (GHashTable *table, + gpointer user_data); -+ + +-static gboolean have_consume_idler = FALSE; +typedef struct +{ + HashTableAddFunc add; @@ -156,17 +176,21 @@ + unsigned int poll_count; +}; +#define MONITOR(ptr) ((Monitor *) ptr) -+ + +-int kq = -1; +typedef enum +{ + MONITOR_ISDIR = 1 << 0, + MONITOR_ISNOTDIR = 1 << 1 +} MonitorFlags; +#define MONITOR_FLAGS_SHIFT 2 -+ + +-static KQueueData * +-gam_kqueue_data_new(const char *path, int fd) +/* monitor for Gamin subscriptions */ +typedef struct -+{ + { +- KQueueData *data; + Monitor base; + GList *subs; + HashTable *fmons; /* FileMonitor objects */ @@ -174,12 +198,21 @@ + gboolean isdir; /* is a directory subscription? */ +} SubMonitor; +#define SUB_MONITOR(ptr) ((SubMonitor *) ptr) -+ + +- data = g_new0(KQueueData, 1); +- data->path = g_strdup(path); +- data->fd = fd; +- data->refcount = 1; +- data->isdir = FALSE; +- data->subs = NULL; +- data->dirlist = NULL; +typedef enum +{ + SUB_MONITOR_WAS_MISSING = 1 << MONITOR_FLAGS_SHIFT +} SubMonitorFlags; -+ + +- return data; +-} +/* monitor for files within directory subscriptions */ +typedef struct +{ @@ -188,12 +221,19 @@ + char *filename; /* pointer into base.pathname */ +} FileMonitor; +#define FILE_MONITOR(ptr) ((FileMonitor *) ptr) -+ + +-static GSList * +-gam_kqueue_lsdir(const char *path) +typedef enum -+{ + { +- GDir *dir; +- GSList *lst = NULL; +- const gchar *entry; + FILE_MONITOR_POSSIBLY_RECREATED = 1 << MONITOR_FLAGS_SHIFT +} FileMonitorFlags; -+ + +- if (!path) +- return NULL; +typedef void (*PollerFunc) (SubMonitor *smon); +typedef struct +{ @@ -275,9 +315,13 @@ + GaminEventType event, + FileMonitorFlags flags); +static void gam_kqueue_file_monitor_handle_kevent (Monitor *mon, struct kevent *event); -+ + +- dir = g_dir_open(path, 0, NULL); +- if (!dir) +- return NULL; +/*** helpers *****************************************************************/ -+ + +- entry = g_dir_read_name(dir); +static void +gam_kqueue_mini_lstat (const char *pathname, MiniStat *mini_sb) +{ @@ -309,7 +353,10 @@ + || sb1->gid != sb2->gid + || sb1->ino != sb2->ino; +} -+ + +- while (entry) { +- lst = g_slist_prepend(lst, g_strdup(entry)); +- entry = g_dir_read_name(dir); +static gboolean +gam_kqueue_isdir (const char *pathname, MonitorFlags flags) +{ @@ -321,14 +368,16 @@ + { + struct stat sb; + return lstat(pathname, &sb) >= 0 && (sb.st_mode & S_IFDIR) != 0; -+ } + } +} -+ + +- g_dir_close(dir); +static gboolean +gam_kqueue_get_uint_sysctl (const char *name, unsigned int *value) +{ + unsigned int value_len = sizeof(*value); -+ + +- return lst; + if (sysctlbyname(name, value, &value_len, NULL, 0) < 0) + { + gam_error(DEBUG_INFO, "unable to retrieve %s: %s\n", name, g_strerror(errno)); @@ -353,16 +402,21 @@ + table->user_data = user_data; + + return table; -+} -+ -+static void + } + + static void +-gam_kqueue_cmplst(GSList *lst1, GSList *lst2, GSList **added, GSList **deleted) +gam_kqueue_hash_table_default_add_cb (GHashTable *table, + gpointer item, + gpointer user_data) -+{ + { +- int found; +- GSList *l; + g_hash_table_insert(table, item, GINT_TO_POINTER(TRUE)); +} -+ + +- if (!lst1 && !lst2) +- return; +static void +gam_kqueue_hash_table_default_remove_cb (GHashTable *table, + gpointer item, @@ -370,7 +424,10 @@ +{ + g_hash_table_remove(table, item); +} -+ + +- if (!lst1) { +- *added = g_slist_copy(lst2); +- return; +static void +gam_kqueue_hash_table_add (HashTable *table, gpointer item) +{ @@ -381,9 +438,12 @@ + table->methods->add(table->main, item, table->user_data); + if (table->methods->post_add) + table->methods->post_add(table->main, table->user_data); -+ } + } +} -+ + +- if (!lst2) { +- *deleted = g_slist_copy(lst1); +- return; +static void +gam_kqueue_hash_table_remove (HashTable *table, gpointer item) +{ @@ -394,7 +454,7 @@ + table->methods->remove(table->main, item, table->user_data); + if (table->methods->post_remove) + table->methods->post_remove(table->main, table->user_data); -+ } + } +} + +static void @@ -411,7 +471,15 @@ + if (table->pending_additions) + { + GSList *l; -+ + +- for (l = lst1; l; l = l->next) { +- found = 0; +- if (g_slist_find_custom(lst2, l->data, (GCompareFunc)strcmp)) { +- found = 1; +- } +- if (found == 0) { +- *deleted = g_slist_prepend(*deleted, l->data); +- } + for (l = table->pending_additions; l != NULL; l = l->next) + table->methods->add(table->main, l->data, table->user_data); + @@ -420,8 +488,16 @@ + + if (table->methods->post_add) + table->methods->post_add(table->main, table->user_data); -+ } -+ + } + +- for (l = lst2; l; l = l->next) { +- found = 0; +- if (g_slist_find_custom(lst1, l->data, (GCompareFunc)strcmp)) { +- found = 1; +- } +- if (found == 0) { +- *added = g_slist_prepend(*added, l->data); +- } + if (table->pending_removals) + { + GSList *l; @@ -434,12 +510,20 @@ + + if (table->methods->post_remove) + table->methods->post_remove(table->main, table->user_data); -+ } -+} -+ -+static void + } + } + + static void +-gam_kqueue_data_free(KQueueData * data) +gam_kqueue_hash_table_destroy (HashTable *table) -+{ + { +- g_free(data->path); +- if (data->dirlist) { +- g_slist_foreach(data->dirlist, (GFunc)g_free, NULL); +- g_slist_free(data->dirlist); +- } +- if (data->subs) { +- g_list_free(data->subs); + g_assert(table->iterating == FALSE); + + g_hash_table_destroy(table->main); @@ -489,10 +573,12 @@ + { + g_source_remove(poller->timeout_id); + poller->timeout_id = 0; -+ } -+} -+ -+static void + } +- g_free(data); + } + + static void +-gam_kqueue_add_rm_handler(const char *path, GamSubscription *sub, gboolean added, gboolean was_missing) +gam_kqueue_poller_add_sub_monitor (Poller *poller, SubMonitor *smon) +{ + gam_kqueue_hash_table_add(poller->smons, smon); @@ -500,12 +586,20 @@ + +static void +gam_kqueue_poller_remove_sub_monitor (Poller *poller, SubMonitor *smon) -+{ + { +- KQueueData *data; +- struct kevent ev[1]; +- int isdir = 0; +- int fd; + gam_kqueue_hash_table_remove(poller->smons, smon); +} -+ + +- G_LOCK(kqueue); +/*** Monitor *****************************************************************/ -+ + +- isdir = g_file_test(path, G_FILE_TEST_IS_DIR); +- if (gam_subscription_is_dir(sub)) { +- data = g_hash_table_lookup(dir_path_hash, path); +static gboolean +gam_kqueue_monitor_enable_kqueue (Monitor *mon) +{ @@ -515,30 +609,60 @@ + { + GAM_DEBUG(DEBUG_INFO, "cannot open %s (max_open_files limit reached), falling back to poll\n", mon->pathname); + return FALSE; -+ } + } +- else { +- data = g_hash_table_lookup(file_path_hash, path); + + mon->fd = open(mon->pathname, O_RDONLY | O_NOFOLLOW); + if (mon->fd < 0) + { + GAM_DEBUG(DEBUG_INFO, "cannot open %s (%s), falling back to poll\n", mon->pathname, g_strerror(errno)); + return FALSE; -+ } -+ + } + +- if (added) { +- GList *subs; + EV_SET(ev, mon->fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR, VN_NOTE_ALL, 0, mon); + if (kevent(kq, ev, G_N_ELEMENTS(ev), NULL, 0, NULL) < 0) + { + GAM_DEBUG(DEBUG_INFO, "cannot enable kqueue notification for %s (%s), falling back to poll\n", mon->pathname, g_strerror(errno)); -+ + +- subs = NULL; +- subs = g_list_append(subs, sub); + close(mon->fd); + mon->fd = -1; -+ + +- if (data != NULL) { +- data->refcount++; +- data->subs = g_list_prepend(data->subs, sub); +- G_UNLOCK(kqueue); +- GAM_DEBUG(DEBUG_INFO, "kqueue updated refcount\n"); +- if (!was_missing) { +- gam_server_emit_event (path, isdir, GAMIN_EVENT_EXISTS, subs, 1); +- gam_server_emit_event (path, isdir, GAMIN_EVENT_ENDEXISTS, subs, 1); +- } +- else { +- gam_server_emit_event (path, isdir, GAMIN_EVENT_CREATED, subs, 1); +- } +- return; +- } + return FALSE; + } -+ + +- if (!g_file_test(path, G_FILE_TEST_EXISTS)) { +- data = gam_kqueue_data_new(path, -1); +- data->subs = g_list_prepend(data->subs, sub); +- exist_list = g_slist_append(exist_list, data); +- gam_server_emit_event (path, isdir, GAMIN_EVENT_DELETED, subs, 1); +- gam_server_emit_event (path, isdir, GAMIN_EVENT_ENDEXISTS, subs, 1); +- G_UNLOCK(kqueue); +- return; +- } + open_files++; + return TRUE; +} -+ + +- fd = open(path, O_RDONLY); +static void +gam_kqueue_monitor_set_unsupported (Monitor *mon) +{ @@ -546,13 +670,22 @@ + { + close(mon->fd); + mon->fd = -1; -+ + +- if (fd < 0) { +- G_UNLOCK(kqueue); +- return; +- } + open_files--; + } -+ + +- EV_SET(ev, fd, EVFILT_VNODE, +- EV_ADD | EV_ENABLE | EV_CLEAR, VN_NOTE_ALL, 0, 0); +- kevent(kq, ev, 1, NULL, 0, NULL); + gam_kqueue_mini_lstat(mon->pathname, &mon->sb); +} -+ + +- data = gam_kqueue_data_new(path, fd); +- data->subs = g_list_prepend(data->subs, sub); +static void +gam_kqueue_monitor_free (Monitor *mon) +{ @@ -564,9 +697,19 @@ + } + g_free(mon); +} -+ + +- if (!was_missing) { +- gam_server_emit_event (path, isdir, GAMIN_EVENT_EXISTS, subs, 1); +- } +- else { +- gam_server_emit_event (path, isdir, GAMIN_EVENT_CREATED, subs, 1); +- } +- if (gam_subscription_is_dir(sub) && isdir) { +- GSList *l; +/*** SubMonitor **************************************************************/ -+ + +- data->isdir = TRUE; +- data->dirlist = gam_kqueue_lsdir(path); +static void +gam_kqueue_sub_monitor_init_fmons (SubMonitor *smon) +{ @@ -577,36 +720,70 @@ + &sub_monitor_unsupported_fmons_hash_table_methods, + smon); +} -+ + +- for (l = data->dirlist; l; l = l->next) { +- char *tmpentry; +static SubMonitor * +gam_kqueue_sub_monitor_new (GamSubscription *sub) +{ + SubMonitor *smon; + Monitor *mon; -+ + +- tmpentry = g_build_filename(path, l->data, NULL); +- if (!was_missing) { +- gam_server_emit_event (tmpentry, +- g_file_test(tmpentry, G_FILE_TEST_IS_DIR), +- GAMIN_EVENT_EXISTS, subs, 1); +- } +- g_free(tmpentry); +- } +- } + smon = g_new0(SubMonitor, 1); -+ + +- if (!was_missing) { +- gam_server_emit_event (path, isdir, GAMIN_EVENT_ENDEXISTS, subs, 1); +- } + mon = MONITOR(smon); + mon->handle_kevent = gam_kqueue_sub_monitor_handle_kevent; + mon->pathname = g_strdup(gam_subscription_get_path(sub)); + mon->fd = -1; -+ + +- g_hash_table_insert(fd_hash, GINT_TO_POINTER(data->fd), data); +- if (data->isdir) { +- g_hash_table_insert(dir_path_hash, data->path, data); +- } +- else { +- g_hash_table_insert(file_path_hash, data->path, data); +- } + smon->isdir = gam_subscription_is_dir(sub); + gam_kqueue_sub_monitor_init_fmons(smon); -+ + +- if (subs) +- g_list_free(subs); + return smon; +} -+ + +- GAM_DEBUG(DEBUG_INFO, "added kqueue watch for %s\n", path); +- } else { +static void +gam_kqueue_sub_monitor_clear_fmons (SubMonitor *smon) +{ + if (g_hash_table_size(smon->unsupported_fmons->main) > 0) + gam_kqueue_poller_remove_sub_monitor(&unsupported_fmon_poller, smon); -+ + +- if (!data) { +- G_UNLOCK(kqueue); +- return; +- } + gam_kqueue_hash_table_destroy(smon->unsupported_fmons); + gam_kqueue_hash_table_destroy(smon->fmons); +} -+ + +- if (g_list_find (data->subs, sub)) { +- data->subs = g_list_remove_all (data->subs, sub); +- } +- data->refcount--; +- GAM_DEBUG(DEBUG_INFO, "kqueue decremeneted refcount for %s\n", path); +static void +gam_kqueue_sub_monitor_free (SubMonitor *smon) +{ @@ -617,7 +794,9 @@ + gam_kqueue_sub_monitor_clear_fmons(smon); + gam_kqueue_monitor_free(MONITOR(smon)); +} -+ + +- if (data->refcount == 0) { +- GList *l; +static void +gam_kqueue_sub_monitor_add_fmon_cb (GHashTable *table, + FileMonitor *fmon, @@ -625,7 +804,25 @@ +{ + g_hash_table_replace(table, fmon->filename, fmon); +} -+ + +- close(data->fd); +- l = data->subs; +- for (l = l; l; l = l->next) { +- GamSubscription *sub = l->data; +- gam_kqueue_remove_subscription (sub); +- } +- GAM_DEBUG(DEBUG_INFO, "removed kqueue watch for %s\n", data->path); +- if (data->isdir) { +- g_hash_table_remove(dir_path_hash, data->path); +- } +- else { +- g_hash_table_remove(file_path_hash, data->path); +- } +- g_hash_table_remove(fd_hash, GINT_TO_POINTER(data->fd)); +- gam_kqueue_data_free(data); +- } +- } +- G_UNLOCK(kqueue); +static void +gam_kqueue_sub_monitor_remove_fmon_cb (GHashTable *table, + FileMonitor *fmon, @@ -639,29 +836,50 @@ + SubMonitor *smon) +{ + gam_kqueue_poller_add_sub_monitor(&unsupported_fmon_poller, smon); -+} -+ + } + +-static GaminEventType kqueue_event_to_gamin_event (int mask) +static void +gam_kqueue_sub_monitor_post_remove_unsupported_fmon_cb (GHashTable *table, + SubMonitor *smon) -+{ + { +- if ((mask & VN_NOTE_CHANGED) != 0) +- return GAMIN_EVENT_CHANGED; +- else if ((mask & NOTE_DELETE) != 0) +- return GAMIN_EVENT_DELETED; +- else if ((mask & NOTE_REVOKE) != 0) +- return GAMIN_EVENT_ENDEXISTS; +- else if ((mask & NOTE_RENAME) != 0) +- return GAMIN_EVENT_MOVED; +- else +- return GAMIN_EVENT_UNKNOWN; + if (g_hash_table_size(table) == 0) + gam_kqueue_poller_remove_sub_monitor(&unsupported_fmon_poller, smon); -+} -+ + } + +-static void gam_kqueue_emit_event (KQueueData *data, struct kevent *event) +static void +gam_kqueue_sub_monitor_set_missing (SubMonitor *smon) -+{ + { +- GaminEventType gevent; +- int isdir = 0; +- char *event_path; + Monitor *mon = MONITOR(smon); -+ + +- if (!data||!event) +- return; + if (mon->fd >= 0) + { + close(mon->fd); + mon->fd = -1; -+ + +- gevent = kqueue_event_to_gamin_event (event->fflags); + open_files--; + } -+ + +- if (gevent == GAMIN_EVENT_UNKNOWN) { +- return; +- } + /* + * A removed directory will normally not contain files, but we must + * not assume it (we might receive events out of order, etc). We @@ -672,20 +890,59 @@ + gam_kqueue_sub_monitor_clear_fmons(smon); + gam_kqueue_sub_monitor_init_fmons(smon); + } -+ + +- isdir = g_file_test(data->path, G_FILE_TEST_IS_DIR); + gam_kqueue_poller_remove_sub_monitor(&unsupported_smon_poller, smon); + gam_kqueue_poller_add_sub_monitor(&missing_smon_poller, smon); +} -+ + +- if (gevent == GAMIN_EVENT_CHANGED && data->isdir) { +- GSList *dirlist = NULL, *added = NULL, *deleted = NULL; +- GSList *l; +- +- dirlist = gam_kqueue_lsdir(data->path); +- gam_kqueue_cmplst(data->dirlist, dirlist, &added, &deleted); +- if (added || deleted) { +- for (l = deleted; l; l = l->next) { +- data->dirlist = g_slist_remove(data->dirlist, l->data); +- event_path = g_build_filename(data->path, l->data, NULL); +- g_free(l->data); +- isdir = g_file_test(event_path, G_FILE_TEST_IS_DIR); +- +- GAM_DEBUG(DEBUG_INFO, "kqueue emitting event %s for %s\n", gam_event_to_string(GAMIN_EVENT_DELETED) , event_path); +- +- gam_server_emit_event (event_path, isdir, +- GAMIN_EVENT_DELETED, data->subs, 1); +- g_free(event_path); +- } +static void +gam_kqueue_sub_monitor_set_unsupported (SubMonitor *smon) +{ + Monitor *mon = MONITOR(smon); -+ + +- for (l = added; l; l = l->next) { +- dirlist = g_slist_remove(dirlist, l->data); +- data->dirlist = g_slist_prepend(data->dirlist, +- g_strdup(l->data)); +- event_path = g_build_filename(data->path, l->data, NULL); +- g_free(l->data); +- isdir = g_file_test(event_path, G_FILE_TEST_IS_DIR); +- +- GAM_DEBUG(DEBUG_INFO, "kqueue emitting event %s for %s\n", gam_event_to_string(GAMIN_EVENT_CREATED) , event_path); +- +- gam_server_emit_event (event_path, isdir, +- GAMIN_EVENT_CREATED, data->subs, 1); +- g_free(event_path); +- } + gam_kqueue_monitor_set_unsupported(mon); + gam_kqueue_poller_add_sub_monitor(&unsupported_smon_poller, smon); +} -+ + +- if (added) +- g_slist_free(added); +- if (deleted) +- g_slist_free(deleted); +- } +static void +gam_kqueue_sub_monitor_enable_notification (SubMonitor *smon, + SubMonitorFlags flags) @@ -704,7 +961,10 @@ + exists = lstat(mon->pathname, &sb) >= 0; + flags |= (exists && (sb.st_mode & S_IFDIR) != 0) ? MONITOR_ISDIR : MONITOR_ISNOTDIR; + } -+ + +- if (dirlist) { +- g_slist_foreach(dirlist, (GFunc)g_free, NULL); +- g_slist_free(dirlist); + if (exists) + { + GaminEventType gevent; @@ -737,9 +997,14 @@ + { + GAM_DEBUG(DEBUG_INFO, "unable to open directory %s: %s\n", mon->pathname, err->message); + g_error_free(err); -+ } -+ } -+ + } +- return; +- } +- else { +- event_path = g_strdup (data->path); + } + +- isdir = g_file_test(event_path, G_FILE_TEST_IS_DIR); + if ((flags & SUB_MONITOR_WAS_MISSING) == 0) + gam_kqueue_sub_monitor_emit_event(smon, GAMIN_EVENT_ENDEXISTS, flags); + } @@ -747,16 +1012,19 @@ + { + gam_kqueue_sub_monitor_emit_event(smon, GAMIN_EVENT_DELETED, flags); + gam_kqueue_sub_monitor_emit_event(smon, GAMIN_EVENT_ENDEXISTS, flags); -+ + +- GAM_DEBUG(DEBUG_INFO, "kqueue emitting event %s for %s\n", gam_event_to_string(gevent) , event_path); + return; + } + + /* then we enable kqueue notification, falling back to poll if necessary */ -+ + +- gam_server_emit_event (event_path, isdir, gevent, data->subs, 1); + if (! gam_kqueue_monitor_enable_kqueue(mon)) + gam_kqueue_sub_monitor_set_unsupported(smon); +} -+ + +- g_free (event_path); +static void +gam_kqueue_sub_monitor_handle_directory_change_removal_cb (const char *filename, + FileMonitor *fmon, @@ -764,17 +1032,24 @@ +{ + if (! g_hash_table_lookup(filenames, filename)) + gam_kqueue_file_monitor_emit_event(fmon, GAMIN_EVENT_DELETED, MONITOR_ISNOTDIR); -+} -+ + } + +-static gboolean +-gam_kqueue_exist_check (gpointer user_data) +static void +gam_kqueue_sub_monitor_handle_directory_change (SubMonitor *smon, + gboolean isdir) -+{ + { +- GSList *l, *tmplst; +- KQueueData *data; + Monitor *mon = MONITOR(smon); + GHashTable *filenames; -+ + +- tmplst = g_slist_copy(exist_list); + filenames = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); -+ + +- for (l = tmplst; l; l = l->next) { +- data = l->data; + if (isdir) /* do not follow symbolic links */ + { + GDir *dir; @@ -808,7 +1083,10 @@ + g_error_free(err); + } + } -+ + +- if (g_file_test(data->path, G_FILE_TEST_EXISTS)) { +- /* The subs list is guaranteed to have only one entry. */ +- GamSubscription *sub = data->subs->data; + /* + * Handle deleted files (they are also handled at the FileMonitor + * level, but we must use whichever event comes first). @@ -816,7 +1094,10 @@ + gam_kqueue_hash_table_foreach(smon->fmons, (GHFunc) gam_kqueue_sub_monitor_handle_directory_change_removal_cb, filenames); + g_hash_table_destroy(filenames); +} -+ + +- exist_list = g_slist_remove(exist_list, data); +- gam_kqueue_add_rm_handler(data->path, sub, TRUE, TRUE); +- gam_kqueue_data_free(data); +static void +gam_kqueue_sub_monitor_emit_event (SubMonitor *smon, + GaminEventType event, @@ -834,18 +1115,21 @@ + { + gam_kqueue_sub_monitor_handle_directory_change(smon, isdir); + return; -+ } + } + break; + + case GAMIN_EVENT_DELETED: + case GAMIN_EVENT_MOVED: + gam_kqueue_sub_monitor_set_missing(smon); + break; -+ } -+ + } + +- if (tmplst) +- g_slist_free(tmplst); + gam_server_emit_event(mon->pathname, isdir, event, smon->subs, 1); +} -+ + +- return TRUE; +static void +gam_kqueue_sub_monitor_handle_kevent (Monitor *mon, struct kevent *event) +{ @@ -871,15 +1155,39 @@ + gam_kqueue_sub_monitor_emit_event(smon, GAMIN_EVENT_DELETED, MONITOR_ISNOTDIR); + else if ((event->fflags & NOTE_RENAME) != 0) + gam_kqueue_sub_monitor_emit_event(smon, GAMIN_EVENT_MOVED, MONITOR_ISNOTDIR); -+} -+ + } + +-static gboolean +-gam_kqueue_event_handler (gpointer user_data) +/*** FileMonitor *************************************************************/ + +static void +gam_kqueue_file_monitor_set_unsupported (FileMonitor *fmon) -+{ + { +- KQueueData *data; +- struct kevent ev[1]; +- struct timespec timeout = { 0, 0 }; +- int fd, i, nevents; +- +- G_LOCK(kqueue); +- +- GAM_DEBUG(DEBUG_INFO, "gam_kqueue_event_handler()\n"); +- +- nevents = kevent(kq, NULL, 0, ev, 1, &timeout); +- if (nevents == -1) +- return FALSE; +- for (i = 0; i < nevents; i++) { +- fd = ev[i].ident; +- +- data = g_hash_table_lookup (fd_hash, GINT_TO_POINTER(fd)); +- if (!data) { +- GAM_DEBUG(DEBUG_INFO, "kqueue can't find fd %d\n", fd); +- GAM_DEBUG(DEBUG_INFO, "weird things have happened to kqueue.\n"); +- } else { +- gam_kqueue_emit_event (data, &ev[i]); +- } + Monitor *mon = MONITOR(fmon); -+ + + gam_kqueue_monitor_set_unsupported(mon); + gam_kqueue_hash_table_add(fmon->smon->unsupported_fmons, fmon); +} @@ -911,22 +1219,27 @@ + { + gam_kqueue_file_monitor_set_unsupported(fmon); + *flags = (mon->sb.mode & S_IFDIR) != 0 ? MONITOR_ISDIR : MONITOR_ISNOTDIR; -+ } -+ + } + +- G_UNLOCK(kqueue); + return fmon; +} -+ + +- return TRUE; +static void +gam_kqueue_file_monitor_free (FileMonitor *fmon) +{ + gam_kqueue_monitor_free(MONITOR(fmon)); -+} -+ + } + +-static gboolean +-gam_kqueue_consume_subscriptions_real(gpointer data) +static void +gam_kqueue_file_monitor_emit_event (FileMonitor *fmon, + GaminEventType event, + FileMonitorFlags flags) -+{ + { +- GList *subs, *l; + Monitor *mon = MONITOR(fmon); + struct stat sb; + gboolean isdir; @@ -946,7 +1259,18 @@ + } + + gam_server_emit_event(mon->pathname, isdir, event, fmon->smon->subs, 1); -+ + +- G_LOCK(new_subs); +- if (new_subs) { +- subs = new_subs; +- new_subs = NULL; +- G_UNLOCK(new_subs); +- +- for (l = subs; l; l = l->next) { +- GamSubscription *sub = l->data; +- GAM_DEBUG(DEBUG_INFO, "called gam_kqueue_add_handler()\n"); +- gam_kqueue_add_rm_handler (gam_subscription_get_path (sub), sub, TRUE, FALSE); +- } + switch (event) + { + case GAMIN_EVENT_DELETED: @@ -972,13 +1296,29 @@ + * gam_kqueue_sub_monitor_handle_directory_change() did + * not detect the removal+creation. + */ -+ + +- } else { +- G_UNLOCK(new_subs); +- } + new_fmon = gam_kqueue_file_monitor_new(fmon->smon, fmon->filename, &new_fmon_flags); + gam_kqueue_file_monitor_emit_event(new_fmon, GAMIN_EVENT_CREATED, new_fmon_flags); -+ + +- G_LOCK(removed_subs); +- if (removed_subs) { +- subs = removed_subs; +- removed_subs = NULL; +- G_UNLOCK(removed_subs); +- +- for (l = subs; l; l = l->next) { +- GamSubscription *sub = l->data; +- GAM_DEBUG(DEBUG_INFO, "called gam_kqueue_rm_handler()\n"); +- gam_kqueue_add_rm_handler (gam_subscription_get_path (sub), sub, FALSE, FALSE); +- } +- } else { +- G_UNLOCK(removed_subs); + break; /* do not remove the fmon we've just created */ + } -+ } + } + + gam_kqueue_hash_table_remove(fmon->smon->fmons, fmon); + break; @@ -1012,7 +1352,8 @@ + else if ((event->fflags & NOTE_RENAME) != 0) + gam_kqueue_file_monitor_emit_event(fmon, GAMIN_EVENT_MOVED, MONITOR_ISNOTDIR | FILE_MONITOR_POSSIBLY_RECREATED); +} -+ + +- GAM_DEBUG(DEBUG_INFO, "gam_kqueue_consume_subscriptions()\n"); +/*** kevent/poll callbacks ***************************************************/ + +static gboolean @@ -1042,17 +1383,21 @@ +gam_kqueue_missing_smon_poll (SubMonitor *smon) +{ + struct stat sb; -+ + +- have_consume_idler = FALSE; +- return FALSE; + if (lstat(MONITOR(smon)->pathname, &sb) >= 0) + { + gam_kqueue_poller_remove_sub_monitor(&missing_smon_poller, smon); + gam_kqueue_sub_monitor_enable_notification(smon, SUB_MONITOR_WAS_MISSING | ((sb.st_mode & S_IFDIR) != 0 ? MONITOR_ISDIR : MONITOR_ISNOTDIR)); + } -+} -+ -+static void + } + + static void +-gam_kqueue_consume_subscriptions(void) +gam_kqueue_unsupported_smon_poll (SubMonitor *smon) -+{ + { +- GSource *source; + Monitor *mon = MONITOR(smon); + MiniStat sb; + GaminEventType event; @@ -1076,7 +1421,9 @@ + memcpy(&mon->sb, &sb, sizeof(sb)); + gam_kqueue_sub_monitor_emit_event(smon, event, (sb.mode & S_IFDIR) != 0 ? MONITOR_ISDIR : MONITOR_ISNOTDIR); +} -+ + +- if (have_consume_idler) +- return; +static void +gam_kqueue_unsupported_fmon_poll_foreach_cb (FileMonitor *fmon, + gpointer unused, @@ -1092,37 +1439,56 @@ + if (gam_kqueue_monitor_enable_kqueue(mon)) + gam_kqueue_hash_table_remove(fmon->smon->unsupported_fmons, fmon); + } -+ + +- have_consume_idler = TRUE; + gam_kqueue_mini_lstat(mon->pathname, &sb); -+ + +- source = g_idle_source_new (); +- g_source_set_callback (source, gam_kqueue_consume_subscriptions_real, NULL, NULL); + if (! sb.exists && mon->sb.exists) + event = GAMIN_EVENT_DELETED; + else if (gam_kqueue_differs(&sb, &mon->sb)) + event = GAMIN_EVENT_CHANGED; + else + return; -+ + +- g_source_attach (source, NULL); + memcpy(&mon->sb, &sb, sizeof(sb)); + gam_kqueue_file_monitor_emit_event(fmon, event, (sb.mode & S_IFDIR) != 0 ? MONITOR_ISDIR : MONITOR_ISNOTDIR); -+} -+ + } + +-/** +- * @defgroup kqueue kqueue backend +- * @ingroup Backends +- * @brief kqueue backend API +- * +- * Since 4.1, FreeBSD kernels have included the kernel event notification +- * machanism (kqueue). This backend uses kqueue to know when +- * files are changed/created/deleted. +- * +- * @{ +- */ +static void +gam_kqueue_unsupported_fmon_poll (SubMonitor *smon) +{ + gam_kqueue_hash_table_foreach(smon->unsupported_fmons, (GHFunc) gam_kqueue_unsupported_fmon_poll_foreach_cb, NULL); +} -+ + +/*** Gamin backend implementation ********************************************/ -+ -+/** -+ * Initializes the kqueue system. This must be called before -+ * any other functions in this module. -+ * -+ * @returns TRUE if initialization succeeded, FALSE otherwise -+ */ -+gboolean + + /** + * Initializes the kqueue system. This must be called before +@@ -526,28 +1118,58 @@ + * @returns TRUE if initialization succeeded, FALSE otherwise + */ + gboolean +-gam_kqueue_init(void) +gam_kqueue_init (void) -+{ + { +- kq = kqueue(); +- if (kq == -1) { +- GAM_DEBUG(DEBUG_INFO, "Could not initialize a new kqueue\n"); +- return FALSE; + GIOChannel *channel; + unsigned int maxfiles; + unsigned int maxfilesperproc; @@ -1132,8 +1498,10 @@ + { + gam_error(DEBUG_INFO, "kqueue initialization failure: %s\n", g_strerror(errno)); + return FALSE; -+ } -+ + } + +- g_timeout_add(1000, gam_kqueue_exist_check, NULL); +- g_timeout_add(1000, gam_kqueue_event_handler, NULL); + if (! gam_kqueue_get_uint_sysctl("kern.maxfiles", &maxfiles)) + return FALSE; + if (! gam_kqueue_get_uint_sysctl("kern.maxfilesperproc", &maxfilesperproc)) @@ -1171,19 +1539,34 @@ + gam_backend_add_subscription = gam_kqueue_add_subscription; + gam_backend_remove_subscription = gam_kqueue_remove_subscription; + gam_backend_remove_all_for = gam_kqueue_remove_all_for; -+ + +- dir_path_hash = g_hash_table_new(g_str_hash, g_str_equal); +- file_path_hash = g_hash_table_new(g_str_hash, g_str_equal); +- fd_hash = g_hash_table_new(g_direct_hash, g_direct_equal); +- +- GAM_DEBUG(DEBUG_INFO, "kqueue initialized\n"); +- +- gam_backend_add_subscription = gam_kqueue_add_subscription; +- gam_backend_remove_subscription = gam_kqueue_remove_subscription; +- gam_backend_remove_all_for = gam_kqueue_remove_all_for; +- +- return TRUE; + return TRUE; -+} -+ -+/** -+ * Adds a subscription to be monitored. -+ * -+ * @param sub a #GamSubscription to be polled -+ * @returns TRUE if adding the subscription succeeded, FALSE otherwise -+ */ -+gboolean + } + + /** +@@ -557,18 +1179,31 @@ + * @returns TRUE if adding the subscription succeeded, FALSE otherwise + */ + gboolean +-gam_kqueue_add_subscription(GamSubscription * sub) +gam_kqueue_add_subscription (GamSubscription *sub) -+{ + { +- gam_listener_add_subscription(gam_subscription_get_listener(sub), sub); +- +- G_LOCK(new_subs); +- new_subs = g_list_prepend(new_subs, sub); +- G_UNLOCK(new_subs); + const char *path; + GHashTable *hash; + SubMonitor *smon; @@ -1202,53 +1585,90 @@ + + smon = gam_kqueue_sub_monitor_new(sub); + smon->subs = g_list_append(smon->subs, sub); -+ + +- GAM_DEBUG(DEBUG_INFO, "kqueue_add_sub\n"); + g_hash_table_insert(hash, MONITOR(smon)->pathname, smon); + gam_kqueue_sub_monitor_enable_notification(smon, 0); -+ + +- gam_kqueue_consume_subscriptions(); +- return TRUE; + return TRUE; -+} -+ -+/** -+ * Removes a subscription which was being monitored. -+ * -+ * @param sub a #GamSubscription to remove -+ * @returns TRUE if removing the subscription succeeded, FALSE otherwise -+ */ -+gboolean + } + + /** +@@ -578,28 +1213,28 @@ + * @returns TRUE if removing the subscription succeeded, FALSE otherwise + */ + gboolean +-gam_kqueue_remove_subscription(GamSubscription * sub) +gam_kqueue_remove_subscription (GamSubscription *sub) -+{ + { +- G_LOCK(new_subs); +- if (g_list_find(new_subs, sub)) { +- GAM_DEBUG(DEBUG_INFO, "removed sub found on new_subs\n"); +- new_subs = g_list_remove_all (new_subs, sub); +- G_UNLOCK(new_subs); +- return TRUE; +- } +- G_UNLOCK(new_subs); + GHashTable *hash; + SubMonitor *smon; -+ + +- gam_subscription_cancel (sub); +- gam_listener_remove_subscription(gam_subscription_get_listener(sub), sub); + hash = gam_subscription_is_dir(sub) ? dir_hash : file_hash; + smon = g_hash_table_lookup(hash, gam_subscription_get_path(sub)); -+ + +- G_LOCK(removed_subs); +- removed_subs = g_list_prepend (removed_subs, sub); +- G_UNLOCK(removed_subs); + if (! smon) + return FALSE; -+ + +- GAM_DEBUG(DEBUG_INFO, "kqueue_remove_sub\n"); +- gam_kqueue_consume_subscriptions(); + smon->subs = g_list_remove_all(smon->subs, sub); + if (! smon->subs) + { + g_hash_table_remove(hash, MONITOR(smon)->pathname); + gam_kqueue_sub_monitor_free(smon); + } -+ + +- return TRUE; + gam_subscription_cancel(sub); + gam_listener_remove_subscription(gam_subscription_get_listener(sub), sub); + + return TRUE; -+} -+ -+/** -+ * Stop monitoring all subscriptions for a given listener. -+ * -+ * @param listener a #GamListener -+ * @returns TRUE if removing the subscriptions succeeded, FALSE otherwise -+ */ -+gboolean + } + + /** +@@ -609,28 +1244,19 @@ + * @returns TRUE if removing the subscriptions succeeded, FALSE otherwise + */ + gboolean +-gam_kqueue_remove_all_for(GamListener * listener) +gam_kqueue_remove_all_for (GamListener *listener) -+{ + { +- GList *subs, *l = NULL; +- +- subs = gam_listener_get_subscriptions (listener); +- +- for (l = subs; l; l = l->next) { +- GamSubscription *sub = l->data; +- +- g_assert (sub != NULL); +- +- gam_kqueue_remove_subscription (sub); +- +- } +- +- if (subs) { +- g_list_free (subs); +- gam_kqueue_consume_subscriptions(); +- return TRUE; +- } else { +- return FALSE; +- } + GList *subs; + GList *l; + gboolean success = TRUE; @@ -1262,4 +1682,6 @@ + g_list_free(subs); + + return success; -+} + } +- +-/** @} */ diff --git a/devel/gamin/files/patch-server_gam_kqueue.h b/devel/gamin/files/patch-server_gam_kqueue.h index 497e3cd58c2f..4a7d883da856 100644 --- a/devel/gamin/files/patch-server_gam_kqueue.h +++ b/devel/gamin/files/patch-server_gam_kqueue.h @@ -1,19 +1,19 @@ ---- server/gam_kqueue.h.orig Fri Apr 8 14:50:41 2005 -+++ server/gam_kqueue.h Fri Apr 8 14:51:01 2005 -@@ -0,0 +1,16 @@ -+#ifndef __MD_KQUEUE_H__ -+#define __MD_KQUEUE_H__ -+ -+#include <glib.h> -+#include "gam_subscription.h" -+ -+G_BEGIN_DECLS -+ -+gboolean gam_kqueue_init (void); -+gboolean gam_kqueue_add_subscription (GamSubscription *sub); -+gboolean gam_kqueue_remove_subscription (GamSubscription *sub); -+gboolean gam_kqueue_remove_all_for (GamListener *listener); -+ -+G_END_DECLS -+ -+#endif /* __MD_KQUEUE_H__ */ +--- server/gam_kqueue.h.orig Thu May 19 20:35:00 2005 ++++ server/gam_kqueue.h Thu May 19 20:35:11 2005 +@@ -1,16 +1,8 @@ +- + #ifndef __MD_KQUEUE_H__ + #define __MD_KQUEUE_H__ + + #include <glib.h> +-#include "gam_poll.h" + #include "gam_subscription.h" +- +-#define VN_NOTE_MOST (NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | \ +- NOTE_ATTRIB | NOTE_LINK | NOTE_RENAME | \ +- NOTE_REVOKE) +-#define VN_NOTE_ALL VN_NOTE_MOST +-#define VN_NOTE_CHANGED (NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_LINK) + + G_BEGIN_DECLS + diff --git a/devel/gamin/files/patch-server_gam_server.c b/devel/gamin/files/patch-server_gam_server.c deleted file mode 100644 index de62120f6ff6..000000000000 --- a/devel/gamin/files/patch-server_gam_server.c +++ /dev/null @@ -1,56 +0,0 @@ ---- server/gam_server.c.orig Thu Dec 2 12:42:56 2004 -+++ server/gam_server.c Sun Mar 27 02:34:19 2005 -@@ -39,12 +39,29 @@ - #ifdef ENABLE_DNOTIFY - #include "gam_dnotify.h" - #endif -+#ifdef ENABLE_KQUEUE -+#include "gam_kqueue.h" -+#endif - #include "gam_excludes.h" - - static int poll_only = 0; - static const char *session; - - /** -+ * gam_exit: -+ * -+ * Call the shutdown routine, then just exit. -+ * This function is designed to be called from a -+ * signal handler. -+ */ -+void -+gam_exit(int signo) { -+ gam_shutdown(); -+ -+ exit(0); -+} -+ -+/** - * gam_shutdown: - * - * Shutdown routine called when the server exits -@@ -90,6 +107,12 @@ gam_init_subscriptions(void) - return(TRUE); - } - #endif -+#ifdef ENABLE_KQUEUE -+ if (gam_kqueue_init()) { -+ GAM_DEBUG(DEBUG_INFO, "Using KQueue as backend\n"); -+ return(TRUE); -+ } -+#endif - } - if (gam_poll_init()) { - GAM_DEBUG(DEBUG_INFO, "Using Poll as backend\n"); -@@ -332,6 +355,10 @@ main(int argc, const char *argv[]) - } - - gam_error_init(); -+ signal(SIGHUP, gam_exit); -+ signal(SIGINT, gam_exit); -+ signal(SIGQUIT, gam_exit); -+ signal(SIGTERM, gam_exit); - signal(SIGPIPE, SIG_IGN); - - if (!gam_init_subscriptions()) { diff --git a/devel/gamin/pkg-plist b/devel/gamin/pkg-plist index 1319c826ef36..008f29b345dd 100644 --- a/devel/gamin/pkg-plist +++ b/devel/gamin/pkg-plist @@ -6,7 +6,7 @@ lib/libfam.so.0 lib/libgamin-1.a lib/libgamin-1.la lib/libgamin-1.so -lib/libgamin-1.so.0 +lib/libgamin-1.so.1 lib/libgamin_shared.a libdata/pkgconfig/gamin.pc libexec/gam_server diff --git a/devel/py-gamin/Makefile b/devel/py-gamin/Makefile index 7001c110a817..995f6beb1547 100644 --- a/devel/py-gamin/Makefile +++ b/devel/py-gamin/Makefile @@ -5,14 +5,13 @@ # $FreeBSD$ # -PORTREVISION= 1 CATEGORIES= devel python PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= gnome@FreeBSD.org COMMENT= Python interface to the Gamin file monitoring system -LIB_DEPENDS= gamin-1.0:${PORTSDIR}/devel/gamin +LIB_DEPENDS= gamin-1.1:${PORTSDIR}/devel/gamin MASTERDIR= ${.CURDIR}/../gamin BUILD_WRKSRC= ${WRKSRC}/python |