* Update to 0.1.7, and add support for file system type detection (currently,
only UFS file systems are handled by kqueue, but this might change in the future if kqueue on NFS proves stable) [1] * Switch py-gamin to use USE_FAM+WANT_FAM_SYSTEM * Switch test target to regression-test so that pointyhat will run tests automatically Submitted by: ale [1]
This commit is contained in:
parent
f5bd60b2e4
commit
69a8d6f0dc
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=155554
14 changed files with 308 additions and 202 deletions
|
@ -6,8 +6,8 @@
|
|||
#
|
||||
|
||||
PORTNAME= gamin
|
||||
PORTVERSION= 0.1.5
|
||||
PORTREVISION?= 3
|
||||
PORTVERSION= 0.1.7
|
||||
PORTREVISION?= 0
|
||||
CATEGORIES?= devel
|
||||
MASTER_SITES= http://www.gnome.org/~veillard/gamin/sources/
|
||||
|
||||
|
@ -17,7 +17,7 @@ COMMENT?= A file and directory monitoring system
|
|||
USE_GMAKE= yes
|
||||
USE_GNOME?= gnomehack glib20
|
||||
INSTALLS_SHLIB= yes
|
||||
CONFIGURE_ARGS?=--disable-gtk-doc --with-html-dir=${PREFIX}/share/doc \
|
||||
CONFIGURE_ARGS?=--with-html-dir=${PREFIX}/share/doc \
|
||||
--without-python
|
||||
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include ${PTHREAD_CFLAGS}" \
|
||||
LDFLAGS="-L${LOCALBASE}/lib ${PTHREAD_LIBS}"
|
||||
|
@ -31,10 +31,10 @@ USE_AUTOTOOLS= libtool:15:inc
|
|||
.endif
|
||||
|
||||
post-patch:
|
||||
@${FIND} ${WRKSRC} -type f | ${XARGS} ${TOUCH} -f
|
||||
@${REINPLACE_CMD} "s|/etc|${PREFIX}/etc|g" ${WRKSRC}/server/gam_conf.c
|
||||
|
||||
.if !defined(GAMIN_SLAVE)
|
||||
tests: build
|
||||
regression-test: build
|
||||
@${ECHO_MSG} "===> Running gamin regression tests"
|
||||
@(cd ${WRKSRC}/tests && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} \
|
||||
Makefile ${MAKE_ARGS} tests)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
MD5 (gamin-0.1.5.tar.gz) = 0fad3fce44466bbb5a5d0450b4700e05
|
||||
SHA256 (gamin-0.1.5.tar.gz) = 9c12e6a179617a0b45a398f437adc6ea6e1c58cae82673ad67f3d431dac518b9
|
||||
SIZE (gamin-0.1.5.tar.gz) = 531603
|
||||
MD5 (gamin-0.1.7.tar.gz) = 1a1991ffa749b7dc2cc0573d6a2867b8
|
||||
SHA256 (gamin-0.1.7.tar.gz) = 8272c64356e1310353f2411b2cabd211468edbf8ce312d58aeef55889e79361a
|
||||
SIZE (gamin-0.1.7.tar.gz) = 542061
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- libgamin/gam_api.c.orig Sun Jul 17 16:48:54 2005
|
||||
+++ libgamin/gam_api.c Sun Jul 17 16:53:58 2005
|
||||
--- libgamin/gam_api.c.orig Tue Feb 7 17:49:07 2006
|
||||
+++ libgamin/gam_api.c Tue Feb 7 17:49:13 2006
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
@ -8,7 +8,7 @@
|
|||
#include "fam.h"
|
||||
#include "gam_protocol.h"
|
||||
#include "gam_data.h"
|
||||
@@ -421,10 +422,10 @@ gamin_write_credential_byte(int fd)
|
||||
@@ -421,10 +422,10 @@
|
||||
{
|
||||
char data[2] = { 0, 0 };
|
||||
int written;
|
||||
|
@ -22,7 +22,7 @@
|
|||
} cmsg;
|
||||
struct iovec iov;
|
||||
struct msghdr msg;
|
||||
@@ -436,16 +437,16 @@ gamin_write_credential_byte(int fd)
|
||||
@@ -436,16 +437,16 @@
|
||||
msg.msg_iov = &iov;
|
||||
msg.msg_iovlen = 1;
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
|||
written = sendmsg(fd, &msg, 0);
|
||||
#else
|
||||
written = write(fd, &data[0], 1);
|
||||
@@ -647,15 +648,16 @@ gamin_check_cred(GAMDataPtr conn, int fd
|
||||
@@ -647,15 +648,16 @@
|
||||
gid_t c_gid;
|
||||
|
||||
#ifdef HAVE_CMSGCRED
|
||||
|
@ -63,7 +63,7 @@
|
|||
/* Set the socket to receive credentials on the next message */
|
||||
{
|
||||
int on = 1;
|
||||
@@ -676,8 +678,8 @@ gamin_check_cred(GAMDataPtr conn, int fd
|
||||
@@ -676,8 +678,8 @@
|
||||
|
||||
#ifdef HAVE_CMSGCRED
|
||||
memset(&cmsg, 0, sizeof(cmsg));
|
||||
|
@ -74,27 +74,46 @@
|
|||
#endif
|
||||
|
||||
retry:
|
||||
@@ -694,7 +696,8 @@ retry:
|
||||
@@ -694,7 +696,7 @@
|
||||
goto failed;
|
||||
}
|
||||
#ifdef HAVE_CMSGCRED
|
||||
- if (cmsg.hdr.cmsg_len < sizeof(cmsg) || cmsg.hdr.cmsg_type != SCM_CREDS) {
|
||||
+ if (cmsg.hdr.cmsg_len < CMSG_LEN (sizeof (struct cmsgcred))
|
||||
+ || cmsg.hdr.cmsg_type != SCM_CREDS) {
|
||||
+ if (cmsg.hdr.cmsg_len < CMSG_LEN (sizeof (struct cmsgcred)) || cmsg.hdr.cmsg_type != SCM_CREDS) {
|
||||
GAM_DEBUG(DEBUG_INFO,
|
||||
"Message from recvmsg() was not SCM_CREDS\n");
|
||||
goto failed;
|
||||
@@ -720,9 +723,10 @@ retry:
|
||||
@@ -720,9 +722,10 @@
|
||||
goto failed;
|
||||
}
|
||||
#elif defined(HAVE_CMSGCRED)
|
||||
- c_pid = cmsg.cred.cmcred_pid;
|
||||
- c_uid = cmsg.cred.cmcred_euid;
|
||||
- c_gid = cmsg.cred.cmcred_groups[0];
|
||||
+ cred = (struct cmsgcred *) CMSG_DATA (&cmsg);
|
||||
+ cred = (struct cmsgcred *) CMSG_DATA (&cmsg);
|
||||
+ c_pid = cred->cmcred_pid;
|
||||
+ c_uid = cred->cmcred_euid;
|
||||
+ c_gid = cred->cmcred_groups[0];
|
||||
#else /* !SO_PEERCRED && !HAVE_CMSGCRED */
|
||||
GAM_DEBUG(DEBUG_INFO,
|
||||
"Socket credentials not supported on this OS\n");
|
||||
@@ -1283,14 +1286,17 @@
|
||||
|
||||
// FIXME: drop and reacquire lock while blocked?
|
||||
gamin_data_lock(conn);
|
||||
- if (!gamin_data_event_ready(conn)) {
|
||||
+ while ((ret = gamin_data_event_ready(conn)) == 0) {
|
||||
if (gamin_read_data(conn, fc->fd, 1) < 0) {
|
||||
gamin_try_reconnect(conn, fc->fd);
|
||||
FAMErrno = FAM_CONNECT;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
- ret = gamin_data_read_event(conn, fe);
|
||||
+
|
||||
+ if (ret > 0)
|
||||
+ ret = gamin_data_read_event(conn, fe);
|
||||
+
|
||||
gamin_data_unlock(conn);
|
||||
|
||||
if (ret < 0) {
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
--- 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);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
--- python/Makefile.in.orig Thu May 19 20:43:35 2005
|
||||
+++ python/Makefile.in Thu May 19 20:44:30 2005
|
||||
--- python/Makefile.in.orig Mon Feb 6 23:00:32 2006
|
||||
+++ python/Makefile.in Tue Feb 7 08:10:46 2006
|
||||
@@ -59,7 +59,7 @@
|
||||
pythonLTLIBRARIES_INSTALL = $(INSTALL)
|
||||
LTLIBRARIES = $(python_LTLIBRARIES)
|
||||
|
@ -9,7 +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
|
||||
@@ -237,9 +237,9 @@
|
||||
@@ -239,9 +239,9 @@
|
||||
gamin.c \
|
||||
gamin.py
|
||||
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
--- server/gam_channel.c.orig Tue Aug 9 18:17:39 2005
|
||||
+++ server/gam_channel.c Fri Oct 21 07:55:31 2005
|
||||
@@ -30,10 +30,10 @@
|
||||
+++ server/gam_channel.c Wed Feb 8 11:23:26 2006
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/uio.h>
|
||||
+#include <string.h>
|
||||
#include "gam_error.h"
|
||||
#include "gam_connection.h"
|
||||
#include "gam_channel.h"
|
||||
@@ -30,10 +31,10 @@
|
||||
{
|
||||
char data[2] = { 0, 0 };
|
||||
int written;
|
||||
|
@ -14,7 +22,7 @@
|
|||
} cmsg;
|
||||
struct iovec iov;
|
||||
struct msghdr msg;
|
||||
@@ -45,16 +45,16 @@
|
||||
@@ -45,16 +46,16 @@
|
||||
msg.msg_iov = &iov;
|
||||
msg.msg_iovlen = 1;
|
||||
|
||||
|
@ -35,7 +43,7 @@
|
|||
written = sendmsg(fd, &msg, 0);
|
||||
#else
|
||||
written = write(fd, &data[0], 1);
|
||||
@@ -95,15 +95,16 @@
|
||||
@@ -95,15 +96,16 @@
|
||||
gid_t c_gid;
|
||||
|
||||
#ifdef HAVE_CMSGCRED
|
||||
|
@ -55,7 +63,7 @@
|
|||
/* Set the socket to receive credentials on the next message */
|
||||
{
|
||||
int on = 1;
|
||||
@@ -124,8 +125,8 @@
|
||||
@@ -124,8 +126,8 @@
|
||||
|
||||
#ifdef HAVE_CMSGCRED
|
||||
memset(&cmsg, 0, sizeof(cmsg));
|
||||
|
@ -66,13 +74,12 @@
|
|||
#endif
|
||||
|
||||
retry:
|
||||
@@ -142,7 +143,8 @@
|
||||
@@ -142,7 +144,7 @@
|
||||
goto failed;
|
||||
}
|
||||
#ifdef HAVE_CMSGCRED
|
||||
- if (cmsg.hdr.cmsg_len < sizeof(cmsg) || cmsg.hdr.cmsg_type != SCM_CREDS) {
|
||||
+ if (cmsg.hdr.cmsg_len < CMSG_LEN (sizeof (struct cmsgcred))
|
||||
+ || cmsg.hdr.cmsg_type != SCM_CREDS) {
|
||||
+ if (cmsg.hdr.cmsg_len < CMSG_LEN (sizeof (struct cmsgcred)) || cmsg.hdr.cmsg_type != SCM_CREDS) {
|
||||
GAM_DEBUG(DEBUG_INFO,
|
||||
"Message from recvmsg() was not SCM_CREDS\n");
|
||||
goto failed;
|
||||
|
@ -90,103 +97,18 @@
|
|||
#else /* !SO_PEERCRED && !HAVE_CMSGCRED */
|
||||
GAM_DEBUG(DEBUG_INFO,
|
||||
"Socket credentials not supported on this OS\n");
|
||||
@@ -513,66 +516,6 @@
|
||||
g_free(dir);
|
||||
return(FALSE);
|
||||
}
|
||||
-
|
||||
-/**
|
||||
- * gam_check_secure_path:
|
||||
- * @path: path to the (possibly abstract) socket
|
||||
- *
|
||||
- * Tries to create or ensure that the socket used for communicating with
|
||||
- * the clients are in a safe directory to avoid possible attacks.
|
||||
- *
|
||||
- * Returns the socket file descriptor or -1 in case of error.
|
||||
- */
|
||||
-static gboolean
|
||||
-gam_check_secure_path(const char *path)
|
||||
-{
|
||||
- struct stat st;
|
||||
- int ret;
|
||||
-
|
||||
- if (!gam_check_secure_dir())
|
||||
- return(FALSE);
|
||||
- /*
|
||||
- * Check the existing socket if any
|
||||
- */
|
||||
- ret = stat(path, &st);
|
||||
- if (ret < 0)
|
||||
- return(TRUE);
|
||||
-
|
||||
- if (st.st_uid != getuid()) {
|
||||
- gam_error(DEBUG_INFO,
|
||||
- "Socket %s has different owner\n",
|
||||
- path);
|
||||
- goto cleanup;
|
||||
- }
|
||||
-#ifdef S_ISSOCK
|
||||
- if (!S_ISSOCK (st.st_mode)) {
|
||||
- gam_error(DEBUG_INFO, "Socket path %s is not a socket\n",
|
||||
- path);
|
||||
- goto cleanup;
|
||||
- }
|
||||
-#endif
|
||||
- if (st.st_mode & (S_IRWXG|S_IRWXO)) {
|
||||
- gam_error(DEBUG_INFO,
|
||||
- "Socket %s has wrong permissions\n",
|
||||
- path);
|
||||
- goto cleanup;
|
||||
- }
|
||||
@@ -557,11 +560,9 @@
|
||||
path);
|
||||
goto cleanup;
|
||||
}
|
||||
- /*
|
||||
- * Looks good though binding may fail due to an existing server
|
||||
- */
|
||||
- return(TRUE);
|
||||
-
|
||||
-cleanup:
|
||||
- /*
|
||||
- * the existing file at the socket location seems strange, try to remove it
|
||||
- */
|
||||
- ret = unlink(path);
|
||||
- if (ret < 0) {
|
||||
- gam_error(DEBUG_INFO, "Failed to remove %s\n", path);
|
||||
- return(FALSE);
|
||||
- }
|
||||
- return(TRUE);
|
||||
-}
|
||||
#endif /* ! HAVE_ABSTRACT_SOCKETS */
|
||||
|
||||
/************************************************************************
|
||||
@@ -620,6 +563,7 @@
|
||||
{
|
||||
int fd;
|
||||
struct sockaddr_un addr;
|
||||
+ struct stat st;
|
||||
|
||||
fd = socket(PF_UNIX, SOCK_STREAM, 0);
|
||||
if (fd < 0) {
|
||||
@@ -635,13 +579,18 @@
|
||||
addr.sun_path[0] = '\0';
|
||||
strncpy(&addr.sun_path[1], path, (sizeof(addr) - 4) - 2);
|
||||
#else
|
||||
- /*
|
||||
- * if the socket is exposed at the filesystem level we need to take
|
||||
- * some extra protection checks. Also make sure the socket is created
|
||||
- * with restricted mode
|
||||
- */
|
||||
- if (!gam_check_secure_path(path)) {
|
||||
+ if (! gam_check_secure_dir()) {
|
||||
+ close(fd);
|
||||
+ return (-1);
|
||||
+ }
|
||||
+
|
||||
+ if (stat(path, &st) == 0) {
|
||||
+ /* bind() will fail if the socket already exists */
|
||||
+ if (unlink(path) < 0) {
|
||||
+ GAM_DEBUG(DEBUG_INFO, "Failed to remove %s\n", path);
|
||||
+ close(fd);
|
||||
return (-1);
|
||||
+ }
|
||||
}
|
||||
strncpy(&addr.sun_path[0], path, (sizeof(addr) - 4) - 1);
|
||||
umask(0077);
|
||||
+ gam_error(DEBUG_INFO,
|
||||
+ "Maybe there is another server listening on socket %s\n",
|
||||
+ path);
|
||||
cleanup:
|
||||
/*
|
||||
* the existing file at the socket location seems strange, try to remove it
|
||||
|
|
123
devel/gamin/files/patch-server_gam_fs.c
Normal file
123
devel/gamin/files/patch-server_gam_fs.c
Normal file
|
@ -0,0 +1,123 @@
|
|||
--- server/gam_fs.c.orig Sat Aug 6 00:31:46 2005
|
||||
+++ server/gam_fs.c Wed Feb 8 15:05:24 2006
|
||||
@@ -7,6 +7,11 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <glib.h>
|
||||
+#ifdef __FreeBSD__
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/ucred.h>
|
||||
+#include <sys/mount.h>
|
||||
+#endif
|
||||
#include "gam_error.h"
|
||||
#include "gam_fs.h"
|
||||
|
||||
@@ -26,7 +31,9 @@
|
||||
static gboolean initialized = FALSE;
|
||||
static GList *filesystems = NULL;
|
||||
static GList *fs_props = NULL;
|
||||
+#ifdef __linux__
|
||||
static struct stat mtab_sbuf;
|
||||
+#endif
|
||||
|
||||
static void
|
||||
gam_fs_free_filesystems (void)
|
||||
@@ -110,6 +117,7 @@
|
||||
return strlen(fsb->path) - strlen (fsa->path);
|
||||
}
|
||||
|
||||
+#ifdef __linux__
|
||||
static void
|
||||
gam_fs_scan_mtab (void)
|
||||
{
|
||||
@@ -165,10 +173,40 @@
|
||||
gam_fs_free_filesystems ();
|
||||
filesystems = g_list_sort (new_filesystems, gam_fs_filesystem_sort_cb);
|
||||
}
|
||||
+#endif
|
||||
+
|
||||
+#ifdef __FreeBSD__
|
||||
+static void
|
||||
+gam_fs_getmntinfo (void)
|
||||
+{
|
||||
+ struct statfs *stat;
|
||||
+ GList *new_filesystems = NULL;
|
||||
+ gam_fs *fs = NULL;
|
||||
+ int i, n;
|
||||
+
|
||||
+ n = getmntinfo(&stat, MNT_NOWAIT);
|
||||
+ if (n == -1)
|
||||
+ return;
|
||||
+
|
||||
+ for (i = 0; i < n; i++)
|
||||
+ {
|
||||
+ fs = g_new0 (gam_fs, 1);
|
||||
+ fs->path = g_strdup (stat[i].f_mntonname);
|
||||
+ fs->fsname = g_strdup (stat[i].f_fstypename);
|
||||
+
|
||||
+ new_filesystems = g_list_prepend (new_filesystems, fs);
|
||||
+ }
|
||||
+
|
||||
+ /* Replace the old file systems list with the new one */
|
||||
+ gam_fs_free_filesystems ();
|
||||
+ filesystems = g_list_sort (new_filesystems, gam_fs_filesystem_sort_cb);
|
||||
+}
|
||||
+#endif
|
||||
|
||||
void
|
||||
gam_fs_init (void)
|
||||
{
|
||||
+#if defined(__linux__)
|
||||
if (initialized == FALSE)
|
||||
{
|
||||
initialized = TRUE;
|
||||
@@ -181,6 +219,7 @@
|
||||
if (stat("/etc/mtab", &mtab_sbuf) != 0)
|
||||
{
|
||||
GAM_DEBUG(DEBUG_INFO, "Could not stat /etc/mtab\n");
|
||||
+ return;
|
||||
}
|
||||
gam_fs_scan_mtab ();
|
||||
} else {
|
||||
@@ -189,6 +228,7 @@
|
||||
if (stat("/etc/mtab", &sbuf) != 0)
|
||||
{
|
||||
GAM_DEBUG(DEBUG_INFO, "Could not stat /etc/mtab\n");
|
||||
+ return;
|
||||
}
|
||||
|
||||
/* /etc/mtab has changed */
|
||||
@@ -199,6 +239,17 @@
|
||||
|
||||
mtab_sbuf = sbuf;
|
||||
}
|
||||
+#elif defined(__FreeBSD__)
|
||||
+ if (initialized == FALSE)
|
||||
+ {
|
||||
+ initialized = TRUE;
|
||||
+ gam_fs_set ("ufs", GFS_MT_KERNEL, 0);
|
||||
+ gam_fs_set ("nfs", GFS_MT_POLL, 5);
|
||||
+ gam_fs_set ("smbfs", GFS_MT_POLL, 5);
|
||||
+ }
|
||||
+ gam_fs_getmntinfo ();
|
||||
+
|
||||
+#endif
|
||||
}
|
||||
|
||||
gam_fs_mon_type
|
||||
@@ -209,10 +260,11 @@
|
||||
|
||||
props = gam_fs_find_fs_props (path);
|
||||
|
||||
- if (!props)
|
||||
- return GFS_MT_KERNEL;
|
||||
-
|
||||
- return props->mon_type;
|
||||
+#if defined(ENABLE_INOTIFY) || defined(ENABLE_DNOTIFY) || defined(ENABLE_KQUEUE) || defined(ENABLE_HURD_MACH_NOTIFY)
|
||||
+ if (props)
|
||||
+ return props->mon_type;
|
||||
+#endif
|
||||
+ return GFS_MT_POLL;
|
||||
}
|
||||
|
||||
int
|
|
@ -1,15 +1,37 @@
|
|||
--- server/gam_kqueue.c.orig Mon Feb 6 18:00:49 2006
|
||||
+++ server/gam_kqueue.c Mon Feb 6 18:01:25 2006
|
||||
@@ -31,7 +31,7 @@
|
||||
--- server/gam_kqueue.c.orig Wed Aug 10 23:50:32 2005
|
||||
+++ server/gam_kqueue.c Wed Feb 8 12:43:52 2006
|
||||
@@ -10,9 +10,8 @@
|
||||
* FAM should do: we do not call g_dir_open() if the file is a
|
||||
* symbolic link).
|
||||
*
|
||||
- * * kqueue cannot monitor files residing on anything but a UFS
|
||||
- * file system. If kqueue cannot monitor a file, this backend
|
||||
- * will poll it periodically.
|
||||
+ * * kqueue can only monitor files residing on a UFS file system.
|
||||
+ * For other file systems, the basic poll backend will be used.
|
||||
*
|
||||
* * Monitoring a file with kqueue prevents the file system it
|
||||
* resides on from being unmounted, because kqueue can only
|
||||
@@ -31,7 +30,8 @@
|
||||
* - kqueue needs to be moved out the UFS code.
|
||||
*
|
||||
* Copyright (C) 2005 Joe Marcus Clarke <marcus@FreeBSD.org>
|
||||
- * Copyright (C) 2005 Jean-Yves Lefort <jylefort@FreeBSD.org>
|
||||
+ * Copyright (C) 2005, 2006 Jean-Yves Lefort <jylefort@FreeBSD.org>
|
||||
+ * Copyright (C) 2006 Alex Dupre <ale@FreeBSD.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -515,7 +515,7 @@
|
||||
@@ -63,7 +63,7 @@
|
||||
#include "gam_kqueue.h"
|
||||
#include "gam_event.h"
|
||||
#include "gam_server.h"
|
||||
-#include "gam_poll.h"
|
||||
+#include "gam_poll_basic.h"
|
||||
|
||||
/*** tunable constants, modify to tweak the backend aggressivity *************/
|
||||
|
||||
@@ -516,7 +516,7 @@
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -18,3 +40,40 @@
|
|||
if (mon->fd < 0)
|
||||
{
|
||||
GAM_DEBUG(DEBUG_INFO, "cannot open %s (%s), falling back to poll\n", mon->pathname, g_strerror(errno));
|
||||
@@ -840,6 +840,8 @@
|
||||
case GAMIN_EVENT_MOVED:
|
||||
gam_kqueue_sub_monitor_set_missing(smon);
|
||||
break;
|
||||
+ default:
|
||||
+ break;
|
||||
}
|
||||
|
||||
gam_server_emit_event(mon->pathname, isdir, event, smon->subs, 1);
|
||||
@@ -981,6 +983,8 @@
|
||||
|
||||
gam_kqueue_hash_table_remove(fmon->smon->fmons, fmon);
|
||||
break;
|
||||
+ default:
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1167,11 +1171,13 @@
|
||||
channel = g_io_channel_unix_new(kq);
|
||||
g_io_add_watch(channel, G_IO_IN, gam_kqueue_kevent_cb, NULL);
|
||||
|
||||
-
|
||||
- gam_poll_set_kernel_handler(NULL, NULL, GAMIN_K_KQUEUE);
|
||||
- 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;
|
||||
+ gam_poll_basic_init ();
|
||||
+ gam_server_install_kernel_hooks (GAMIN_K_KQUEUE,
|
||||
+ gam_kqueue_add_subscription,
|
||||
+ gam_kqueue_remove_subscription,
|
||||
+ gam_kqueue_remove_all_for,
|
||||
+ NULL,
|
||||
+ NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
10
devel/gamin/files/patch-server_gam_node.c
Normal file
10
devel/gamin/files/patch-server_gam_node.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- server/gam_node.c.orig Thu Feb 9 01:22:56 2006
|
||||
+++ server/gam_node.c Thu Feb 9 01:23:03 2006
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "gam_event.h"
|
||||
#include "gam_node.h"
|
||||
#include "gam_error.h"
|
||||
+#include "gam_server.h"
|
||||
|
||||
/**
|
||||
* Create a new node
|
|
@ -1,13 +0,0 @@
|
|||
--- server/gam_pidname.c.orig Wed Aug 10 00:00:18 2005
|
||||
+++ server/gam_pidname.c Wed Aug 10 00:00:47 2005
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
char *gam_get_pidname (int pid)
|
||||
{
|
||||
+ gchar *pidname = NULL;
|
||||
#ifdef HAVE_LINUX
|
||||
gchar *procname;
|
||||
- gchar *pidname = NULL;
|
||||
FILE *fp;
|
||||
#endif
|
||||
|
14
devel/gamin/files/patch-server_gam_poll_basic.c
Normal file
14
devel/gamin/files/patch-server_gam_poll_basic.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
--- server/gam_poll_basic.c.orig Mon Feb 6 22:55:40 2006
|
||||
+++ server/gam_poll_basic.c Mon Feb 6 22:58:47 2006
|
||||
@@ -335,7 +335,11 @@
|
||||
} else {
|
||||
#ifdef VERBOSE_POLL
|
||||
GAM_DEBUG(DEBUG_INFO, "Poll: poll_file %s unchanged\n", path);
|
||||
+#ifdef ST_MTIM_NSEC
|
||||
GAM_DEBUG(DEBUG_INFO, "%d %d : %d %d\n", node->sbuf.st_mtim.tv_sec, node->sbuf.st_mtim.tv_nsec, sbuf.st_mtim.tv_sec, sbuf.st_mtim.tv_nsec);
|
||||
+#else
|
||||
+ GAM_DEBUG(DEBUG_INFO, "%d : %d\n", node->sbuf.st_mtime, sbuf.st_mtime);
|
||||
+#endif
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,46 +1,29 @@
|
|||
--- server/gam_server.c.orig Wed Aug 10 00:01:21 2005
|
||||
+++ server/gam_server.c Wed Aug 10 00:03:41 2005
|
||||
@@ -170,9 +170,11 @@ gam_add_subscription(GamSubscription * s
|
||||
if (gam_exclude_check (path))
|
||||
{
|
||||
GAM_DEBUG(DEBUG_INFO, "g_a_s: %s excluded\n", path);
|
||||
+#ifdef ENABLE_INOTIFY
|
||||
if (gam_inotify_is_running())
|
||||
return gam_poll_add_subscription (sub);
|
||||
else
|
||||
+#endif
|
||||
return gam_backend_add_subscription(sub);
|
||||
} else {
|
||||
gam_fs_mon_type type;
|
||||
@@ -211,9 +213,11 @@ gam_remove_subscription(GamSubscription
|
||||
|
||||
if (gam_exclude_check (path))
|
||||
{
|
||||
+#ifdef ENABLE_INOTIFY
|
||||
if (gam_inotify_is_running())
|
||||
return gam_poll_remove_subscription (sub);
|
||||
else
|
||||
+#endif
|
||||
return gam_backend_remove_subscription(sub);
|
||||
} else {
|
||||
gam_fs_mon_type type;
|
||||
@@ -300,15 +304,19 @@ gam_server_emit_one_event(const char *pa
|
||||
|
||||
reqno = gam_subscription_get_reqno(sub);
|
||||
|
||||
+#ifdef ENABLE_INOTIFY
|
||||
if (gam_inotify_is_running())
|
||||
{
|
||||
gam_queue_event(conn, reqno, event, subpath, len);
|
||||
} else {
|
||||
+#endif
|
||||
if (gam_send_event(conn, reqno, event, subpath, len) < 0) {
|
||||
GAM_DEBUG(DEBUG_INFO, "Failed to send event to PID %d\n",
|
||||
gam_connection_get_pid(conn));
|
||||
}
|
||||
+#ifdef ENABLE_INOTIFY
|
||||
--- server/gam_server.c.orig Wed Sep 21 18:21:05 2005
|
||||
+++ server/gam_server.c Tue Feb 7 13:12:02 2006
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "gam_server.h"
|
||||
#include "gam_channel.h"
|
||||
#include "gam_subscription.h"
|
||||
-#include "gam_poll_generic.h"
|
||||
+#include "gam_poll_basic.h"
|
||||
#ifdef ENABLE_INOTIFY
|
||||
#include "gam_inotify.h"
|
||||
#endif
|
||||
@@ -164,7 +164,7 @@
|
||||
#endif
|
||||
}
|
||||
+#endif
|
||||
|
||||
- if (gam_poll_generic_init()) {
|
||||
+ if (gam_poll_basic_init()) {
|
||||
GAM_DEBUG(DEBUG_INFO, "Using poll as backend\n");
|
||||
return(TRUE);
|
||||
}
|
||||
@@ -427,7 +427,7 @@
|
||||
GamPollHandler
|
||||
gam_server_get_poll_handler (void)
|
||||
{
|
||||
- return __gam_kernel_handler;
|
||||
+ return __gam_poll_handler;
|
||||
}
|
||||
|
||||
/**
|
||||
gboolean
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- tests/testing.c.orig Fri Apr 8 15:09:45 2005
|
||||
+++ tests/testing.c Fri Apr 8 15:09:57 2005
|
||||
@@ -424,9 +424,9 @@
|
||||
--- tests/testing.c.orig Thu Oct 27 12:51:03 2005
|
||||
+++ tests/testing.c Tue Feb 7 08:10:40 2006
|
||||
@@ -486,9 +486,9 @@
|
||||
return (-1);
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -5,20 +5,20 @@
|
|||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTREVISION= 1
|
||||
PORTREVISION= 0
|
||||
CATEGORIES= devel python
|
||||
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||
|
||||
MAINTAINER= gnome@FreeBSD.org
|
||||
COMMENT= Python interface to the Gamin file monitoring system
|
||||
|
||||
LIB_DEPENDS= gamin-1.1:${PORTSDIR}/devel/gamin
|
||||
|
||||
MASTERDIR= ${.CURDIR}/../gamin
|
||||
BUILD_WRKSRC= ${WRKSRC}/python
|
||||
INSTALL_WRKSRC= ${BUILD_WRKSRC}
|
||||
DESCR= ${.CURDIR}/pkg-descr
|
||||
PLIST= ${.CURDIR}/pkg-plist
|
||||
USE_FAM= yes
|
||||
WANT_FAM_SYSTEM=gamin
|
||||
|
||||
GAMIN_SLAVE= yes
|
||||
|
||||
|
|
Loading…
Reference in a new issue