View | Details | Raw Unified | Return to bug 32231
Collapse All | Expand All

(-)Makefile (-7 / +38 lines)
Lines 6-29 Link Here
6
#
6
#
7
7
8
PORTNAME=	fam
8
PORTNAME=	fam
9
PORTVERSION=	2.6.4
9
PORTVERSION=	2.6.6
10
CATEGORIES=	devel
10
CATEGORIES=	sysutils
11
MASTER_SITES=	ftp://oss.sgi.com/projects/fam/download/
11
MASTER_SITES=	ftp://oss.sgi.com/projects/fam/download/
12
DISTNAME=	${PORTNAME}-oss-${PORTVERSION}
13
12
14
MAINTAINER=	ishmael27@home.com
13
MAINTAINER=	ishmael27@home.com
15
14
16
USE_AUTOMAKE=	yes
15
USE_AUTOMAKE=	yes
16
AUTOMAKE_ARGS=	--add-missing --copy --foreign --include-deps
17
USE_LIBTOOL=	yes
17
USE_LIBTOOL=	yes
18
USE_GMAKE=	yes
18
USE_GMAKE=	yes
19
PATCH_STRIP=	-p1
19
EXTRACT_AFTER_ARGS=	| ${TAR} -xf - -C ${WRKSRC}
20
INSTALLS_SHLIB=	yes
20
INSTALLS_SHLIB=	yes
21
21
22
MAN1=		fam.1m
22
MAN3=		fam.3
23
MAN3=		fam.3x
23
MAN8=		fam.8
24
25
do-extract:
26
	@${RM} -rf ${WRKDIR}
27
	@${MKDIR} ${WRKSRC}
28
	@for file in ${EXTRACT_ONLY}; do \
29
		if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
30
		then \
31
			exit 1; \
32
		fi \
33
	done
34
.if !defined(EXTRACT_PRESERVE_OWNERSHIP)
35
	@if [ `id -u` = 0 ]; then \
36
		${CHMOD} -R ug-s ${WRKDIR}; \
37
		${CHOWN} -R 0:0 ${WRKDIR}; \
38
	fi
39
.endif
40
41
pre-configure:
42
	@${MV} ${WRKSRC}/man/fam.1m.in ${WRKSRC}/man/fam.8.in
43
	@${MV} ${WRKSRC}/man/fam.3x ${WRKSRC}/man/fam.3
44
	@${RM} -f ${WRKSRC}/install-sh ${WRKSRC}/missing \
45
		${WRKSRC}/mkinstalldirs
46
	@cd ${WRKSRC} && ${LOCALBASE}/bin/libtoolize --force --copy && \
47
		${ACLOCAL} && ${AUTOHEADER}
48
49
post-configure:
50
	@${FIND} ${WRKSRC} -name "Makefile" |xargs ${PERL} -pi -e  '\
51
		s|^ACLOCAL =.*|ACLOCAL = ${ACLOCAL}| ; \
52
		s|^AUTOCONF =.*|AUTOCONF = ${AUTOCONF}| ; \
53
		s|^AUTOMAKE =.*|AUTOMAKE = ${AUTOMAKE}| ; \
54
		s|^AUTOHEADER =.*|AUTOHEADER = ${AUTOHEADER}|'
24
55
25
post-install:
56
post-install:
26
	@${INSTALL_SCRIPT} -m 751 ${FILESDIR}/fam.sh.sample ${PREFIX}/etc/rc.d/fam.sh.sample
57
	@${INSTALL_SCRIPT} ${FILESDIR}/fam.sh.sample ${PREFIX}/etc/rc.d/fam.sh.sample
27
	@${CAT} ${PKGMESSAGE}
58
	@${CAT} ${PKGMESSAGE}
28
59
29
.include <bsd.port.mk>
60
.include <bsd.port.mk>
(-)distinfo (-1 / +1 lines)
Line 1 Link Here
1
MD5 (fam-oss-2.6.4.tar.gz) = d060919b3d9ede61a8b68eae1ded53ce
1
MD5 (fam-2.6.6.tar.gz) = c1ecf4136b673e49fd0ea7a2e50d9885
(-)pkg-plist (-2 lines)
Lines 2-9 Link Here
2
etc/fam.conf
2
etc/fam.conf
3
etc/rc.d/fam.sh.sample
3
etc/rc.d/fam.sh.sample
4
include/fam.h
4
include/fam.h
5
lib/fam/editconf.perl
6
lib/libfam.a
5
lib/libfam.a
7
lib/libfam.so
6
lib/libfam.so
8
lib/libfam.so.0
7
lib/libfam.so.0
9
@dirrm lib/fam
(-)files/patch-Makefile.am (-3 / +10 lines)
Lines 1-6 Link Here
1
--- Makefile.am.orig	Fri May 19 23:46:31 2000
1
--- Makefile.am.orig	Mon Oct 22 01:33:09 2001
2
+++ Makefile.am	Mon Mar 19 11:51:05 2001
2
+++ Makefile.am	Fri Nov 23 10:23:03 2001
3
@@ -7,30 +7,3 @@
3
@@ -1,36 +1,9 @@
4
 include $(top_srcdir)/common.am
5
 
6
-SUBDIRS = util include support libfam fam man test build
7
+SUBDIRS = include support libfam fam man
8
 
9
 EXTRA_DIST = common.am INSTALL.rpm
10
 
4
 rpm: dist
11
 rpm: dist
5
 	@cd build && $(MAKE) $(AM_MAKEFLAGS) rpm
12
 	@cd build && $(MAKE) $(AM_MAKEFLAGS) rpm
6
 
13
 
(-)files/patch-acconfig.h (+11 lines)
Added Link Here
1
--- acconfig.h.orig	Mon Oct 22 01:33:09 2001
2
+++ acconfig.h	Fri Nov 23 09:54:00 2001
3
@@ -47,6 +47,8 @@
4
 **  Otherwise, we'll use MNTTYPE_NFS.  */
5
 #undef HAVE_FSID_NFS2
6
 
7
+#undef HAVE_MNTENT_H
8
+
9
 /* Define if we have MNTTYPE_NFS2 */
10
 #define HAVE_MNTTYPE_NFS2 0
11
 
(-)files/patch-common.am (+11 lines)
Added Link Here
1
--- common.am.orig	Fri May 19 23:46:31 2000
2
+++ common.am	Sun Oct  7 16:40:38 2001
3
@@ -1,7 +1,7 @@
4
 #  Since we're not always using gcc, we don't want to use dependency
5
 #  tracking.  (It croaks non-GNU compilers.)  Seems like this should be
6
 #  configurable through autoconf!
7
-AUTOMAKE_OPTIONS=no-dependencies
8
+#AUTOMAKE_OPTIONS=no-dependencies
9
 
10
 #  why couldn't CONFIG_ETC_CONFIG_PATH be defined in config.h???
11
 INCLUDES = @FAMPROTOINC@ -DCONFIG_ETC_CONFIG_PATH=\"@FAM_CONF@\"
(-)files/patch-config.h.in (+11 lines)
Added Link Here
1
--- config.h.in.orig	Fri May 19 23:50:17 2000
2
+++ config.h.in	Sun Oct  7 15:22:17 2001
3
@@ -12,6 +12,8 @@
4
 /*  Define if the system has imon and IMONIOC_ ioctl flags.  */
5
 #undef HAVE_IMON
6
 
7
+#undef HAVE_MNTENT_H
8
+
9
 /*  Define if the system has the struct revokdi and the IMONIOC_REVOKDI
10
 **  ioctl flag.  (IRIX 5.3 doesn't.)
11
 */
(-)files/patch-configure.in (+67 lines)
Added Link Here
1
--- configure.in.orig	Sun Nov  4 23:31:30 2001
2
+++ configure.in	Fri Nov 23 10:50:04 2001
3
@@ -95,6 +95,8 @@
4
 dnl AC_HEADER_SYS_WAIT
5
 dnl AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h syslog.h unistd.h)
6
 
7
+AC_CHECK_HEADER(mntent.h, AC_DEFINE(HAVE_MNTENT_H))
8
+
9
 dnl
10
 dnl  See if imon is available; if so, is it IRIX or Linux?
11
 dnl
12
@@ -310,10 +312,10 @@
13
 dnl If we don't have MNTTYPE_NFS , we croak.
14
 dnl
15
 
16
-FAM_DECL_IN_MNTENT(MNTTYPE_NFS, ,AC_MSG_ERROR(Didn't find MNTTYPE_NFS in mntent.h))
17
-FAM_DECL_IN_MNTENT(MNTTYPE_NFS2, AC_DEFINE(HAVE_MNTTYPE_NFS2))
18
-FAM_DECL_IN_MNTENT(MNTTYPE_NFS3, AC_DEFINE(HAVE_MNTTYPE_NFS3))
19
-FAM_DECL_IN_MNTENT(MNTTYPE_CACHEFS, AC_DEFINE(HAVE_MNTTYPE_CACHEFS))
20
+dnl FAM_DECL_IN_MNTENT(MNTTYPE_NFS, ,AC_MSG_ERROR(Didn't find MNTTYPE_NFS in mntent.h))
21
+dnl FAM_DECL_IN_MNTENT(MNTTYPE_NFS2, AC_DEFINE(HAVE_MNTTYPE_NFS2))
22
+dnl FAM_DECL_IN_MNTENT(MNTTYPE_NFS3, AC_DEFINE(HAVE_MNTTYPE_NFS3))
23
+dnl FAM_DECL_IN_MNTENT(MNTTYPE_CACHEFS, AC_DEFINE(HAVE_MNTTYPE_CACHEFS))
24
 
25
 dnl
26
 dnl  Test for bindresvport() prototype.
27
@@ -516,8 +518,8 @@
28
 
29
 dnl
30
 dnl  This grief is for replacing XXX_FAM_CONF with $FAM_CONF
31
-dnl  in the fam(1M) man page.  (Simply putting @FAM_CONF@ in
32
-dnl  fam.1m.in puts the string "$sysconfdir/fam.conf" in the
33
+dnl  in the fam(8) man page.  (Simply putting @FAM_CONF@ in
34
+dnl  fam.8.in puts the string "$sysconfdir/fam.conf" in the
35
 dnl  man page, which isn't acceptable.  Isn't there a way to make
36
 dnl  autoconf handle this??)
37
 dnl
38
@@ -529,7 +531,7 @@
39
 [
40
     TMPFILE=configure.tmp
41
     for f in $CONFIG_FILES; do
42
-        if test `basename $f` != 'fam.1m'; then
43
+        if test `basename $f` != 'fam.8'; then
44
             continue
45
         fi
46
         echo "replacing XXX_FAM_CONF with $FAM_CONF and removing maintainer comments in $f"
47
@@ -554,19 +556,14 @@
48
 dnl
49
 AC_OUTPUT(
50
     Makefile 
51
-    build/Makefile
52
-    build/rpm/Makefile
53
-    build/rpm/rpm.spec
54
     fam/Makefile
55
     fam/fam.conf
56
     include/Makefile
57
     libfam/Makefile
58
     man/Makefile
59
-    man/fam.1m
60
+    man/fam.8
61
     support/Makefile
62
     test/Makefile
63
-    util/Makefile
64
-    util/editconf/Makefile
65
 )
66
 
67
 dnl 
(-)files/patch-fam::Client.h (+10 lines)
Added Link Here
1
--- fam/Client.h.orig	Fri May 19 23:46:31 2000
2
+++ fam/Client.h	Sun Oct  7 15:22:17 2001
3
@@ -23,6 +23,7 @@
4
 #ifndef Client_included
5
 #define Client_included
6
 
7
+#include <sys/types.h>
8
 #include <netinet/in.h>  // for in_addr
9
 
10
 #include "Activity.h"
(-)files/patch-fam::FileSystem.c++ (+11 lines)
Added Link Here
1
--- fam/FileSystem.c++.orig	Fri May 19 23:46:31 2000
2
+++ fam/FileSystem.c++	Sun Oct  7 15:22:17 2001
3
@@ -22,7 +22,7 @@
4
 
5
 #include "FileSystem.h"
6
 
7
-#include <mntent.h>
8
+#include "mntent.h"
9
 #include <string.h>
10
 
11
 #include "Event.h"
(-)files/patch-fam::FileSystemTable.c++ (+25 lines)
Added Link Here
1
--- fam/FileSystemTable.c++.orig	Fri May 19 23:46:31 2000
2
+++ fam/FileSystemTable.c++	Sun Oct  7 15:22:17 2001
3
@@ -21,9 +21,10 @@
4
 //  Temple Place - Suite 330, Boston MA 02111-1307, USA.
5
 
6
 #include <stddef.h>
7
+#include <stdio.h>
8
 #include "FileSystemTable.h"
9
 
10
-#include <mntent.h>
11
+#include "mntent.h"
12
 #include <stdlib.h>
13
 #include <string.h>
14
 
15
@@ -255,7 +256,10 @@
16
     //  create_fs_by_name initializes our "root" member variable.
17
     if (!fs_by_name)
18
     {   create_fs_by_name();
19
+#if !defined(__FreeBSD__)
20
+	/* there is no mtab "file" in freebsd! */
21
 	mtab_watcher = new InternalClient(mtab_name, mtab_event_handler, NULL);
22
+#endif
23
     }
24
 
25
     cr.become_user();
(-)files/patch-fam::IMon.c++ (+13 lines)
Added Link Here
1
--- fam/IMon.c++.orig	Fri May 19 23:46:31 2000
2
+++ fam/IMon.c++	Sun Oct  7 15:22:17 2001
3
@@ -34,7 +34,9 @@
4
 #endif
5
 #endif
6
 
7
-#include <sys/sysmacros.h>
8
+#if !defined(__FreeBSD__)
9
+#  include <sys/sysmacros.h>
10
+#endif
11
 #include <unistd.h>
12
 
13
 #include "Interest.h"
(-)files/patch-fam::Interest.c++ (+13 lines)
Added Link Here
1
--- fam/Interest.c++.orig	Fri May 19 23:46:31 2000
2
+++ fam/Interest.c++	Sun Oct  7 15:22:17 2001
3
@@ -25,7 +25,9 @@
4
 #include <string.h>
5
 #include <errno.h>
6
 #include <sys/param.h>
7
-#include <sys/sysmacros.h>
8
+#if !defined(__FreeBSD__)
9
+#  include <sys/sysmacros.h>
10
+#endif
11
 
12
 #ifdef HAVE_IRIX_XTAB_VERIFICATION
13
 #include <stdio.h>
(-)files/patch-fam::InternalClient.c++ (+12 lines)
Added Link Here
1
--- fam/InternalClient.c++.orig	Fri May 19 23:46:31 2000
2
+++ fam/InternalClient.c++	Sun Oct  7 15:22:17 2001
3
@@ -35,8 +35,8 @@
4
 {
5
     assert(filename);
6
     assert(h);
7
-    assert(filename[0] == '/');
8
     Log::debug("%s watching %s", name(), filename);
9
+    assert(filename[0] == '/');
10
     interest = new File(filename, this, Request(0), Cred::SuperUser);
11
 }
12
 
(-)files/patch-fam::Listener.c++ (+56 lines)
Added Link Here
1
--- fam/Listener.c++.orig	Mon Oct 22 01:33:10 2001
2
+++ fam/Listener.c++	Fri Nov 23 09:52:14 2001
3
@@ -22,6 +22,8 @@
4
 
5
 #include "Listener.h"
6
 
7
+#include <stdio.h>
8
+#include <stdlib.h>
9
 #include <assert.h>
10
 #include <fcntl.h>
11
 #include <sys/types.h>
12
@@ -205,7 +207,11 @@
13
     unsetenv("TMPDIR");
14
 
15
     char *tmpfile = tempnam("/tmp", ".fam");
16
+#if defined(__FreeBSD__)
17
+    sockaddr_un sun = { sizeof(sockaddr_un), AF_UNIX, "" };
18
+#else
19
     sockaddr_un sun = { AF_UNIX, "" };
20
+#endif
21
     if(strlen(tmpfile) >= (sizeof(sun.sun_path) - 1))
22
     {
23
         Log::error("tmpnam() too long for sun_path (%d >= %d)!",
24
@@ -239,7 +245,7 @@
25
         return;
26
     }
27
 
28
-    if (chown(sun.sun_path, uid, -1) != 0)
29
+    if (chown(sun.sun_path, uid, (gid_t)-1) != 0)
30
     {   Log::perror("localclient chown");
31
 	close(client_sock);
32
         return;
33
@@ -275,7 +281,11 @@
34
 
35
     // Get the new socket.
36
 
37
+#if defined(__FreeBSD__)
38
+    struct sockaddr_un sun = { sizeof(sockaddr_un), AF_UNIX, "" };
39
+#else
40
     struct sockaddr_un sun = { AF_UNIX, "" };
41
+#endif
42
     CONFIG_SOCKLEN_T sunlen = sizeof(sun);
43
     int client_fd = accept(ofd, (struct sockaddr *) &sun, &sunlen);
44
     if (client_fd < 0)
45
@@ -337,7 +347,11 @@
46
 void
47
 Listener::dirty_ugly_hack()
48
 {
49
+#if defined(__FreeBSD__)
50
+    static sockaddr_un sun = { sizeof (sockaddr_un), AF_UNIX, "/tmp/.fam_socket" };
51
+#else
52
     static sockaddr_un sun = { AF_UNIX, "/tmp/.fam_socket" };
53
+#endif
54
 
55
     int sock = socket(PF_UNIX, SOCK_STREAM, 0);
56
     if (sock < 0)
(-)files/patch-fam::Log.c++ (+11 lines)
Added Link Here
1
--- fam/Log.c++.orig	Fri May 19 23:46:31 2000
2
+++ fam/Log.c++	Sun Oct  7 15:22:17 2001
3
@@ -28,6 +28,8 @@
4
 #include <stdlib.h>
5
 #include <string.h>
6
 #include <syslog.h>
7
+#include <sys/time.h>
8
+#include <sys/types.h>
9
 #include <sys/resource.h>
10
 #include <sys/stat.h>
11
 #include <unistd.h>
(-)files/patch-fam::Makefile.am (+16 lines)
Added Link Here
1
--- fam/Makefile.am.orig	Fri May 19 23:46:31 2000
2
+++ fam/Makefile.am	Sun Oct  7 16:27:01 2001
3
@@ -72,11 +72,12 @@
4
   main.c++ \
5
   timeval.c++ \
6
   timeval.h \
7
+  mntent_compat.c++ \
8
   @IMON_FUNCS@.c++
9
 
10
 EXTRA_fam_SOURCES = IMonIrix.c++ IMonLinux.c++ IMonNone.c++
11
 
12
 fam_LDADD = -lrpcsvc $(top_srcdir)/support/libsupport.a
13
 
14
-CLEANFILES += @MKDEPFILE@ ii_files/*.ii
15
+CLEANFILES = @MKDEPFILE@ ii_files/*.ii
16
 sinclude @MKDEPFILE@
(-)files/patch-fam::Scheduler.h (+10 lines)
Added Link Here
1
--- fam/Scheduler.h.orig	Fri May 19 23:46:32 2000
2
+++ fam/Scheduler.h	Sun Oct  7 15:22:17 2001
3
@@ -24,6 +24,7 @@
4
 #define Scheduler_included
5
 
6
 #include <sys/time.h>
7
+#include <string.h>
8
 
9
 #include "Boolean.h"
10
 
(-)files/patch-fam::StringTable.h (+10 lines)
Added Link Here
1
--- fam/StringTable.h.orig	Fri May 19 23:46:32 2000
2
+++ fam/StringTable.h	Sun Oct  7 15:22:17 2001
3
@@ -25,6 +25,7 @@
4
 
5
 #include <assert.h>
6
 #include <string.h>
7
+#include "mntent.h"
8
 
9
 //  A StringTable maps C strings onto values.  It is a cheap O(n)
10
 //  implementation, suitable only for small tables that are
(-)files/patch-fam::mntent.h (+59 lines)
Added Link Here
1
--- fam/mntent.h.orig	Sun Oct  7 15:22:17 2001
2
+++ fam/mntent.h	Sun Oct  7 15:22:17 2001
3
@@ -0,0 +1,56 @@
4
+/*
5
+ *  mntent
6
+ *  mntent.h - compatability header for FreeBSD
7
+ *
8
+ *  Copyright (c) 2001 David Rufino <daverufino@btinternet.com>
9
+ *  All rights reserved.
10
+ *
11
+ * Redistribution and use in source and binary forms, with or without
12
+ * modification, are permitted provided that the following conditions
13
+ * are met:
14
+ * 1. Redistributions of source code must retain the above copyright
15
+ *    notice, this list of conditions and the following disclaimer.
16
+ * 2. Redistributions in binary form must reproduce the above copyright
17
+ *    notice, this list of conditions and the following disclaimer in the
18
+ *    documentation and/or other materials provided with the distribution.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30
+ * SUCH DAMAGE.
31
+ */
32
+
33
+#if defined(HAVE_MNTENT_H)
34
+#include <mntent.h>
35
+#else
36
+#ifndef _MNTENT_H
37
+#define _MNTENT_H
38
+#include <stdio.h>
39
+
40
+#define MOUNTED "dummy"
41
+
42
+#define MNTTYPE_NFS "nfs"
43
+
44
+struct mntent {
45
+	char *mnt_fsname;
46
+	char *mnt_dir;
47
+	char *mnt_type;
48
+	char *mnt_opts;
49
+	int mnt_freq;
50
+	int mnt_passno;
51
+};
52
+
53
+#define setmntent(x,y) ((FILE *)0x1)
54
+struct mntent *getmntent __P ((FILE *fp));
55
+char *hasmntopt __P ((const struct mntent *mnt, const char *option));
56
+#define endmntent(x) ((int)1)
57
+
58
+#endif /* _MNTENT_H */
59
+#endif /* HAVE_MNTENT_H */
(-)files/patch-fam::mntent_compat.c++ (+154 lines)
Added Link Here
1
--- fam/mntent_compat.c++.orig	Sun Oct  7 15:22:17 2001
2
+++ fam/mntent_compat.c++	Sun Oct  7 15:22:17 2001
3
@@ -0,0 +1,151 @@
4
+/*
5
+ * Copyright (c) 1980, 1989, 1993, 1994
6
+ *      The Regents of the University of California.  All rights reserved.
7
+ * Copyright (c) 2001
8
+ *      David Rufino <daverufino@btinternet.com>
9
+ *
10
+ * Redistribution and use in source and binary forms, with or without
11
+ * modification, are permitted provided that the following conditions
12
+ * are met:
13
+ * 1. Redistributions of source code must retain the above copyright
14
+ *    notice, this list of conditions and the following disclaimer.
15
+ * 2. Redistributions in binary form must reproduce the above copyright
16
+ *    notice, this list of conditions and the following disclaimer in the
17
+ *    documentation and/or other materials provided with the distribution.
18
+ * 3. All advertising materials mentioning features or use of this software
19
+ *    must display the following acknowledgement:
20
+ *      This product includes software developed by the University of
21
+ *      California, Berkeley and its contributors.
22
+ * 4. Neither the name of the University nor the names of its contributors
23
+ *    may be used to endorse or promote products derived from this software
24
+ *    without specific prior written permission.
25
+ *
26
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36
+ * SUCH DAMAGE.
37
+ */
38
+
39
+/* most of this was ripped from the mount(3) source */
40
+
41
+#include "config.h"
42
+#include "mntent.h"
43
+#if !defined(HAVE_MNTENT_H)
44
+#include <stdlib.h>
45
+#include <string.h>
46
+#include <sys/param.h>
47
+#include <sys/ucred.h>
48
+#include <sys/mount.h>
49
+
50
+static int pos = -1;
51
+static int mntsize = -1;
52
+static struct mntent _mntent;
53
+
54
+char *
55
+hasmntopt (const struct mntent *mnt, const char *option)
56
+{
57
+        int found;
58
+        char *opt, *optbuf;
59
+
60
+        optbuf = strdup(mnt->mnt_opts);
61
+        found = 0;
62
+        for (opt = optbuf; (opt = strtok(opt, " ")) != NULL; opt = NULL) {
63
+                if (!strcasecmp(opt, option)) {
64
+			opt = opt - optbuf + mnt->mnt_opts;
65
+			free (optbuf);
66
+			return (opt);
67
+		}
68
+        }
69
+	free (optbuf);
70
+        return (NULL);
71
+}
72
+
73
+static char *
74
+catopt (char *s0, const char *s1)
75
+{
76
+        size_t i;
77
+        char *cp;
78
+
79
+        if (s1 == NULL || *s1 == '\0')
80
+                return s0;
81
+        if (s0 && *s0) {
82
+                i = strlen(s0) + strlen(s1) + 1 + 1;
83
+                if ((cp = (char *)malloc(i)) == NULL)
84
+			return (NULL);
85
+                (void)snprintf(cp, i, "%s %s", s0, s1);
86
+        } else
87
+                cp = strdup(s1);
88
+
89
+        if (s0)
90
+                free(s0);
91
+        return (cp);
92
+}
93
+
94
+
95
+static char *
96
+flags2opts (int flags)
97
+{
98
+        char *res;
99
+        res = NULL;
100
+        res = catopt(res, (flags & MNT_RDONLY) ? "ro" : "rw");
101
+        if (flags & MNT_SYNCHRONOUS)    res = catopt(res, "sync");
102
+        if (flags & MNT_NOEXEC)         res = catopt(res, "noexec");
103
+        if (flags & MNT_NOSUID)         res = catopt(res, "nosuid");
104
+        if (flags & MNT_NODEV)          res = catopt(res, "nodev");
105
+        if (flags & MNT_UNION)          res = catopt(res, "union");
106
+        if (flags & MNT_ASYNC)          res = catopt(res, "async");
107
+        if (flags & MNT_NOATIME)        res = catopt(res, "noatime");
108
+        if (flags & MNT_NOCLUSTERR)     res = catopt(res, "noclusterr");
109
+        if (flags & MNT_NOCLUSTERW)     res = catopt(res, "noclusterw");
110
+        if (flags & MNT_NOSYMFOLLOW)    res = catopt(res, "nosymfollow");
111
+        if (flags & MNT_SUIDDIR)        res = catopt(res, "suiddir");
112
+
113
+        return res;
114
+}
115
+
116
+static struct mntent *
117
+statfs_to_mntent (struct statfs *mntbuf)
118
+{
119
+	static char opts_buf[40], *tmp;
120
+	
121
+	_mntent.mnt_fsname = mntbuf->f_mntfromname;
122
+	_mntent.mnt_dir = mntbuf->f_mntonname;
123
+	_mntent.mnt_type = mntbuf->f_fstypename;
124
+	tmp = flags2opts (mntbuf->f_flags);
125
+	if (tmp) {
126
+		opts_buf[sizeof(opts_buf)-1] = '\0';
127
+		strncpy (opts_buf, tmp, sizeof(opts_buf)-1);
128
+		free (tmp);
129
+	} else {
130
+		*opts_buf = '\0';
131
+	}
132
+	_mntent.mnt_opts = opts_buf;	
133
+	_mntent.mnt_freq = _mntent.mnt_passno = 0;
134
+	return (&_mntent);
135
+}
136
+
137
+struct mntent *
138
+getmntent (FILE *fp)
139
+{
140
+	struct statfs *mntbuf;
141
+
142
+	if (pos == -1 || mntsize == -1)
143
+		mntsize = getmntinfo (&mntbuf, MNT_NOWAIT);
144
+
145
+	++pos;
146
+	if (pos == mntsize) {
147
+		pos = mntsize = -1;
148
+		return (NULL);
149
+	}
150
+
151
+	return (statfs_to_mntent (&mntbuf[pos]));
152
+}
153
+
154
+#endif /* HAVE_MNTENT_H */
(-)files/patch-freebsd (-490 lines)
Removed Link Here
1
diff -urN fam-oss-2.6.4/config.h.in fam-oss-2.6.4-freebsd/config.h.in
2
--- fam-oss-2.6.4/config.h.in	Sat May 20 05:50:17 2000
3
+++ fam-oss-2.6.4-freebsd/config.h.in	Sun Mar 18 00:02:38 2001
4
@@ -12,6 +12,8 @@
5
 /*  Define if the system has imon and IMONIOC_ ioctl flags.  */
6
 #undef HAVE_IMON
7
 
8
+#undef HAVE_MNTENT_H
9
+
10
 /*  Define if the system has the struct revokdi and the IMONIOC_REVOKDI
11
 **  ioctl flag.  (IRIX 5.3 doesn't.)
12
 */
13
diff -urN fam-oss-2.6.4/configure.in fam-oss-2.6.4-freebsd/configure.in
14
--- fam-oss-2.6.4/configure.in	Sat May 20 06:23:17 2000
15
+++ fam-oss-2.6.4-freebsd/configure.in	Sun Mar 18 00:36:29 2001
16
@@ -95,6 +95,8 @@
17
 dnl AC_HEADER_SYS_WAIT
18
 dnl AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h syslog.h unistd.h)
19
 
20
+AC_CHECK_HEADER(mntent.h, AC_DEFINE(HAVE_MNTENT_H))
21
+
22
 dnl
23
 dnl  See if imon is available; if so, is it IRIX or Linux?
24
 dnl
25
@@ -299,10 +301,10 @@
26
 dnl If we don't have MNTTYPE_NFS , we croak.
27
 dnl
28
 
29
-FAM_DECL_IN_MNTENT(MNTTYPE_NFS, ,AC_MSG_ERROR(Didn't find MNTTYPE_NFS in mntent.h))
30
-FAM_DECL_IN_MNTENT(MNTTYPE_NFS2, AC_DEFINE(HAVE_MNTTYPE_NFS2))
31
-FAM_DECL_IN_MNTENT(MNTTYPE_NFS3, AC_DEFINE(HAVE_MNTTYPE_NFS3))
32
-FAM_DECL_IN_MNTENT(MNTTYPE_CACHEFS, AC_DEFINE(HAVE_MNTTYPE_CACHEFS))
33
+dnl FAM_DECL_IN_MNTENT(MNTTYPE_NFS, ,AC_MSG_ERROR(Didn't find MNTTYPE_NFS in mntent.h))
34
+dnl FAM_DECL_IN_MNTENT(MNTTYPE_NFS2, AC_DEFINE(HAVE_MNTTYPE_NFS2))
35
+dnl FAM_DECL_IN_MNTENT(MNTTYPE_NFS3, AC_DEFINE(HAVE_MNTTYPE_NFS3))
36
+dnl FAM_DECL_IN_MNTENT(MNTTYPE_CACHEFS, AC_DEFINE(HAVE_MNTTYPE_CACHEFS))
37
 
38
 dnl
39
 dnl  Test for bindresvport() prototype.
40
diff -urN fam-oss-2.6.4/fam/Client.h fam-oss-2.6.4-freebsd/fam/Client.h
41
--- fam-oss-2.6.4/fam/Client.h	Sat May 20 05:46:31 2000
42
+++ fam-oss-2.6.4-freebsd/fam/Client.h	Sat Mar 17 00:14:35 2001
43
@@ -23,6 +23,7 @@
44
 #ifndef Client_included
45
 #define Client_included
46
 
47
+#include <sys/types.h>
48
 #include <netinet/in.h>  // for in_addr
49
 
50
 #include "Activity.h"
51
diff -urN fam-oss-2.6.4/fam/FileSystem.c++ fam-oss-2.6.4-freebsd/fam/FileSystem.c++
52
--- fam-oss-2.6.4/fam/FileSystem.c++	Sat May 20 05:46:31 2000
53
+++ fam-oss-2.6.4-freebsd/fam/FileSystem.c++	Sat Mar 17 13:18:10 2001
54
@@ -22,7 +22,7 @@
55
 
56
 #include "FileSystem.h"
57
 
58
-#include <mntent.h>
59
+#include "mntent.h"
60
 #include <string.h>
61
 
62
 #include "Event.h"
63
diff -urN fam-oss-2.6.4/fam/FileSystemTable.c++ fam-oss-2.6.4-freebsd/fam/FileSystemTable.c++
64
--- fam-oss-2.6.4/fam/FileSystemTable.c++	Sat May 20 05:46:31 2000
65
+++ fam-oss-2.6.4-freebsd/fam/FileSystemTable.c++	Sat Mar 17 23:44:17 2001
66
@@ -21,9 +21,10 @@
67
 //  Temple Place - Suite 330, Boston MA 02111-1307, USA.
68
 
69
 #include <stddef.h>
70
+#include <stdio.h>
71
 #include "FileSystemTable.h"
72
 
73
-#include <mntent.h>
74
+#include "mntent.h"
75
 #include <stdlib.h>
76
 #include <string.h>
77
 
78
@@ -255,7 +256,10 @@
79
     //  create_fs_by_name initializes our "root" member variable.
80
     if (!fs_by_name)
81
     {   create_fs_by_name();
82
+#if !defined(__FreeBSD__)
83
+	/* there is no mtab "file" in freebsd! */
84
 	mtab_watcher = new InternalClient(mtab_name, mtab_event_handler, NULL);
85
+#endif
86
     }
87
 
88
     cr.become_user();
89
diff -urN fam-oss-2.6.4/fam/IMon.c++ fam-oss-2.6.4-freebsd/fam/IMon.c++
90
--- fam-oss-2.6.4/fam/IMon.c++	Sat May 20 05:46:31 2000
91
+++ fam-oss-2.6.4-freebsd/fam/IMon.c++	Sat Mar 17 14:06:17 2001
92
@@ -34,7 +34,9 @@
93
 #endif
94
 #endif
95
 
96
-#include <sys/sysmacros.h>
97
+#if !defined(__FreeBSD__)
98
+#  include <sys/sysmacros.h>
99
+#endif
100
 #include <unistd.h>
101
 
102
 #include "Interest.h"
103
diff -urN fam-oss-2.6.4/fam/Interest.c++ fam-oss-2.6.4-freebsd/fam/Interest.c++
104
--- fam-oss-2.6.4/fam/Interest.c++	Sat May 20 05:46:31 2000
105
+++ fam-oss-2.6.4-freebsd/fam/Interest.c++	Sat Mar 17 14:06:37 2001
106
@@ -25,7 +25,9 @@
107
 #include <string.h>
108
 #include <errno.h>
109
 #include <sys/param.h>
110
-#include <sys/sysmacros.h>
111
+#if !defined(__FreeBSD__)
112
+#  include <sys/sysmacros.h>
113
+#endif
114
 
115
 #ifdef HAVE_IRIX_XTAB_VERIFICATION
116
 #include <stdio.h>
117
diff -urN fam-oss-2.6.4/fam/InternalClient.c++ fam-oss-2.6.4-freebsd/fam/InternalClient.c++
118
--- fam-oss-2.6.4/fam/InternalClient.c++	Sat May 20 05:46:31 2000
119
+++ fam-oss-2.6.4-freebsd/fam/InternalClient.c++	Sat Mar 17 23:20:15 2001
120
@@ -35,8 +35,8 @@
121
 {
122
     assert(filename);
123
     assert(h);
124
-    assert(filename[0] == '/');
125
     Log::debug("%s watching %s", name(), filename);
126
+    assert(filename[0] == '/');
127
     interest = new File(filename, this, Request(0), Cred::SuperUser);
128
 }
129
 
130
diff -urN fam-oss-2.6.4/fam/Listener.c++ fam-oss-2.6.4-freebsd/fam/Listener.c++
131
--- fam-oss-2.6.4/fam/Listener.c++	Sat May 20 05:46:31 2000
132
+++ fam-oss-2.6.4-freebsd/fam/Listener.c++	Sat Mar 17 14:12:57 2001
133
@@ -22,6 +22,8 @@
134
 
135
 #include "Listener.h"
136
 
137
+#include <stdio.h>
138
+#include <stdlib.h>
139
 #include <assert.h>
140
 #include <fcntl.h>
141
 #include <sys/types.h>
142
@@ -202,7 +204,11 @@
143
     //  requested user and pass the name back to the client.
144
 
145
     char *tmpfile = tempnam("/tmp", ".fam");
146
+#if defined(__FreeBSD__)
147
+    sockaddr_un sun = { sizeof(sockaddr_un), AF_UNIX, "" };
148
+#else
149
     sockaddr_un sun = { AF_UNIX, "" };
150
+#endif
151
     if(strlen(tmpfile) >= (sizeof(sun.sun_path) - 1))
152
     {
153
         Log::error("tmpnam() too long for sun_path (%d >= %d)!",
154
@@ -235,7 +241,7 @@
155
         return;
156
     }
157
 
158
-    if (chown(sun.sun_path, uid, -1) != 0)
159
+    if (chown(sun.sun_path, uid, (gid_t)-1) != 0)
160
     {   Log::perror("localclient chown");
161
 	close(client_sock);
162
         return;
163
@@ -271,7 +277,11 @@
164
 
165
     // Get the new socket.
166
 
167
+#if defined(__FreeBSD__)
168
+    struct sockaddr_un sun = { sizeof(sockaddr_un), AF_UNIX, "" };
169
+#else
170
     struct sockaddr_un sun = { AF_UNIX, "" };
171
+#endif
172
     CONFIG_SOCKLEN_T sunlen = sizeof(sun);
173
     int client_fd = accept(ofd, (struct sockaddr *) &sun, &sunlen);
174
     if (client_fd < 0)
175
@@ -333,7 +343,11 @@
176
 void
177
 Listener::dirty_ugly_hack()
178
 {
179
+#if defined(__FreeBSD__)
180
+    static sockaddr_un sun = { sizeof (sockaddr_un), AF_UNIX, "/tmp/.fam_socket" };
181
+#else
182
     static sockaddr_un sun = { AF_UNIX, "/tmp/.fam_socket" };
183
+#endif
184
 
185
     int sock = socket(PF_UNIX, SOCK_STREAM, 0);
186
     if (sock < 0)
187
diff -urN fam-oss-2.6.4/fam/Log.c++ fam-oss-2.6.4-freebsd/fam/Log.c++
188
--- fam-oss-2.6.4/fam/Log.c++	Sat May 20 05:46:31 2000
189
+++ fam-oss-2.6.4-freebsd/fam/Log.c++	Sat Mar 17 14:14:31 2001
190
@@ -28,6 +28,8 @@
191
 #include <stdlib.h>
192
 #include <string.h>
193
 #include <syslog.h>
194
+#include <sys/time.h>
195
+#include <sys/types.h>
196
 #include <sys/resource.h>
197
 #include <sys/stat.h>
198
 #include <unistd.h>
199
diff -urN fam-oss-2.6.4/fam/Makefile.am fam-oss-2.6.4-freebsd/fam/Makefile.am
200
--- fam-oss-2.6.4/fam/Makefile.am	Sat May 20 05:46:31 2000
201
+++ fam-oss-2.6.4-freebsd/fam/Makefile.am	Sat Mar 17 18:12:17 2001
202
@@ -72,6 +72,7 @@
203
   main.c++ \
204
   timeval.c++ \
205
   timeval.h \
206
+  mntent_compat.c++ \
207
   @IMON_FUNCS@.c++
208
 
209
 EXTRA_fam_SOURCES = IMonIrix.c++ IMonLinux.c++ IMonNone.c++
210
diff -urN fam-oss-2.6.4/fam/Scheduler.h fam-oss-2.6.4-freebsd/fam/Scheduler.h
211
--- fam-oss-2.6.4/fam/Scheduler.h	Sat May 20 05:46:32 2000
212
+++ fam-oss-2.6.4-freebsd/fam/Scheduler.h	Sat Mar 17 00:14:04 2001
213
@@ -24,6 +24,7 @@
214
 #define Scheduler_included
215
 
216
 #include <sys/time.h>
217
+#include <string.h>
218
 
219
 #include "Boolean.h"
220
 
221
diff -urN fam-oss-2.6.4/fam/StringTable.h fam-oss-2.6.4-freebsd/fam/StringTable.h
222
--- fam-oss-2.6.4/fam/StringTable.h	Sat May 20 05:46:32 2000
223
+++ fam-oss-2.6.4-freebsd/fam/StringTable.h	Sat Mar 17 18:05:38 2001
224
@@ -25,6 +25,7 @@
225
 
226
 #include <assert.h>
227
 #include <string.h>
228
+#include "mntent.h"
229
 
230
 //  A StringTable maps C strings onto values.  It is a cheap O(n)
231
 //  implementation, suitable only for small tables that are
232
diff -urN fam-oss-2.6.4/fam/mntent.h fam-oss-2.6.4-freebsd/fam/mntent.h
233
--- fam-oss-2.6.4/fam/mntent.h	Thu Jan  1 01:00:00 1970
234
+++ fam-oss-2.6.4-freebsd/fam/mntent.h	Sat Mar 17 18:11:08 2001
235
@@ -0,0 +1,56 @@
236
+/*
237
+ *  mntent
238
+ *  mntent.h - compatability header for FreeBSD
239
+ *
240
+ *  Copyright (c) 2001 David Rufino <daverufino@btinternet.com>
241
+ *  All rights reserved.
242
+ *
243
+ * Redistribution and use in source and binary forms, with or without
244
+ * modification, are permitted provided that the following conditions
245
+ * are met:
246
+ * 1. Redistributions of source code must retain the above copyright
247
+ *    notice, this list of conditions and the following disclaimer.
248
+ * 2. Redistributions in binary form must reproduce the above copyright
249
+ *    notice, this list of conditions and the following disclaimer in the
250
+ *    documentation and/or other materials provided with the distribution.
251
+ *
252
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
253
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
254
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
255
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
256
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
257
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
258
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
259
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
260
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
262
+ * SUCH DAMAGE.
263
+ */
264
+
265
+#if defined(HAVE_MNTENT_H)
266
+#include <mntent.h>
267
+#else
268
+#ifndef _MNTENT_H
269
+#define _MNTENT_H
270
+#include <stdio.h>
271
+
272
+#define MOUNTED "dummy"
273
+
274
+#define MNTTYPE_NFS "nfs"
275
+
276
+struct mntent {
277
+	char *mnt_fsname;
278
+	char *mnt_dir;
279
+	char *mnt_type;
280
+	char *mnt_opts;
281
+	int mnt_freq;
282
+	int mnt_passno;
283
+};
284
+
285
+#define setmntent(x,y) ((FILE *)0x1)
286
+struct mntent *getmntent __P ((FILE *fp));
287
+char *hasmntopt __P ((const struct mntent *mnt, const char *option));
288
+#define endmntent(x) ((int)1)
289
+
290
+#endif /* _MNTENT_H */
291
+#endif /* HAVE_MNTENT_H */
292
diff -urN fam-oss-2.6.4/fam/mntent_compat.c++ fam-oss-2.6.4-freebsd/fam/mntent_compat.c++
293
--- fam-oss-2.6.4/fam/mntent_compat.c++	Thu Jan  1 01:00:00 1970
294
+++ fam-oss-2.6.4-freebsd/fam/mntent_compat.c++	Sat Mar 17 23:48:07 2001
295
@@ -0,0 +1,151 @@
296
+/*
297
+ * Copyright (c) 1980, 1989, 1993, 1994
298
+ *      The Regents of the University of California.  All rights reserved.
299
+ * Copyright (c) 2001
300
+ *      David Rufino <daverufino@btinternet.com>
301
+ *
302
+ * Redistribution and use in source and binary forms, with or without
303
+ * modification, are permitted provided that the following conditions
304
+ * are met:
305
+ * 1. Redistributions of source code must retain the above copyright
306
+ *    notice, this list of conditions and the following disclaimer.
307
+ * 2. Redistributions in binary form must reproduce the above copyright
308
+ *    notice, this list of conditions and the following disclaimer in the
309
+ *    documentation and/or other materials provided with the distribution.
310
+ * 3. All advertising materials mentioning features or use of this software
311
+ *    must display the following acknowledgement:
312
+ *      This product includes software developed by the University of
313
+ *      California, Berkeley and its contributors.
314
+ * 4. Neither the name of the University nor the names of its contributors
315
+ *    may be used to endorse or promote products derived from this software
316
+ *    without specific prior written permission.
317
+ *
318
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
319
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
320
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
321
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
322
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
323
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
324
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
325
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
326
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
327
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
328
+ * SUCH DAMAGE.
329
+ */
330
+
331
+/* most of this was ripped from the mount(3) source */
332
+
333
+#include "config.h"
334
+#include "mntent.h"
335
+#if !defined(HAVE_MNTENT_H)
336
+#include <stdlib.h>
337
+#include <string.h>
338
+#include <sys/param.h>
339
+#include <sys/ucred.h>
340
+#include <sys/mount.h>
341
+
342
+static int pos = -1;
343
+static int mntsize = -1;
344
+static struct mntent _mntent;
345
+
346
+char *
347
+hasmntopt (const struct mntent *mnt, const char *option)
348
+{
349
+        int found;
350
+        char *opt, *optbuf;
351
+
352
+        optbuf = strdup(mnt->mnt_opts);
353
+        found = 0;
354
+        for (opt = optbuf; (opt = strtok(opt, " ")) != NULL; opt = NULL) {
355
+                if (!strcasecmp(opt, option)) {
356
+			opt = opt - optbuf + mnt->mnt_opts;
357
+			free (optbuf);
358
+			return (opt);
359
+		}
360
+        }
361
+	free (optbuf);
362
+        return (NULL);
363
+}
364
+
365
+static char *
366
+catopt (char *s0, const char *s1)
367
+{
368
+        size_t i;
369
+        char *cp;
370
+
371
+        if (s1 == NULL || *s1 == '\0')
372
+                return s0;
373
+        if (s0 && *s0) {
374
+                i = strlen(s0) + strlen(s1) + 1 + 1;
375
+                if ((cp = (char *)malloc(i)) == NULL)
376
+			return (NULL);
377
+                (void)snprintf(cp, i, "%s %s", s0, s1);
378
+        } else
379
+                cp = strdup(s1);
380
+
381
+        if (s0)
382
+                free(s0);
383
+        return (cp);
384
+}
385
+
386
+
387
+static char *
388
+flags2opts (int flags)
389
+{
390
+        char *res;
391
+        res = NULL;
392
+        res = catopt(res, (flags & MNT_RDONLY) ? "ro" : "rw");
393
+        if (flags & MNT_SYNCHRONOUS)    res = catopt(res, "sync");
394
+        if (flags & MNT_NOEXEC)         res = catopt(res, "noexec");
395
+        if (flags & MNT_NOSUID)         res = catopt(res, "nosuid");
396
+        if (flags & MNT_NODEV)          res = catopt(res, "nodev");
397
+        if (flags & MNT_UNION)          res = catopt(res, "union");
398
+        if (flags & MNT_ASYNC)          res = catopt(res, "async");
399
+        if (flags & MNT_NOATIME)        res = catopt(res, "noatime");
400
+        if (flags & MNT_NOCLUSTERR)     res = catopt(res, "noclusterr");
401
+        if (flags & MNT_NOCLUSTERW)     res = catopt(res, "noclusterw");
402
+        if (flags & MNT_NOSYMFOLLOW)    res = catopt(res, "nosymfollow");
403
+        if (flags & MNT_SUIDDIR)        res = catopt(res, "suiddir");
404
+
405
+        return res;
406
+}
407
+
408
+static struct mntent *
409
+statfs_to_mntent (struct statfs *mntbuf)
410
+{
411
+	static char opts_buf[40], *tmp;
412
+	
413
+	_mntent.mnt_fsname = mntbuf->f_mntfromname;
414
+	_mntent.mnt_dir = mntbuf->f_mntonname;
415
+	_mntent.mnt_type = mntbuf->f_fstypename;
416
+	tmp = flags2opts (mntbuf->f_flags);
417
+	if (tmp) {
418
+		opts_buf[sizeof(opts_buf)-1] = '\0';
419
+		strncpy (opts_buf, tmp, sizeof(opts_buf)-1);
420
+		free (tmp);
421
+	} else {
422
+		*opts_buf = '\0';
423
+	}
424
+	_mntent.mnt_opts = opts_buf;	
425
+	_mntent.mnt_freq = _mntent.mnt_passno = 0;
426
+	return (&_mntent);
427
+}
428
+
429
+struct mntent *
430
+getmntent (FILE *fp)
431
+{
432
+	struct statfs *mntbuf;
433
+
434
+	if (pos == -1 || mntsize == -1)
435
+		mntsize = getmntinfo (&mntbuf, MNT_NOWAIT);
436
+
437
+	++pos;
438
+	if (pos == mntsize) {
439
+		pos = mntsize = -1;
440
+		return (NULL);
441
+	}
442
+
443
+	return (statfs_to_mntent (&mntbuf[pos]));
444
+}
445
+
446
+#endif /* HAVE_MNTENT_H */
447
diff -urN fam-oss-2.6.4/libfam/Client.c++ fam-oss-2.6.4-freebsd/libfam/Client.c++
448
--- fam-oss-2.6.4/libfam/Client.c++	Sat May 20 05:46:32 2000
449
+++ fam-oss-2.6.4-freebsd/libfam/Client.c++	Sat Mar 17 00:12:01 2001
450
@@ -20,6 +20,7 @@
451
 //  with this program; if not, write the Free Software Foundation, Inc., 59
452
 //  Temple Place - Suite 330, Boston MA 02111-1307, USA.
453
 
454
+#include <stdio.h>
455
 #include <stdlib.h>
456
 #include <unistd.h>
457
 #include <netinet/in.h>
458
diff -urN fam-oss-2.6.4/libfam/fam.c++ fam-oss-2.6.4-freebsd/libfam/fam.c++
459
--- fam-oss-2.6.4/libfam/fam.c++	Sat May 20 05:46:32 2000
460
+++ fam-oss-2.6.4-freebsd/libfam/fam.c++	Sat Mar 17 00:12:43 2001
461
@@ -21,6 +21,7 @@
462
 //  Temple Place - Suite 330, Boston MA 02111-1307, USA.
463
 
464
 #include <sys/types.h>
465
+#include <rpc/rpc.h>
466
 #include <sys/time.h>
467
 #include <unistd.h>
468
 #include <stdlib.h>
469
diff -urN fam-oss-2.6.4/test/test.c++ fam-oss-2.6.4-freebsd/test/test.c++
470
--- fam-oss-2.6.4/test/test.c++	Sat May 20 05:46:32 2000
471
+++ fam-oss-2.6.4-freebsd/test/test.c++	Sat Mar 17 18:39:23 2001
472
@@ -1,6 +1,7 @@
473
 #include <sys/types.h>
474
 #include <sys/time.h>
475
 #include <stdio.h>
476
+#include <string.h>
477
 #include <unistd.h>
478
 #include <signal.h>
479
 #include <errno.h>
480
--- fam-oss-2.6.4/acconfig.h	Sat May 20 05:46:31 2000
481
+++ fam-oss-2.6.4-freebsd/acconfig.h	Sun Mar 18 00:40:47 2001
482
@@ -44,6 +44,8 @@
483
 **  Otherwise, we'll use MNTTYPE_NFS.  */
484
 #undef HAVE_FSID_NFS2
485
 
486
+#undef HAVE_MNTENT_H
487
+
488
 /* Define if we have MNTTYPE_NFS2 */
489
 #define HAVE_MNTTYPE_NFS2 0
490
 
(-)files/patch-libfam::Client.c++ (+10 lines)
Added Link Here
1
--- libfam/Client.c++.orig	Fri May 19 23:46:32 2000
2
+++ libfam/Client.c++	Sun Oct  7 15:22:17 2001
3
@@ -20,6 +20,7 @@
4
 //  with this program; if not, write the Free Software Foundation, Inc., 59
5
 //  Temple Place - Suite 330, Boston MA 02111-1307, USA.
6
 
7
+#include <stdio.h>
8
 #include <stdlib.h>
9
 #include <unistd.h>
10
 #include <netinet/in.h>
(-)files/patch-libfam::Makefile.am (+8 lines)
Added Link Here
1
--- libfam/Makefile.am.orig	Fri May 19 23:46:32 2000
2
+++ libfam/Makefile.am	Sun Oct  7 16:28:34 2001
3
@@ -11,4 +11,4 @@
4
 
5
 EXTRA_DIST = fam.sym
6
 
7
-CLEANFILES += ii_files/*.ii
8
+CLEANFILES = ii_files/*.ii
(-)files/patch-libfam::fam.c++ (+10 lines)
Added Link Here
1
--- libfam/fam.c++.orig	Fri May 19 23:46:32 2000
2
+++ libfam/fam.c++	Sun Oct  7 15:22:17 2001
3
@@ -21,6 +21,7 @@
4
 //  Temple Place - Suite 330, Boston MA 02111-1307, USA.
5
 
6
 #include <sys/types.h>
7
+#include <rpc/rpc.h>
8
 #include <sys/time.h>
9
 #include <unistd.h>
10
 #include <stdlib.h>
(-)files/patch-man::Makefile.am (+12 lines)
Added Link Here
1
--- man/Makefile.am.orig	Mon Oct 22 01:33:11 2001
2
+++ man/Makefile.am	Fri Nov 23 10:49:15 2001
3
@@ -1,5 +1,5 @@
4
-#  This is a little weird because fam.1m is generated from fam.1m.in
5
+#  This is a little weird because fam.8 is generated from fam.8.in
6
 #  at the end of the configure script.
7
-man_MANS = fam.1m fam.3x
8
-EXTRA_DIST = fam.1m.in fam.3x
9
-CLEANFILES = fam.1m
10
+man_MANS = fam.8 fam.3
11
+EXTRA_DIST = fam.8.in fam.3
12
+CLEANFILES = fam.8
(-)files/patch-man::fam.1m.in (+76 lines)
Added Link Here
1
--- man/fam.1m.in.orig	Mon Oct 22 01:33:11 2001
2
+++ man/fam.1m.in	Fri Nov 23 10:51:54 2001
3
@@ -1,6 +1,6 @@
4
-.\"##  fam.1m.in
5
+.\"##  fam.8.in
6
 .\"##
7
-.\"##  When configure.in generates fam.1m, lines starting with .\"##
8
+.\"##  When configure.in generates fam.8, lines starting with .\"##
9
 .\"##  should be removed; when building on IRIX, lines starting with
10
 .\"##  .\"IRIX should have that part removed (uncommenting the rest
11
 .\"##  of the line).
12
@@ -9,13 +9,13 @@
13
 .\"##  separate files.
14
 .\"##
15
 .nr X
16
-.if \nX=0 .ds x} fam 1M "Silicon Graphics" "\&"
17
+.if \nX=0 .ds x} fam 8 "Silicon Graphics" "\&"
18
 .TH \*(x}
19
 .SH NAME
20
 fam \- file alteration monitor
21
 .SH SYNOPSIS
22
 .nf
23
-\f3/usr/etc/fam\f1 [ \f3\-f\f1 | \f3\-v\f1 | \f3\-d\f1 ] [ \f3\-l\f1 | \c
24
+\f3fam\f1 [ \f3\-f\f1 | \f3\-v\f1 | \f3\-d\f1 ] [ \f3\-l\f1 | \c
25
 \f3\-t\f1 \f2NFS_polling_interval\f1 ] 
26
 	[ \f3\-T\f1 \f2idle_timeout\f1 ] [ \f3\-p\f1 \c
27
 \f2program\f3.\f2version\f1 ] [ \f3\-L\f1 ] [ \f3-C\f1 ]
28
@@ -24,22 +24,13 @@
29
 .SH DESCRIPTION
30
 \f2fam\f1 is a server that tracks changes to the filesystem and
31
 relays these changes to interested applications.
32
-Applications such as
33
-\f2fm\f1(1G) and \f2mailbox\f1(1) present an up-to-date view of the filesystem.
34
-In the absence of \f2fam\f1, these applications and others like them
35
-are forced to poll the filesystem to detect changes.
36
-\f2fam\f1 is
37
-more efficient.
38
-.P
39
 Applications can request \f2fam\f1 to monitor any files or directories in
40
 any filesystem.
41
 When \f2fam\f1 detects changes to monitored files, it notifies
42
 the appropriate application.
43
 The FAM API provides a programmatic interface to \f2fam\f1; see
44
-.IR fam (3X).
45
+.IR fam (3).
46
 .P
47
-\f2fam\f1 is informed of filesystem changes as they happen by the
48
-kernel through the \f2imon\f1(7M) pseudo device driver.
49
 If asked to
50
 monitor files on an NFS mounted filesystem, \f2fam\f1 tries to use
51
 \f2fam\f1 on the NFS server to monitor files.
52
@@ -47,9 +38,9 @@
53
 contact a remote \f2fam\f1, it polls the files instead.
54
 \f2fam\f1 also polls special files.
55
 .P
56
-Normally, \f2fam\f1 is started by \f2inetd\f1(1M).
57
+Normally, \f2fam\f1 is started by \f2inetd\f1(8).
58
 It is registered with
59
-\f2portmap\f1(1M) as performing the sgi_fam service.
60
+\f2portmap\f1(8) as performing the sgi_fam service.
61
 .SH OPTIONS
62
 .TP 26
63
 \f3\-l\f1
64
@@ -196,9 +187,7 @@
65
 XXX_FAM_CONF
66
 .SH "SEE ALSO"
67
 .\"IRIX fm(1G),
68
-inetd(1M),
69
+fam(3),
70
+inetd(8),
71
 .\"IRIX mailbox(1),
72
-portmap(1M),
73
-fam(3X),
74
-imon(7M),
75
-stat(1M).
76
+portmap(8).
(-)files/patch-man::fam.3x (+38 lines)
Added Link Here
1
--- man/fam.3x.orig	Mon Oct 22 01:33:11 2001
2
+++ man/fam.3x	Fri Nov 23 10:51:07 2001
3
@@ -1,9 +1,9 @@
4
 '\"macro stdmacro
5
-.if n .pH g3x.fam @(#)fam	30.3 of 1/19/86
6
+.if n .pH g3.fam @(#)fam	30.3 of 1/19/86
7
 .nr X
8
-.if \nX=0 .ds x} FAM 3X "Specialized Libraries" "\&"
9
-.if \nX=1 .ds x} FAM 3X "Specialized Libraries"
10
-.if \nX=2 .ds x} FAM 3X "" "\&"
11
+.if \nX=0 .ds x} FAM 3 "Specialized Libraries" "\&"
12
+.if \nX=1 .ds x} FAM 3 "Specialized Libraries"
13
+.if \nX=2 .ds x} FAM 3 "" "\&"
14
 .if \nX=3 .ds x} FAM "" "" "\&"
15
 .TH \*(x}
16
 .SH NAME
17
@@ -65,10 +65,9 @@
18
 .PP
19
 .SH DESCRIPTION
20
 \fIFAM\fP monitors files and directories, notifying interested
21
-applications of changes.  Routines for communicating with the fam(1M)
22
+applications of changes.  Routines for communicating with the fam(8)
23
 server process are found in ``libfam.a'', which is loaded if the
24
-option ``-lfam'' is used with cc(1) or ld(1).  The library
25
-``libC.a'' (``-lC'') must also be specified.
26
+option ``-lfam'' is used with cc(1) or ld(1).
27
 .PP
28
 An application calls routines described here to establish a list of
29
 files for \fIfam \fPto monitor.  \fIFam \fPgenerates events on a socket to
30
@@ -282,7 +281,7 @@
31
 
32
 
33
 .SH SEE ALSO
34
-fam(1M).
35
+fam(8).
36
 .SH BUGS
37
 The FAMMoved event is not currently supported.
38
 .PP
(-)files/patch-support::Makefile.am (+9 lines)
Added Link Here
1
--- support/Makefile.am.orig	Fri May 19 23:46:32 2000
2
+++ support/Makefile.am	Sun Oct  7 16:30:05 2001
3
@@ -11,5 +11,5 @@
4
 libsupport_a_DEPENDENCIES = @snprintf_o@ @foo_o@
5
 libsupport_a_LIBADD       = @snprintf_o@ @foo_o@
6
 
7
-CLEANFILES += @MKDEPFILE@ ii_files/*.ii
8
+CLEANFILES = @MKDEPFILE@ ii_files/*.ii
9
 sinclude @MKDEPFILE@
(-)files/patch-test::Makefile.am (+8 lines)
Added Link Here
1
--- test/Makefile.am.orig	Fri May 19 23:46:32 2000
2
+++ test/Makefile.am	Sun Oct  7 16:29:21 2001
3
@@ -4,4 +4,4 @@
4
 test_SOURCES = test.c++
5
 test_LDADD = ../libfam/libfam.la
6
 
7
-CLEANFILES += ii_files/*.ii
8
+CLEANFILES = ii_files/*.ii
(-)files/patch-test::test.c++ (+10 lines)
Added Link Here
1
--- test/test.c++.orig	Fri May 19 23:46:32 2000
2
+++ test/test.c++	Sun Oct  7 15:22:17 2001
3
@@ -1,6 +1,7 @@
4
 #include <sys/types.h>
5
 #include <sys/time.h>
6
 #include <stdio.h>
7
+#include <string.h>
8
 #include <unistd.h>
9
 #include <signal.h>
10
 #include <errno.h>

Return to bug 32231