Hi people.
kqueue support in FAM never worked really well for me.
For instance, if you use KDE and that famd is enabled on start-up
(rc.local or inetd), then startkde hangs forever waiting for famd which
never answers because of:
famd[15418]: failed to accept new client: Bad file descriptor
famd[15418]: Shutting down connection
famd[15418]: localclient socket(PF_UNIX, SOCK_STREAM, 0): Bad file
descriptor
famd[15418]: failed to accept new client: Bad file descriptor
famd[15418]: localclient socket(PF_UNIX, SOCK_STREAM, 0): Bad file
descriptor
That can also happen with GNOME under some circumstances.
Reading comments in IMonKQueue.c++, it is pretty obvious to me that
kqueue should be an option and not enforced by default.
I propose the included patch which adds a kqueue FLAVOR so that people
who really want/need this can use it.
The default fam package would then use polling which of course is not as
efficient as imon/kqueue but at least is stable and working ;-)
With this, KDE+FAM works just fine.
Thoughs, comments, OK?
ps: the patch also includes yet again more typos fixes.
--
Antoine
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/fam/Makefile,v
retrieving revision 1.8
diff -u -r1.8 Makefile
--- Makefile 18 Apr 2008 14:02:24 -0000 1.8
+++ Makefile 18 Apr 2008 16:15:05 -0000
@@ -3,7 +3,7 @@
COMMENT= File Alteration Monitor
DISTNAME= fam-2.7.0
-PKGNAME= ${DISTNAME}p4
+PKGNAME= ${DISTNAME}p5
SHARED_LIBS += fam 0.0 # .0.0
CATEGORIES= sysutils
@@ -17,7 +17,7 @@
PERMIT_DISTFILES_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
-WANTLIB= c m pthread rpcsvc stdc++
+WANTLIB= c m rpcsvc stdc++
MASTER_SITES= ftp://oss.sgi.com/projects/fam/download/stable/ \
http://humppa.nl/distfiles/
@@ -26,8 +26,15 @@
AUTOCONF_VERSION=2.59
CONFIGURE_STYLE=autoconf
-CONFIGURE_ENV= CXXFLAGS="${CXXFLAGS} -DHAVE_SOCKADDR_SUN_LEN" \
- LDFLAGS="-pthread"
+CONFIGURE_ENV= CXXFLAGS="${CXXFLAGS} -DHAVE_SOCKADDR_SUN_LEN"
+
+FLAVORS= kqueue
+FLAVOR?=
+
+.if ${FLAVOR:L:Mkqueue}
+CXXFLAGS+= -DHAVE_KQUEUE -pthread
+WANTLIB+= pthread
+.endif
post-patch:
rm -f ${WRKSRC}/configure
@@ -37,7 +44,11 @@
${WRKSRC}/man/famd.conf.5 ${WRKSRC}/man/famd.8
cp ${FILESDIR}/*.* ${WRKSRC}/src
mv ${WRKSRC}/man/famd.conf.5 ${WRKSRC}/man/fam.conf.5
-
+.if ${FLAVOR:L:Mkqueue}
+ perl -pi -e 's,[EMAIL PROTECTED]@,IMonKQueue,g' \
+ ${WRKSRC}/src/Makefile.in
+.endif
+
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/fam/
mv ${WRKINST}/${SYSCONFDIR}/fam.conf ${PREFIX}/share/examples/fam/
Index: files/imon-compat.h
===================================================================
RCS file: /cvs/ports/sysutils/fam/files/imon-compat.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 imon-compat.h
--- files/imon-compat.h 27 Apr 2007 22:00:55 -0000 1.1.1.1
+++ files/imon-compat.h 18 Apr 2008 16:15:05 -0000
@@ -30,6 +30,7 @@
# error "cannot include imon-compat.h if imon is really present"
#endif
+#if defined(HAVE_KQUEUE)
#define HAVE_IMON 1
typedef int intmask_t;
@@ -47,5 +48,7 @@
#define IMON_EXIT (1 << 4)
#define IMON_RENAME (1 << 5)
#define IMON_OVER 0xff
+
+#endif // defined(HAVE_KQUEUE)
#endif // !defined(IMON_COMPAT_H)
Index: patches/patch-configure_ac
===================================================================
RCS file: patches/patch-configure_ac
diff -N patches/patch-configure_ac
--- patches/patch-configure_ac 27 Apr 2007 22:00:55 -0000 1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-configure_ac,v 1.1.1.1 2007/04/27 22:00:55 jasper Exp $
---- configure.ac.orig Sat Feb 10 16:08:00 2007
-+++ configure.ac Sat Feb 10 16:08:13 2007
-@@ -38,7 +38,7 @@ if test "$have_sys_imon_h"; then
- elif test "$have_linux_imon_h"; then
- MONITOR_FUNCS=IMonLinux
- else
-- MONITOR_FUNCS=IMonNone
-+ MONITOR_FUNCS=IMonKQueue
- fi
- AC_SUBST(MONITOR_FUNCS)
-
Index: patches/patch-man_famd_8
===================================================================
RCS file: /cvs/ports/sysutils/fam/patches/patch-man_famd_8,v
retrieving revision 1.2
diff -u -r1.2 patch-man_famd_8
--- patches/patch-man_famd_8 18 Apr 2008 14:02:24 -0000 1.2
+++ patches/patch-man_famd_8 18 Apr 2008 16:15:05 -0000
@@ -1,6 +1,6 @@
$OpenBSD: patch-man_famd_8,v 1.2 2008/04/18 14:02:24 ajacoutot Exp $
--- man/famd.8.orig Mon Jan 20 01:58:11 2003
-+++ man/famd.8 Fri Apr 18 15:53:05 2008
++++ man/famd.8 Fri Apr 18 18:13:55 2008
@@ -2,7 +2,7 @@
.SH NAME
famd \- The File Alteration Monitor (FAM) daemon
@@ -19,6 +19,15 @@
providing the following command line options:
.SH OPTIONS
.TP
+@@ -29,7 +29,7 @@ providing the following command line options:
+ Read configuration information from \fIconffile\fR.
+ .TP
+ \fB\-C\fR
+-Run in backwards compatibilty mode. This is disables
++Run in backwards compatibility mode. This disables
+ authentication and is not recommended.
+ .TP
+ \fB\-f\fR
@@ -52,8 +52,8 @@ Register with the portmapper using the specifed RPC pr
and version numbers.
.TP
Index: patches/patch-man_famd_conf_5
===================================================================
RCS file: /cvs/ports/sysutils/fam/patches/patch-man_famd_conf_5,v
retrieving revision 1.1
diff -u -r1.1 patch-man_famd_conf_5
--- patches/patch-man_famd_conf_5 10 May 2007 19:56:19 -0000 1.1
+++ patches/patch-man_famd_conf_5 18 Apr 2008 16:15:05 -0000
@@ -1,6 +1,6 @@
$OpenBSD: patch-man_famd_conf_5,v 1.1 2007/05/10 19:56:19 ajacoutot Exp $
---- man/famd.conf.5.orig Thu May 10 14:54:06 2007
-+++ man/famd.conf.5 Thu May 10 14:59:23 2007
+--- man/famd.conf.5.orig Mon Jan 20 02:03:21 2003
++++ man/famd.conf.5 Fri Apr 18 18:13:14 2008
@@ -1,10 +1,10 @@
-.TH FAMD.CONF "5" "January 19, 2003" "famd.conf (fam 2.6.10)" "SGI"
+.TH FAM.CONF "5" "January 19, 2003" "fam.conf (fam 2.6.10)" "SGI"
@@ -15,3 +15,9 @@
command line option can be used to specify an alternate file.
.SH "FILE FORMAT"
Configuration lines are in the format \fBoption=value\fR.
+@@ -49,4 +49,4 @@ service remote requests without attempting to perform
+ the \fBlocal_only\fR configuration option or \fB-L\fR command line option is
+ used, \fBxtab_verification\fR has no effect.
+ .SH "SEE ALSO"
+-
++fam(3), famd(8), inetd(8), portmap(8)
Index: pkg/DESCR
===================================================================
RCS file: /cvs/ports/sysutils/fam/pkg/DESCR,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 DESCR
--- pkg/DESCR 27 Apr 2007 22:00:55 -0000 1.1.1.1
+++ pkg/DESCR 18 Apr 2008 16:15:05 -0000
@@ -1,2 +1,5 @@
FAM, the File Alteration Monitor, provides an API which applications can
use to be notified when specific files or directories are changed.
+
+Available flavor:
+ kqueue - Build with support for imon emulation through kqueue