in the way to fam 2.7.0
Jose M Rodriguez
josemi at freebsd.jazztel.es
Tue Mar 22 00:20:38 PST 2005
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# .
# ./files
# ./files/IMonKQueue.c++
# ./files/imon-compat.h
# ./files/patch-src_Client.h
# ./files/patch-lib_Client.c++
# ./files/patch-src_NFSFileSystem.h
# ./files/patch-src_LocalFileSystem.h
# ./files/patch-src_Makefile.in
# ./files/patch-configure
# ./files/patch-src_NetConnection.c++
# ./files/patch-src_mntent_compat.c++
# ./files/patch-src_Scheduler.h
# ./files/patch-include_BTree.h
# ./files/patch-src_Listener.c++
# ./files/patch-src_Log.c++
# ./files/patch-src_IMon.c++
# ./files/patch-src_Interest.c++
# ./files/patch-src_FileSystem.c++
# ./files/patch-config.h.in
# ./files/patch-src_FileSystemTable.c++
# ./files/patch-lib_fam.c++
# ./files/patch-conf_Makefile.in
# ./files/patch-src_NFSFileSystem.c++
# ./files/patch-src_InternalClient.c++
# ./files/patch-src_fam-mntent.h
# ./files/patch-src_ServerHost.h
# ./files/patch-src_RPC_TCP_Connector.c++
# ./files/patch-src_FileSystem.h
# ./files/patch-src_LocalFileSystem.c++
# ./Makefile
# ./pkg-descr
# ./pkg-message
# ./distinfo
# ./pkg-plist
#
echo c - .
mkdir -p . > /dev/null 2>&1
echo c - ./files
mkdir -p ./files > /dev/null 2>&1
echo x - ./files/IMonKQueue.c++
sed 's/^X//' >./files/IMonKQueue.c++ << 'END-of-./files/IMonKQueue.c++'
X// $NetBSD: IMonKQueue.c++,v 1.3 2005/01/05 16:21:06 jmmv Exp $
X//
X// Copyright (c) 2004, 2005 Julio M. Merino Vidal.
X//
X// This program is free software; you can redistribute it and/or modify it
X// under the terms of version 2 of the GNU General Public License as
X// published by the Free Software Foundation.
X//
X// This program is distributed in the hope that it would be useful, but
X// WITHOUT ANY WARRANTY; without even the implied warranty of
X// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, any
X// license provided herein, whether implied or otherwise, is limited to
X// this program in accordance with the express provisions of the GNU
X// General Public License. Patent licenses, if any, provided herein do not
X// apply to combinations of this program with other product or programs, or
X// any other product whatsoever. This program is distributed without any
X// warranty that the program is delivered free of the rightful claim of any
X// third person by way of infringement or the like. See the GNU General
X// Public License for more details.
X//
X// You should have received a copy of the GNU General Public License along
X// with this program; if not, write the Free Software Foundation, Inc., 59
X// Temple Place - Suite 330, Boston MA 02111-1307, USA.
X
X// ------------------------------------------------------------------------
X
X// imon emulation through kqueue
X// -----------------------------
X//
X// The code in this file provides an imon-like interface to FAM using kqueue,
X// the kernel event notification mechanism found in FreeBSD, NetBSD and
X// OpenBSD.
X//
X// The idea is the following: a thread, kqueue_monitor, simulates the kernel
X// part of imon. This thread can receive commands (ioctl(2)s) and produces
X// notifications when there is something to notify. The thread is constantly
X// running in the background, calling kevent(2) to see if there are new
X// events in the monitored files since the last call.
X//
X// Communication with kqueue_monitor is accomplished by using two pipes.
X// pipe_out is used by the monitor to provide notifications; i.e., it is the
X// same as the read end of the regular /dev/imon device, and produces
X// compatible messages. On the other hand we have pipe_in, which is used
X// to give commands to the monitor (express and revoke); we can't emulate
X// ioctl(2)s from user space, so we have to go this route.
X//
X// Why we use pipe_in to provide commands to the thread, instead of some
X// mutexes? If we used mutexes, we'd have to give kevent(2) a timeout, to
X// let it "reload" the list of changes to be monitored in case it was
X// externally modified. By using a pipe, we can tell kqueue(2) to monitor
X// it for us, and let kevent(2) immediately return when there is a command
X// to process.
X//
X// However, there is a little problem when using kqueue instead of imon or
X// polling. kqueue(2) works by monitoring open file descriptors, instead
X// of inodes on the disk. Therefore we must keep all files being monitored
X// open, and the number of open files can quickly raise in some environments.
X// This is why the code unlimits the number of open files in imon_open and
X// sets a reasonable maximum based on kern.maxfiles (to avoid overflowing
X// it quickly). If we overflow this limit, the poller will enter the game
X// (because we will return an error).
X//
X// Known problem: if we receive *lots* of events quickly, famd may end up
X// locked. To reproduce, run the test program provided by fam against a
X// local directory, say /tmp/foo, and do the following:
X// cd /tmp/foo; for f in $(jot 1000); do touch $(jot 100); rm *; done
X// You should receive some messages like:
X// famd[21058]: kqueue can't revoke "75", dev = 0, ino = 1113421
X// while the test is running (not a lot), and it will eventually lock up.
X//
X// Having said all this, let's go to the code...
X
X// ------------------------------------------------------------------------
X
X#include "IMon.h"
X#include "Log.h"
X
X#include "config.h"
X#include "imon-compat.h"
X
X#include <sys/event.h>
X#include <sys/param.h>
X#include <sys/resource.h>
X#include <sys/sysctl.h>
X#include <sys/time.h>
X
X#include <assert.h>
X#include <fcntl.h>
X#include <pthread.h>
X#include <string.h>
X#include <unistd.h>
X
X#include <map>
X
X// ------------------------------------------------------------------------
X
X// devino is a structure that holds a device/inode pair. It is used as an
X// indentifier of files managed by imon.
Xstruct devino {
X dev_t di_dev;
X ino_t di_ino;
X
X bool operator<(const struct devino& di) const
X { return (di_dev < di.di_dev) or
X (di_dev == di.di_dev and di_ino < di.di_ino); }
X};
X
X// imon_cmd simulates commands thrown to imon as ioctl(2)s (but remember
X// we use a pipe).
Xstruct imon_cmd {
X#define IMON_CMD_EXPRESS 0
X#define IMON_CMD_REVOKE 1
X int ic_type;
X
X // imon identifies files through a device/inode pair.
X struct devino ic_di;
X
X // A pipe that will be used to receive the result of the command
X // (asynchronously).
X int ic_stat[2];
X
X // If this is an 'express' command, we need the descriptor to monitor.
X int ic_fd;
X};
X
X// ------------------------------------------------------------------------
X
Xstatic int max_changes;
Xstatic int last_change;
Xstatic int kqueue_fd;
Xstatic int pipe_in[2], pipe_out[2];
Xstatic pthread_t kevent_thread;
Xstatic struct kevent *changes;
X
Xtypedef std::map<struct devino, int> DEVINOFD_MAP;
Xstatic DEVINOFD_MAP devino_to_fd;
Xtypedef std::map<int, struct devino> FDDEVINO_MAP;
Xstatic FDDEVINO_MAP fd_to_devino;
X
X// ------------------------------------------------------------------------
X
Xstatic void *kqueue_monitor(void *data);
Xstatic void process_command(void);
X
X// ------------------------------------------------------------------------
X
Xint
XIMon::imon_open(void)
X{
X // Get the kernel event queue. We only need one during all the life
X // of famd.
X kqueue_fd = kqueue();
X if (kqueue_fd == -1)
X return -1;
X
X // Create "emulation" pipes.
X if (pipe(pipe_in) == -1) {
X close(kqueue_fd);
X return -1;
X }
X if (pipe(pipe_out) == -1) {
X close(kqueue_fd);
X close(pipe_in[0]); close(pipe_in[1]);
X return -1;
X }
X
X // Get the maximum number of files we can open and use it to set a
X // limit of the files we can monitor.
X size_t len = sizeof(max_changes);
X if (sysctlbyname("kern.maxfiles", &max_changes, &len, NULL, 0) == -1)
X max_changes = 128;
X else
X max_changes /= 2;
X
X // Unlimit maximum number of open files. We don't go to RLIM_INFINITY
X // to avoid possible open descriptor leaks produce a system DoS. 75%
X // of the system limit seems a good number (we request more than the
X // number calculated previously to leave room for temporary pipes).
X // We need to be root to do this.
X uid_t olduid = geteuid();
X seteuid(0);
X struct rlimit rlp;
X rlp.rlim_cur = rlp.rlim_max = max_changes * 3 / 2;
X if (setrlimit(RLIMIT_NOFILE, &rlp) == -1)
X Log::error("can't unlimit number of open files");
X seteuid(olduid);
X
X changes = new struct kevent[max_changes];
X
X // We must monitor pipe_in for any commands that may alter the actual
X // set of files being monitored.
X EV_SET(&changes[0], pipe_in[0], EVFILT_READ,
X EV_ADD | EV_ENABLE | EV_ONESHOT, 0, 0, 0);
X last_change = 1;
X
X // Create a thread that will run the kevent(2) function continuously.
X if (pthread_create(&kevent_thread, NULL, kqueue_monitor, NULL) != 0) {
X close(kqueue_fd);
X close(pipe_in[0]); close(pipe_in[1]);
X close(pipe_out[0]); close(pipe_out[1]);
X return -1;
X }
X
X return pipe_out[0];
X}
X
X// ------------------------------------------------------------------------
X
XIMon::Status
XIMon::imon_express(const char *name, struct stat *status)
X{
X // Get file information.
X struct stat sb;
X if (status == NULL)
X status = &sb;
X if (lstat(name, status) == -1)
X return BAD;
X
X // Open the file to be monitored; kqueue only works with open descriptors
X // so we have to keep this descriptor during the life of this 'interest'.
X int fd = open(name, O_RDONLY);
X if (fd == -1)
X return BAD;
X
X // Construct a command to 'express' interest in a file. This will be
X // handled by the kqueue_monitor thread as soon as possible.
X struct imon_cmd cmd;
X cmd.ic_type = IMON_CMD_EXPRESS;
X cmd.ic_di.di_dev = status->st_dev;
X cmd.ic_di.di_ino = status->st_ino;
X cmd.ic_fd = fd;
X if (pipe(cmd.ic_stat) == -1) {
X close(fd);
X return BAD;
X }
X write(pipe_in[1], &cmd, sizeof(struct imon_cmd));
X
X // Wait for a result form the previous operation.
X bool result;
X read(cmd.ic_stat[0], &result, sizeof(bool));
X close(cmd.ic_stat[0]); close(cmd.ic_stat[1]);
X if (!result) {
X close(fd);
X Log::error("kqueue can't monitor more than %d files", max_changes);
X return BAD;
X }
X
X Log::debug("told kqueue to monitor \"%s\", descriptor = %d, dev = %d, "
X "ino = %d", name, cmd.ic_fd, cmd.ic_di.di_dev,
X cmd.ic_di.di_ino);
X
X return OK;
X}
X
X// ------------------------------------------------------------------------
X
XIMon::Status
XIMon::imon_revoke(const char *name, dev_t dev, ino_t ino)
X{
X // Construct a command to 'revoke' interest from a file. This will be
X // handled by the kqueue_monitor thread as soon as possible.
X struct imon_cmd cmd;
X cmd.ic_type = IMON_CMD_REVOKE;
X cmd.ic_di.di_dev = dev;
X cmd.ic_di.di_ino = ino;
X if (pipe(cmd.ic_stat) == -1)
X return BAD;
X write(pipe_in[1], &cmd, sizeof(struct imon_cmd));
X
X // Wait for a result form the previous operation.
X bool result;
X read(cmd.ic_stat[0], &result, sizeof(bool));
X close(cmd.ic_stat[0]); close(cmd.ic_stat[1]);
X if (!result) {
X Log::error("kqueue can't revoke \"%s\", dev = %d, ino = %d", name,
X cmd.ic_di.di_dev, cmd.ic_di.di_ino);
X return BAD;
X }
X
X Log::debug("told kqueue to forget \"%s\", dev = %d, ino = %d", name,
X cmd.ic_di.di_dev, cmd.ic_di.di_ino);
X
X return OK;
X}
X
X// ------------------------------------------------------------------------
X
Xstatic void *
Xkqueue_monitor(void *data)
X{
X struct kevent event;
X
X for (;;) {
X int nev = kevent(kqueue_fd, changes, last_change, &event, 1, NULL);
X if (nev == -1)
X Log::perror("kevent");
X else if (nev > 0) {
X assert(nev == 1);
X
X if (event.flags & EV_ERROR) {
X int fd = event.ident;
X
X FDDEVINO_MAP::const_iterator iter = fd_to_devino.find(fd);
X assert(iter != fd_to_devino.end());
X struct devino di = iter->second;
X
X Log::error("kqueue returned error for fd = %d, dev = %d, "
X "ino = %d", fd, di.di_dev, di.di_ino);
X
X // Remove offending entry from the mappings.
X assert(devino_to_fd.find(di) != devino_to_fd.end());
X devino_to_fd.erase(di);
X assert(devino_to_fd.find(di) == devino_to_fd.end());
X assert(fd_to_devino.find(fd) != fd_to_devino.end());
X fd_to_devino.erase(fd);
X assert(fd_to_devino.find(fd) == fd_to_devino.end());
X
X // Remove the entry associated to the descriptor from the list
X // of changes monitored by kqueue.
X int i;
X for (i = 1; i < last_change; i++)
X if (changes[i].ident == fd)
X break;
X for (int j = i; j < last_change - 1; j++)
X changes[j] = changes[j + 1];
X last_change--;
X
X close(fd);
X
X continue;
X }
X
X if (event.ident == pipe_in[0]) {
X // We have got a control command, so process it.
X process_command();
X } else {
X // One of the descriptors we are monitoring has got activity.
X FDDEVINO_MAP::const_iterator iter =
X fd_to_devino.find(event.ident);
X if (iter != fd_to_devino.end()) {
X qelem_t elem;
X
X // Set device/inode identifier on imon element.
X const struct devino &di = (*iter).second;
X elem.qe_dev = di.di_dev;
X elem.qe_inode = di.di_ino;
X
X // Convert the modification flags reported by kqueue to
X // flags understood by imon.
X elem.qe_what = 0;
X if (event.fflags & NOTE_DELETE)
X elem.qe_what |= IMON_DELETE;
X if (event.fflags & NOTE_RENAME)
X elem.qe_what |= IMON_RENAME;
X if (event.fflags & NOTE_ATTRIB or event.fflags & NOTE_LINK)
X elem.qe_what |= IMON_ATTRIBUTE;
X if (event.fflags & NOTE_WRITE or event.fflags & NOTE_EXTEND)
X elem.qe_what |= IMON_CONTENT;
X
X // Deliver the element.
X write(pipe_out[1], &elem, sizeof(qelem_t));
X } else
X Log::error("got an event from an unhandled device/inode "
X "pair");
X }
X }
X }
X}
X
X// ------------------------------------------------------------------------
X
Xstatic void
Xprocess_command(void)
X{
X bool result = false;
X struct imon_cmd cmd;
X
X // Read the command from the control pipe.
X read(pipe_in[0], &cmd, sizeof(struct imon_cmd));
X if (cmd.ic_type == IMON_CMD_EXPRESS) {
X Log::debug("process_command: express, dev = %d, ino = %d",
X cmd.ic_di.di_dev, cmd.ic_di.di_ino);
X if (devino_to_fd.find(cmd.ic_di) != devino_to_fd.end()) {
X // The file is already being monitored.
X close(cmd.ic_fd);
X result = true;
X } else if (fd_to_devino.find(cmd.ic_fd) != fd_to_devino.end()) {
X // We can't receive a new interest of a descriptor that is
X // already being monitored. If this happens, there is an
X // inconsistency in the data somewhere.
X assert(false);
X } else if (last_change < max_changes) {
X // Add the new descriptor to the list of changes to monitor.
X // We watch for any change that happens on it.
X EV_SET(&changes[last_change], cmd.ic_fd, EVFILT_VNODE,
X EV_ADD | EV_ENABLE | EV_ONESHOT,
X NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB |
X NOTE_LINK | NOTE_RENAME | NOTE_REVOKE,
X 0, 0);
X last_change++;
X
X // Map the device/inode pair to the file descriptor associated
X // to it and viceversa. We will need this information during
X // 'revoke' and when we receive events. We use two different
X // maps to speed up searches in both directions later.
X assert(devino_to_fd.find(cmd.ic_di) == devino_to_fd.end());
X devino_to_fd.insert
X (DEVINOFD_MAP::value_type(cmd.ic_di, cmd.ic_fd));
X assert(devino_to_fd.find(cmd.ic_di) != devino_to_fd.end());
X assert(fd_to_devino.find(cmd.ic_fd) == fd_to_devino.end());
X fd_to_devino.insert
X (FDDEVINO_MAP::value_type(cmd.ic_fd, cmd.ic_di));
X assert(fd_to_devino.find(cmd.ic_fd) != fd_to_devino.end());
X
X result = true;
X }
X } else if (cmd.ic_type == IMON_CMD_REVOKE) {
X Log::debug("process_command: revoke, dev = %d, ino = %d",
X cmd.ic_di.di_dev, cmd.ic_di.di_ino);
X DEVINOFD_MAP::const_iterator iter = devino_to_fd.find(cmd.ic_di);
X if (iter != devino_to_fd.end()) {
X // Get the descriptor associated to the given device/inode pair
X // and remove the mapping from the required structure.
X int fd = (*iter).second;
X assert(devino_to_fd.find(cmd.ic_di) != devino_to_fd.end());
X devino_to_fd.erase(cmd.ic_di);
X assert(devino_to_fd.find(cmd.ic_di) == devino_to_fd.end());
X assert(fd_to_devino.find(fd) != fd_to_devino.end());
X fd_to_devino.erase(fd);
X assert(fd_to_devino.find(fd) == fd_to_devino.end());
X
X // Remove the entry associated to the descriptor from the list
X // of changes monitored by kqueue.
X int i;
X for (i = 1; i < last_change; i++)
X if (changes[i].ident == fd)
X break;
X for (int j = i; j < last_change - 1; j++)
X changes[j] = changes[j + 1];
X last_change--;
X
X close(fd);
X
X result = true;
X }
X } else {
X // Huh? Unknown command received.
X assert(false);
X }
X
X // Deliver the result of the operation.
X write(cmd.ic_stat[1], &result, sizeof(bool));
X}
END-of-./files/IMonKQueue.c++
echo x - ./files/imon-compat.h
sed 's/^X//' >./files/imon-compat.h << 'END-of-./files/imon-compat.h'
X// $NetBSD: imon-compat.h,v 1.1 2004/10/17 19:20:53 jmmv Exp $
X//
X// Copyright (c) 2004 Julio M. Merino Vidal.
X//
X// This program is free software; you can redistribute it and/or modify it
X// under the terms of version 2 of the GNU General Public License as
X// published by the Free Software Foundation.
X//
X// This program is distributed in the hope that it would be useful, but
X// WITHOUT ANY WARRANTY; without even the implied warranty of
X// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, any
X// license provided herein, whether implied or otherwise, is limited to
X// this program in accordance with the express provisions of the GNU
X// General Public License. Patent licenses, if any, provided herein do not
X// apply to combinations of this program with other product or programs, or
X// any other product whatsoever. This program is distributed without any
X// warranty that the program is delivered free of the rightful claim of any
X// third person by way of infringement or the like. See the GNU General
X// Public License for more details.
X//
X// You should have received a copy of the GNU General Public License along
X// with this program; if not, write the Free Software Foundation, Inc., 59
X// Temple Place - Suite 330, Boston MA 02111-1307, USA.
X
X#if !defined(IMON_COMPAT_H)
X#define IMON_COMPAT_H
X
X#if defined(HAVE_IMON)
X# error "cannot include imon-compat.h if imon is really present"
X#endif
X
X#if defined(HAVE_KQUEUE)
X#define HAVE_IMON 1
X
Xtypedef int intmask_t;
X
Xtypedef struct {
X dev_t qe_dev;
X ino_t qe_inode;
X intmask_t qe_what;
X} qelem_t;
X
X#define IMON_CONTENT (1 << 0)
X#define IMON_ATTRIBUTE (1 << 1)
X#define IMON_DELETE (1 << 2)
X#define IMON_EXEC (1 << 3)
X#define IMON_EXIT (1 << 4)
X#define IMON_RENAME (1 << 5)
X#define IMON_OVER 0xff
X
X#endif // defined(HAVE_KQUEUE)
X
X#endif // !defined(IMON_COMPAT_H)
END-of-./files/imon-compat.h
echo x - ./files/patch-src_Client.h
sed 's/^X//' >./files/patch-src_Client.h << 'END-of-./files/patch-src_Client.h'
X$NetBSD: patch-bb,v 1.1 2005/01/25 03:30:40 tv Exp $
X
X--- src/Client.h.orig 2003-01-18 09:18:12.000000000 -0500
X+++ src/Client.h
X@@ -25,6 +25,7 @@
X
X #include <sys/types.h>
X #include <netinet/in.h> // for in_addr
X+#include <arpa/inet.h>
X
X #include "Activity.h"
X #include "Boolean.h"
END-of-./files/patch-src_Client.h
echo x - ./files/patch-lib_Client.c++
sed 's/^X//' >./files/patch-lib_Client.c++ << 'END-of-./files/patch-lib_Client.c++'
X$NetBSD: patch-ba,v 1.1 2005/01/25 03:30:40 tv Exp $
X
X--- lib/Client.c++.orig 2005-01-24 22:29:27.000000000 -0500
X+++ lib/Client.c++
X@@ -24,6 +24,7 @@
X #include <stdlib.h>
X #include <unistd.h>
X #include <netinet/in.h>
X+#include <arpa/inet.h>
X #include <sys/un.h>
X #include <sys/socket.h>
X #include <rpc/rpc.h>
END-of-./files/patch-lib_Client.c++
echo x - ./files/patch-src_NFSFileSystem.h
sed 's/^X//' >./files/patch-src_NFSFileSystem.h << 'END-of-./files/patch-src_NFSFileSystem.h'
X$NetBSD: patch-ay,v 1.1 2004/11/19 12:35:22 sketch Exp $
X
X--- src/NFSFileSystem.h.orig 2004-11-08 16:55:10.124688000 +0000
X+++ src/NFSFileSystem.h 2004-11-08 16:55:48.362013000 +0000
X@@ -39,7 +39,11 @@
X
X public:
X
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ NFSFileSystem(const mnttab&);
X+#else
X NFSFileSystem(const mntent&);
X+#endif
X ~NFSFileSystem();
X
X virtual bool dir_entries_scanned() const;
END-of-./files/patch-src_NFSFileSystem.h
echo x - ./files/patch-src_LocalFileSystem.h
sed 's/^X//' >./files/patch-src_LocalFileSystem.h << 'END-of-./files/patch-src_LocalFileSystem.h'
X$NetBSD: patch-aw,v 1.5 2004/11/19 12:35:22 sketch Exp $
X
X--- src/LocalFileSystem.h.orig 2004-11-08 16:53:36.684849000 +0000
X+++ src/LocalFileSystem.h 2004-11-08 16:54:10.095510000 +0000
X@@ -38,7 +38,11 @@
X
X public:
X
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ LocalFileSystem(const mnttab&);
X+#else
X LocalFileSystem(const mntent&);
X+#endif
X
X virtual bool dir_entries_scanned() const;
X virtual int get_attr_cache_timeout() const;
END-of-./files/patch-src_LocalFileSystem.h
echo x - ./files/patch-src_Makefile.in
sed 's/^X//' >./files/patch-src_Makefile.in << 'END-of-./files/patch-src_Makefile.in'
X$NetBSD: patch-au,v 1.5 2004/03/28 22:00:05 minskim Exp $
X
X--- src/Makefile.in.orig 2003-01-19 18:38:44.000000000 -0600
X+++ src/Makefile.in
X@@ -161,6 +161,7 @@ famd_SOURCES = \
X main.c++ \
X timeval.c++ \
X timeval.h \
X+ mntent_compat.c++ \
X @MONITOR_FUNCS at .c++
X
X
X@@ -185,6 +186,7 @@ am_famd_OBJECTS = Activity.$(OBJEXT) Cli
X Scheduler.$(OBJEXT) ServerConnection.$(OBJEXT) \
X ServerHost.$(OBJEXT) ServerHostRef.$(OBJEXT) \
X TCP_Client.$(OBJEXT) main.$(OBJEXT) timeval.$(OBJEXT) \
X+ mntent_compat.$(OBJEXT) \
X @MONITOR_FUNCS at .$(OBJEXT)
X famd_OBJECTS = $(am_famd_OBJECTS)
X famd_LDADD = $(LDADD)
END-of-./files/patch-src_Makefile.in
echo x - ./files/patch-configure
sed 's/^X//' >./files/patch-configure << 'END-of-./files/patch-configure'
X--- configure.orig Wed Nov 26 20:47:26 2003
X+++ configure Mon Mar 21 06:51:51 2005
X@@ -1,6 +1,6 @@
X #! /bin/sh
X # Guess values for system-dependent variables and create Makefiles.
X-# Generated by GNU Autoconf 2.57 for fam 2.7.0-pre1.
X+# Generated by GNU Autoconf 2.57 for fam 2.7.0.
X #
X # Report bugs to <fam at oss.sgi.com>.
X #
X@@ -1128,7 +1128,7 @@
X This file contains any messages produced by compilers while
X running configure, to aid debugging if configure makes a mistake.
X
X-It was created by fam $as_me 2.7.0-pre1, which was
X+It was created by fam $as_me 2.7.0, which was
X generated by GNU Autoconf 2.57. Invocation command line was
X
X $ $0 $@
X@@ -9053,7 +9053,9 @@
X
X
X
X-for ac_header in fcntl.h limits.h linux/imon.h netinet/in.h rpc/rpc.h rpcsvc/mount.h stddef.h stdlib.h string.h syslog.h sys/imon.h sys/param.h sys/select.h sys/statvfs.h sys/syssgi.h sys/time.h sys/types.h sys/un.h unistd.h
X+
X+
X+for ac_header in fcntl.h limits.h linux/imon.h netinet/in.h rpc/rpc.h rpc/rpcent.h rpcsvc/mount.h stddef.h stdlib.h string.h syslog.h sys/filio.h sys/imon.h sys/param.h sys/select.h sys/syssgi.h sys/time.h sys/types.h sys/un.h unistd.h mntent.h sys/mnttab.h sys/sysmacros.h
X do
X as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
X if eval "test \"\${$as_ac_Header+set}\" = set"; then
X@@ -9833,7 +9835,8 @@
X cat confdefs.h >>conftest.$ac_ext
X cat >>conftest.$ac_ext <<_ACEOF
X /* end confdefs.h. */
X-$ac_includes_default
X+#include <sys/socket.h>
X+
X int
X main ()
X {
X@@ -9868,7 +9871,8 @@
X cat confdefs.h >>conftest.$ac_ext
X cat >>conftest.$ac_ext <<_ACEOF
X /* end confdefs.h. */
X-$ac_includes_default
X+#include <sys/socket.h>
X+
X int
X main ()
X {
X@@ -9910,7 +9914,103 @@
X #define HAVE_STRUCT_SOCKADDR_SA_LEN 1
X _ACEOF
X
X-struct sockaddr_un.sun_len
X+
X+fi
X+
X+echo "$as_me:$LINENO: checking for struct sockaddr_un.sun_len" >&5
X+echo $ECHO_N "checking for struct sockaddr_un.sun_len... $ECHO_C" >&6
X+if test "${ac_cv_member_struct_sockaddr_un_sun_len+set}" = set; then
X+ echo $ECHO_N "(cached) $ECHO_C" >&6
X+else
X+ cat >conftest.$ac_ext <<_ACEOF
X+#line $LINENO "configure"
X+/* confdefs.h. */
X+_ACEOF
X+cat confdefs.h >>conftest.$ac_ext
X+cat >>conftest.$ac_ext <<_ACEOF
X+/* end confdefs.h. */
X+#include <sys/types.h>
X+#include <sys/un.h>
X+
X+int
X+main ()
X+{
X+static struct sockaddr_un ac_aggr;
X+if (ac_aggr.sun_len)
X+return 0;
X+ ;
X+ return 0;
X+}
X+_ACEOF
X+rm -f conftest.$ac_objext
X+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
X+ (eval $ac_compile) 2>&5
X+ ac_status=$?
X+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
X+ (exit $ac_status); } &&
X+ { ac_try='test -s conftest.$ac_objext'
X+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
X+ (eval $ac_try) 2>&5
X+ ac_status=$?
X+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
X+ (exit $ac_status); }; }; then
X+ ac_cv_member_struct_sockaddr_un_sun_len=yes
X+else
X+ echo "$as_me: failed program was:" >&5
X+sed 's/^/| /' conftest.$ac_ext >&5
X+
X+cat >conftest.$ac_ext <<_ACEOF
X+#line $LINENO "configure"
X+/* confdefs.h. */
X+_ACEOF
X+cat confdefs.h >>conftest.$ac_ext
X+cat >>conftest.$ac_ext <<_ACEOF
X+/* end confdefs.h. */
X+#include <sys/types.h>
X+#include <sys/un.h>
X+
X+int
X+main ()
X+{
X+static struct sockaddr_un ac_aggr;
X+if (sizeof ac_aggr.sun_len)
X+return 0;
X+ ;
X+ return 0;
X+}
X+_ACEOF
X+rm -f conftest.$ac_objext
X+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
X+ (eval $ac_compile) 2>&5
X+ ac_status=$?
X+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
X+ (exit $ac_status); } &&
X+ { ac_try='test -s conftest.$ac_objext'
X+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
X+ (eval $ac_try) 2>&5
X+ ac_status=$?
X+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
X+ (exit $ac_status); }; }; then
X+ ac_cv_member_struct_sockaddr_un_sun_len=yes
X+else
X+ echo "$as_me: failed program was:" >&5
X+sed 's/^/| /' conftest.$ac_ext >&5
X+
X+ac_cv_member_struct_sockaddr_un_sun_len=no
X+fi
X+rm -f conftest.$ac_objext conftest.$ac_ext
X+fi
X+rm -f conftest.$ac_objext conftest.$ac_ext
X+fi
X+echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockaddr_un_sun_len" >&5
X+echo "${ECHO_T}$ac_cv_member_struct_sockaddr_un_sun_len" >&6
X+if test $ac_cv_member_struct_sockaddr_un_sun_len = yes; then
X+
X+cat >>confdefs.h <<_ACEOF
X+#define HAVE_STRUCT_SOCKADDR_UN_SUN_LEN 1
X+_ACEOF
X+
X+
X fi
X
X
X@@ -10193,7 +10293,7 @@
X
X
X
X-for ac_func in bindresvport _daemonize daemon getgrmember select
X+for ac_func in bindresvport _daemonize daemon getgrmember select unsetenv
X do
X as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
X echo "$as_me:$LINENO: checking for $ac_func" >&5
X@@ -10646,7 +10746,7 @@
X } >&5
X cat >&5 <<_CSEOF
X
X-This file was extended by fam $as_me 2.7.0-pre1, which was
X+This file was extended by fam $as_me 2.7.0, which was
X generated by GNU Autoconf 2.57. Invocation command line was
X
X CONFIG_FILES = $CONFIG_FILES
END-of-./files/patch-configure
echo x - ./files/patch-src_NetConnection.c++
sed 's/^X//' >./files/patch-src_NetConnection.c++ << 'END-of-./files/patch-src_NetConnection.c++'
X$NetBSD: patch-at,v 1.4 2004/11/19 12:35:22 sketch Exp $
X
X--- src/NetConnection.h.orig 2004-11-08 14:44:19.318981000 +0000
X+++ src/NetConnection.h 2004-11-08 14:44:42.403907000 +0000
X@@ -68,6 +68,8 @@
X void ready_for_input(bool);
X int get_fd() const { return fd; }
X
X+ enum { MAXMSGSIZE = PATH_MAX + 40 };
X+
X protected:
X
X virtual bool input_msg(const char *data, unsigned nbytes) = 0;
X@@ -75,7 +77,6 @@
X
X private:
X
X- enum { MAXMSGSIZE = PATH_MAX + 40 };
X typedef u_int32_t Length;
X typedef struct msgList_s {
X char msg[MAXMSGSIZE+5]; // + 4 for 32-bit length, + 1 for overflow
END-of-./files/patch-src_NetConnection.c++
echo x - ./files/patch-src_mntent_compat.c++
sed 's/^X//' >./files/patch-src_mntent_compat.c++ << 'END-of-./files/patch-src_mntent_compat.c++'
X$NetBSD: patch-ap,v 1.8 2004/11/19 12:35:22 sketch Exp $
X
X--- src/mntent_compat.c++.orig 2004-04-30 14:24:58.000000000 +0200
X+++ src/mntent_compat.c++ 2004-04-30 14:28:45.000000000 +0200
X@@ -0,0 +1,191 @@
X+/*
X+ * Copyright (c) 1980, 1989, 1993, 1994
X+ * The Regents of the University of California. All rights reserved.
X+ * Copyright (c) 2001
X+ * David Rufino <daverufino at btinternet.com>
X+ *
X+ * Redistribution and use in source and binary forms, with or without
X+ * modification, are permitted provided that the following conditions
X+ * are met:
X+ * 1. Redistributions of source code must retain the above copyright
X+ * notice, this list of conditions and the following disclaimer.
X+ * 2. Redistributions in binary form must reproduce the above copyright
X+ * notice, this list of conditions and the following disclaimer in the
X+ * documentation and/or other materials provided with the distribution.
X+ * 3. All advertising materials mentioning features or use of this software
X+ * must display the following acknowledgement:
X+ * This product includes software developed by the University of
X+ * California, Berkeley and its contributors.
X+ * 4. Neither the name of the University nor the names of its contributors
X+ * may be used to endorse or promote products derived from this software
X+ * without specific prior written permission.
X+ *
X+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X+ * SUCH DAMAGE.
X+ */
X+
X+/* most of this was ripped from the mount(3) source */
X+
X+#include "config.h"
X+#include "fam-mntent.h"
X+#if !defined(HAVE_MNTENT_H) && !defined(HAVE_SYS_MNTTAB_H)
X+#include <stdlib.h>
X+#include <string.h>
X+#include <sys/param.h>
X+#include <sys/ucred.h>
X+#include <sys/mount.h>
X+#ifdef HAVE_SYS_STATVFS_H
X+# include <sys/statvfs.h>
X+#endif
X+
X+static int pos = -1;
X+static int mntsize = -1;
X+static struct mntent _mntent;
X+
X+char *
X+hasmntopt (const struct mntent *mnt, const char *option)
X+{
X+ int found;
X+ char *opt, *optbuf;
X+
X+ optbuf = strdup(mnt->mnt_opts);
X+ found = 0;
X+ for (opt = optbuf; (opt = strtok(opt, " ")) != NULL; opt = NULL) {
X+ if (!strcasecmp(opt, option)) {
X+ opt = opt - optbuf + mnt->mnt_opts;
X+ free (optbuf);
X+ return (opt);
X+ }
X+ }
X+ free (optbuf);
X+ return (NULL);
X+}
X+
X+static char *
X+catopt (char *s0, const char *s1)
X+{
X+ size_t i;
X+ char *cp;
X+
X+ if (s1 == NULL || *s1 == '\0')
X+ return s0;
X+ if (s0 && *s0) {
X+ i = strlen(s0) + strlen(s1) + 1 + 1;
X+ if ((cp = (char *)malloc(i)) == NULL)
X+ return (NULL);
X+ (void)snprintf(cp, i, "%s %s", s0, s1);
X+ } else
X+ cp = strdup(s1);
X+
X+ if (s0)
X+ free(s0);
X+ return (cp);
X+}
X+
X+
X+static char *
X+flags2opts (int flags)
X+{
X+ char *res;
X+ res = NULL;
X+ res = catopt(res, (flags & MNT_RDONLY) ? "ro" : "rw");
X+ if (flags & MNT_SYNCHRONOUS) res = catopt(res, "sync");
X+ if (flags & MNT_NOEXEC) res = catopt(res, "noexec");
X+ if (flags & MNT_NOSUID) res = catopt(res, "nosuid");
X+ if (flags & MNT_NODEV) res = catopt(res, "nodev");
X+ if (flags & MNT_UNION) res = catopt(res, "union");
X+ if (flags & MNT_ASYNC) res = catopt(res, "async");
X+#ifdef MNT_NOATIME
X+ if (flags & MNT_NOATIME) res = catopt(res, "noatime");
X+#endif
X+#ifdef MNT_NOCLUSTERR
X+ if (flags & MNT_NOCLUSTERR) res = catopt(res, "noclusterr");
X+#endif
X+#ifdef MNT_NOCLUSTERW
X+ if (flags & MNT_NOCLUSTERW) res = catopt(res, "noclusterw");
X+#endif
X+#ifdef MNT_NOSYMFOLLOW
X+ if (flags & MNT_NOSYMFOLLOW) res = catopt(res, "nosymfollow");
X+#endif
X+#ifdef MNT_SUIDDIR
X+ if (flags & MNT_SUIDDIR) res = catopt(res, "suiddir");
X+#endif
X+#ifdef MNT_NOCOREDUMP
X+ if (flags & MNT_NOCOREDUMP) res = catopt(res, "nocoredump");
X+#endif
X+#ifdef MNT_IGNORE
X+ if (flags & MNT_IGNORE) res = catopt(res, "hidden");
X+#endif
X+#ifdef MNT_SYMPERM
X+ if (flags & MNT_SYMPERM) res = catopt(res, "symperm");
X+#endif
X+#ifdef MNT_NODEVMTIME
X+ if (flags & MNT_NODEVMTIME) res = catopt(res, "nodevmtime");
X+#endif
X+#ifdef MNT_SOFTDEP
X+ if (flags & MNT_SOFTDEP) res = catopt(res, "softdep");
X+#endif
X+
X+ return res;
X+}
X+
X+static struct mntent *
X+#ifdef HAVE_SYS_STATVFS_H
X+statfs_to_mntent (struct statvfs *mntbuf)
X+#else
X+statfs_to_mntent (struct statfs *mntbuf)
X+#endif
X+{
X+ static char opts_buf[40], *tmp;
X+
X+ _mntent.mnt_fsname = mntbuf->f_mntfromname;
X+ _mntent.mnt_dir = mntbuf->f_mntonname;
X+ _mntent.mnt_type = mntbuf->f_fstypename;
X+#ifdef HAVE_SYS_STATVFS_H
X+ tmp = flags2opts (mntbuf->f_flag);
X+#else
X+ tmp = flags2opts (mntbuf->f_flags);
X+#endif
X+ if (tmp) {
X+ opts_buf[sizeof(opts_buf)-1] = '\0';
X+ strncpy (opts_buf, tmp, sizeof(opts_buf)-1);
X+ free (tmp);
X+ } else {
X+ *opts_buf = '\0';
X+ }
X+ _mntent.mnt_opts = opts_buf;
X+ _mntent.mnt_freq = _mntent.mnt_passno = 0;
X+ return (&_mntent);
X+}
X+
X+struct mntent *
X+getmntent (FILE *fp)
X+{
X+#ifdef HAVE_SYS_STATVFS_H
X+ static struct statvfs *mntbuf;
X+#else
X+ static struct statfs *mntbuf;
X+#endif
X+
X+ if (pos == -1 || mntsize == -1)
X+ mntsize = getmntinfo (&mntbuf, MNT_NOWAIT);
X+
X+ ++pos;
X+ if (pos == mntsize) {
X+ pos = mntsize = -1;
X+ return (NULL);
X+ }
X+
X+ return (statfs_to_mntent (&mntbuf[pos]));
X+}
X+
X+#endif /* HAVE_MNTENT_H */
END-of-./files/patch-src_mntent_compat.c++
echo x - ./files/patch-src_Scheduler.h
sed 's/^X//' >./files/patch-src_Scheduler.h << 'END-of-./files/patch-src_Scheduler.h'
X$NetBSD: patch-an,v 1.4 2004/11/19 12:35:22 sketch Exp $
X
X--- src/Scheduler.h.orig 2004-11-08 14:42:30.148229000 +0000
X+++ src/Scheduler.h 2004-11-08 14:43:04.014844000 +0000
X@@ -88,8 +88,6 @@
X static void loop() { running = true;
X while (running) select(); }
X
X-private:
X-
X // Per-filedescriptor info is the set of three handlers and their
X // closures.
X
END-of-./files/patch-src_Scheduler.h
echo x - ./files/patch-include_BTree.h
sed 's/^X//' >./files/patch-include_BTree.h << 'END-of-./files/patch-include_BTree.h'
X$NetBSD: patch-al,v 1.4 2004/11/19 12:35:22 sketch Exp $
X
X--- include/BTree.h.orig 2004-11-08 14:39:58.687960000 +0000
X+++ include/BTree.h 2004-11-08 14:40:32.481144000 +0000
X@@ -76,8 +76,6 @@
X
X static unsigned sizeofnode() { return sizeof (Node); }
X
X-private:
X-
X enum { fanout = 32 };
X enum Status { OK, NO, OVER, UNDER };
X
END-of-./files/patch-include_BTree.h
echo x - ./files/patch-src_Listener.c++
sed 's/^X//' >./files/patch-src_Listener.c++ << 'END-of-./files/patch-src_Listener.c++'
X$NetBSD: patch-aj,v 1.6 2004/04/18 17:11:08 jmmv Exp $
X
X--- src/Listener.c++.orig 2003-01-20 01:37:29.000000000 +0100
X+++ src/Listener.c++
X@@ -22,6 +22,8 @@
X
X #include "Listener.h"
X
X+#include <stdio.h>
X+#include <stdlib.h>
X #include <assert.h>
X #include <fcntl.h>
X #include <sys/types.h>
X@@ -32,6 +34,7 @@
X #include <rpc/clnt.h>
X #include <sys/ioctl.h>
X #include <sys/socket.h>
X+#include <sys/param.h>
X #include <sys/stat.h>
X #include <sys/un.h>
X #include <unistd.h>
X@@ -205,11 +208,11 @@ Listener::create_local_client(TCP_Client
X #ifdef HAVE_UNSETENV
X unsetenv("TMPDIR");
X #else
X- putenv("TMPDIR=");
X+ putenv("TMPDIR=/tmp");
X #endif
X
X char *tmpfile = tempnam("/tmp", ".fam");
X-#ifdef HAVE_SOCKADDR_SUN_LEN
X+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
X sockaddr_un sun = { sizeof(sockaddr_un), AF_UNIX, "" };
X #else
X sockaddr_un sun = { AF_UNIX, "" };
X@@ -283,7 +286,7 @@ Listener::accept_localclient(int ofd, vo
X
X // Get the new socket.
X
X-#ifdef HAVE_SOCKADDR_SUN_LEN
X+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
X struct sockaddr_un sun = { sizeof(sockaddr_un), AF_UNIX, "" };
X #else
X struct sockaddr_un sun = { AF_UNIX, "" };
X@@ -349,7 +352,7 @@ Listener::accept_localclient(int ofd, vo
X void
X Listener::dirty_ugly_hack()
X {
X-#ifdef HAVE_SOCKADDR_SUN_LEN
X+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
X static sockaddr_un sun = { sizeof (sockaddr_un), AF_UNIX, "/tmp/.fam_socket" };
X #else
X static sockaddr_un sun = { AF_UNIX, "/tmp/.fam_socket" };
END-of-./files/patch-src_Listener.c++
echo x - ./files/patch-src_Log.c++
sed 's/^X//' >./files/patch-src_Log.c++ << 'END-of-./files/patch-src_Log.c++'
X$NetBSD: patch-ak,v 1.5 2004/04/14 20:53:08 adam Exp $
X
X--- src/Log.c++.orig Wed Apr 14 22:44:49 2004
X+++ src/Log.c++
X@@ -28,9 +28,9 @@
X #include <stdlib.h>
X #include <string.h>
X #include <syslog.h>
X+#include <sys/time.h>
X #include <sys/resource.h>
X #include <sys/stat.h>
X-#include <sys/time.h>
X #include <sys/types.h>
X #include <unistd.h>
X #ifdef HAVE_AUDIT
END-of-./files/patch-src_Log.c++
echo x - ./files/patch-src_IMon.c++
sed 's/^X//' >./files/patch-src_IMon.c++ << 'END-of-./files/patch-src_IMon.c++'
X$NetBSD: patch-ag,v 1.6 2004/11/19 12:35:22 sketch Exp $
X
X--- src/IMon.c++.orig 2003-01-18 14:18:12.000000000 +0000
X+++ src/IMon.c++ 2004-11-08 14:00:46.523526000 +0000
X@@ -25,6 +25,7 @@
X #include <assert.h>
X #include <errno.h>
X #include <fcntl.h>
X+#include <sys/param.h>
X
X #if HAVE_IMON
X #ifdef __sgi
X@@ -32,15 +33,18 @@
X #else
X #include <linux/imon.h>
X #endif
X+#else // HAVE_IMON
X+#include "imon-compat.h"
X #endif
X
X+#if HAVE_SYS_SYSMACROS_H
X #include <sys/sysmacros.h>
X+#endif
X #include <unistd.h>
X
X #include "Interest.h"
X #include "Log.h"
X #include "Scheduler.h"
X-#include "alloc.h"
X
X int IMon::imonfd = -2;
X IMon::EventHandler IMon::ehandler = NULL;
END-of-./files/patch-src_IMon.c++
echo x - ./files/patch-src_Interest.c++
sed 's/^X//' >./files/patch-src_Interest.c++ << 'END-of-./files/patch-src_Interest.c++'
X$NetBSD: patch-ah,v 1.5 2004/11/19 12:35:22 sketch Exp $
X
X--- src/Interest.c++.orig 2003-01-18 08:18:12.000000000 -0600
X+++ src/Interest.c++
X@@ -23,7 +23,9 @@
X #include "Interest.h"
X
X #include <sys/param.h>
X+#if HAVE_SYS_SYSMACROS_H
X #include <sys/sysmacros.h>
X+#endif
X
X #include <errno.h>
X #include <string.h>
X@@ -46,7 +48,7 @@
X #include "Pollster.h"
X #include "timeval.h"
X
X-Interest *Interest::hashtable[];
X+Interest *Interest::hashtable[HASHSIZE];
X IMon Interest::imon(imon_handler);
X bool Interest::xtab_verification = true;
X
END-of-./files/patch-src_Interest.c++
echo x - ./files/patch-src_FileSystem.c++
sed 's/^X//' >./files/patch-src_FileSystem.c++ << 'END-of-./files/patch-src_FileSystem.c++'
X$NetBSD: patch-ae,v 1.4 2004/11/19 12:35:22 sketch Exp $
X
X--- src/FileSystem.c++.orig 2003-01-18 14:18:12.000000000 +0000
X+++ src/FileSystem.c++ 2004-11-08 15:39:34.558377000 +0000
X@@ -22,14 +22,20 @@
X
X #include "FileSystem.h"
X
X-#include <mntent.h>
X+#include "fam-mntent.h"
X #include <string.h>
X
X #include "Event.h"
X
X+#if defined(HAVE_SYS_MNTTAB_H)
X+FileSystem::FileSystem(const mnttab& mnt)
X+ : mydir (strcpy(new char[strlen(mnt.mnt_mountp) + 1], mnt.mnt_mountp)),
X+ myfsname(strcpy(new char[strlen(mnt.mnt_special) + 1], mnt.mnt_special))
X+#else
X FileSystem::FileSystem(const mntent& mnt)
X : mydir (strcpy(new char[strlen(mnt.mnt_dir ) + 1], mnt.mnt_dir )),
X myfsname(strcpy(new char[strlen(mnt.mnt_fsname) + 1], mnt.mnt_fsname))
X+#endif
X { }
X
X FileSystem::~FileSystem()
X@@ -40,9 +46,15 @@
X }
X
X bool
X+#if defined(HAVE_SYS_MNTTAB_H)
X+FileSystem::matches(const mnttab& mnt) const
X+{
X+ return !strcmp(mydir, mnt.mnt_mountp) && !strcmp(myfsname, mnt.mnt_special);
X+#else
X FileSystem::matches(const mntent& mnt) const
X {
X return !strcmp(mydir, mnt.mnt_dir) && !strcmp(myfsname, mnt.mnt_fsname);
X+#endif
X }
X
X void
END-of-./files/patch-src_FileSystem.c++
echo x - ./files/patch-config.h.in
sed 's/^X//' >./files/patch-config.h.in << 'END-of-./files/patch-config.h.in'
X$NetBSD: patch-ab,v 1.6 2005/03/14 22:40:09 tv Exp $
X
X--- config.h.in.orig 2003-01-19 18:40:15.000000000 -0600
X+++ config.h.in
X@@ -49,9 +49,15 @@
X /* Define to 1 if you have the <rpc/rpc.h> header file. */
X #undef HAVE_RPC_RPC_H
X
X+/* Define to 1 if you have the <rpc/rpcent.h> header file. */
X+#undef HAVE_RPC_RPCENT_H
X+
X /* Define to 1 if you have the `select' function. */
X #undef HAVE_SELECT
X
X+/* Define to 1 if you have the `unsetenv' function. */
X+#undef HAVE_UNSETENV
X+
X /* Define to 1 if the system has the type `socklen_t'. */
X #undef HAVE_SOCKLEN_T
X
X@@ -76,6 +82,9 @@
X /* Define to 1 if `sa_len' is member of `struct sockaddr'. */
X #undef HAVE_STRUCT_SOCKADDR_SA_LEN
X
X+/* Define to 1 if `sun_len' is member of `struct sockaddr_un'. */
X+#undef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
X+
X /* Define to 1 if you have the <syslog.h> header file. */
X #undef HAVE_SYSLOG_H
X
X@@ -83,6 +92,9 @@
X */
X #undef HAVE_SYS_DIR_H
X
X+/* Define to 1 if you have the <sys/filio.h> header file. */
X+#undef HAVE_SYS_FILIO_H
X+
X /* Define to 1 if you have the <sys/imon.h> header file. */
X #undef HAVE_SYS_IMON_H
X
X@@ -120,6 +132,15 @@
X /* Define to 1 if you have the <unistd.h> header file. */
X #undef HAVE_UNISTD_H
X
X+/* Define to 1 if you have the <mntent.h> header file. */
X+#undef HAVE_MNTENT_H
X+
X+/* Define to 1 if you have the <sys/mnttab.h> header file. */
X+#undef HAVE_SYS_MNTTAB_H
X+
X+/* Define to 1 if you have the <sys/sysmacros.h> header file. */
X+#undef HAVE_SYS_SYSMACROS_H
X+
X /* Define to 1 if the system has the type `_Bool'. */
X #undef HAVE__BOOL
X
X@@ -180,3 +201,9 @@
X
X /* Define to `int' if <sys/types.h> doesn't define. */
X #undef uid_t
X+
X+/* Use standard POSIX type if BSD type is not available */
X+#if !defined(u_int32_t) && defined(HAVE_INTTYPES_H)
X+#include <inttypes.h>
X+typedef uint32_t u_int32_t;
X+#endif
END-of-./files/patch-config.h.in
echo x - ./files/patch-src_FileSystemTable.c++
sed 's/^X//' >./files/patch-src_FileSystemTable.c++ << 'END-of-./files/patch-src_FileSystemTable.c++'
X$NetBSD: patch-af,v 1.4 2004/11/19 12:35:22 sketch Exp $
X
X--- src/FileSystemTable.c++.orig 2003-01-18 14:18:12.000000000 +0000
X+++ src/FileSystemTable.c++ 2004-11-08 17:08:21.655221000 +0000
X@@ -21,11 +21,13 @@
X // Temple Place - Suite 330, Boston MA 02111-1307, USA.
X
X #include <stddef.h>
X+#include <stdio.h>
X #include "FileSystemTable.h"
X
X-#include <mntent.h>
X+#include "fam-mntent.h"
X #include <stdlib.h>
X #include <string.h>
X+#include <sys/param.h>
X
X #if HAVE_STATVFS
X #include <sys/statvfs.h>
X@@ -106,7 +108,11 @@
X
X // Read /etc/mtab.
X Cred::SuperUser.become_user();
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ FILE *mtab = fopen(mtab_name, "r");
X+#else
X FILE *mtab = setmntent(mtab_name, "r");
X+#endif
X if(mtab == NULL)
X {
X Log::error("couldn't open %s for reading", mtab_name);
X@@ -114,40 +120,86 @@
X return;
X }
X root = NULL;
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ resetmnttab(mtab);
X+ int ret = 0;
X+ do
X+#else
X for (mntent *mp; ((mp = getmntent(mtab)) != NULL); )
X+#endif
X {
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ struct mnttab ment, *mp;
X+ mp = &ment;
X+ ret = getmntent(mtab, mp);
X+ FileSystem *fs = fs_by_name ? fs_by_name->find(mp->mnt_mountp) : NULL;
X+#else
X FileSystem *fs = fs_by_name ? fs_by_name->find(mp->mnt_dir) : NULL;
X+#endif
X if (fs && fs->matches(*mp))
X {
X Log::debug("mtab: MATCH \"%s\" on \"%s\" using type <%s>",
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ mp->mnt_special, mp->mnt_mountp, mp->mnt_fstype);
X+
X+ new_fs_by_name->insert(mp->mnt_mountp, fs);
X+ if (dismounted_fses.find(mp->mnt_mountp))
X+ dismounted_fses.remove(mp->mnt_mountp);
X+#else
X mp->mnt_fsname, mp->mnt_dir, mp->mnt_type);
X
X new_fs_by_name->insert(mp->mnt_dir, fs);
X if (dismounted_fses.find(mp->mnt_dir))
X dismounted_fses.remove(mp->mnt_dir);
X+#endif
X }
X else
X {
X
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ if ((!strcmp(mp->mnt_fstype, MNTTYPE_NFS)
X+#else
X if ((!strcmp(mp->mnt_type, MNTTYPE_NFS)
X+#endif
X #if HAVE_MNTTYPE_NFS2
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ || !strcmp(mp->mnt_fstype, MNTTYPE_NFS2)
X+#else
X || !strcmp(mp->mnt_type, MNTTYPE_NFS2)
X #endif
X+#endif
X #if HAVE_MNTTYPE_NFS3
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ || !strcmp(mp->mnt_fstype, MNTTYPE_NFS3)
X+#else
X || !strcmp(mp->mnt_type, MNTTYPE_NFS3)
X #endif
X+#endif
X #if HAVE_MNTTYPE_CACHEFS
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ || !strcmp(mp->mnt_fstype, MNTTYPE_CACHEFS)
X+#else
X || !strcmp(mp->mnt_type, MNTTYPE_CACHEFS)
X #endif
X+#endif
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ ) && strchr(mp->mnt_special, ':'))
X+#else
X ) && strchr(mp->mnt_fsname, ':'))
X+#endif
X {
X if(Log::get_level() == Log::DEBUG)
X {
X const char *mntopt = hasmntopt(mp, "dev");
X if(mntopt == NULL) mntopt = "";
X Log::debug("mtab: new NFS \"%s\" on \"%s\" %s using <%s>",
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ mp->mnt_special, mp->mnt_mountp, mntopt,
X+ mp->mnt_fstype);
X+#else
X mp->mnt_fsname, mp->mnt_dir, mntopt,
X mp->mnt_type);
X+#endif
X }
X
X fs = new NFSFileSystem(*mp);
X@@ -155,24 +207,45 @@
X else
X {
X Log::debug("mtab: new local \"%s\" on \"%s\"",
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ mp->mnt_special, mp->mnt_mountp);
X+#else
X mp->mnt_fsname, mp->mnt_dir);
X+#endif
X
X fs = new LocalFileSystem(*mp);
X }
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ new_fs_by_name->insert(mp->mnt_mountp, fs);
X+#else
X new_fs_by_name->insert(mp->mnt_dir, fs);
X+#endif
X if (fs_by_name)
X {
X // Find parent filesystem.
X
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ FileSystem *parent = longest_prefix(mp->mnt_mountp);
X+#else
X FileSystem *parent = longest_prefix(mp->mnt_dir);
X+#endif
X assert(parent);
X mount_parents.insert(parent->dir(), parent);
X }
X }
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ if (!strcmp(mp->mnt_mountp, "/"))
X+#else
X if (!strcmp(mp->mnt_dir, "/"))
X+#endif
X root = fs;
X }
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ while (ret != -1);
X+ fclose(mtab);
X+#else
X endmntent(mtab);
X+#endif
X
X if(root == NULL)
X {
X@@ -255,7 +328,10 @@
X // create_fs_by_name initializes our "root" member variable.
X if (!fs_by_name)
X { create_fs_by_name();
X+#if !defined(BSD)
X+ /* there is no mtab "file" in BSD */
X mtab_watcher = new InternalClient(mtab_name, mtab_event_handler, NULL);
X+#endif
X }
X
X cr.become_user();
END-of-./files/patch-src_FileSystemTable.c++
echo x - ./files/patch-lib_fam.c++
sed 's/^X//' >./files/patch-lib_fam.c++ << 'END-of-./files/patch-lib_fam.c++'
X$NetBSD: patch-am,v 1.6 2005/03/01 23:06:55 dmcmahill Exp $
X
X--- lib/fam.c++.orig 2003-01-18 08:18:12.000000000 -0600
X+++ lib/fam.c++
X@@ -20,8 +20,12 @@
X // with this program; if not, write the Free Software Foundation, Inc., 59
X // Temple Place - Suite 330, Boston MA 02111-1307, USA.
X
X+#include "config.h"
X #include <sys/types.h>
X #include <rpc/rpc.h>
X+#ifdef HAVE_RPC_RPCENT_H
X+#include <rpc/rpcent.h>
X+#endif
X #include <sys/time.h>
X #include <unistd.h>
X #include <stdlib.h>
END-of-./files/patch-lib_fam.c++
echo x - ./files/patch-conf_Makefile.in
sed 's/^X//' >./files/patch-conf_Makefile.in << 'END-of-./files/patch-conf_Makefile.in'
X$NetBSD: patch-ac,v 1.4 2004/03/28 22:01:54 minskim Exp $
X
X--- conf/Makefile.in.orig 2004-03-21 12:13:33.000000000 -0600
X+++ conf/Makefile.in
X@@ -25,7 +25,7 @@ bindir = @bindir@
X sbindir = @sbindir@
X libexecdir = @libexecdir@
X datadir = @datadir@
X-sysconfdir = @sysconfdir@
X+sysconfdir = @datadir@/examples/@PACKAGE@
X sharedstatedir = @sharedstatedir@
X localstatedir = @localstatedir@
X libdir = @libdir@
END-of-./files/patch-conf_Makefile.in
echo x - ./files/patch-src_NFSFileSystem.c++
sed 's/^X//' >./files/patch-src_NFSFileSystem.c++ << 'END-of-./files/patch-src_NFSFileSystem.c++'
X$NetBSD: patch-ad,v 1.5 2004/11/19 12:35:22 sketch Exp $
X
X--- src/NFSFileSystem.c++.orig 2003-01-18 14:18:12.000000000 +0000
X+++ src/NFSFileSystem.c++ 2004-11-08 17:31:41.663685000 +0000
X@@ -24,7 +24,7 @@
X #include "NFSFileSystem.h"
X
X #include <assert.h>
X-#include <mntent.h>
X+#include "fam-mntent.h"
X #include <stdlib.h>
X #include <stdio.h>
X #include <string.h>
X@@ -41,12 +41,20 @@
X #define ACREGMIN 3
X #endif
X
X+#if defined(HAVE_SYS_MNTTAB_H)
X+NFSFileSystem::NFSFileSystem(const mnttab& mnt)
X+#else
X NFSFileSystem::NFSFileSystem(const mntent& mnt)
X+#endif
X : FileSystem(mnt)
X {
X // Extract the host name from the fs name.
X
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ const char *fsname = mnt.mnt_special;
X+#else
X const char *fsname = mnt.mnt_fsname;
X+#endif
X const char *colon = strchr(fsname, ':');
X if(colon == NULL)
X {
X@@ -55,12 +63,12 @@
X assert(colon);
X colon = fsname;
X }
X- char hostname[NAME_MAX + 1];
X+ char hostname[MAXPATHLEN + 1];
X int hostnamelen = colon - fsname;
X- if(hostnamelen > NAME_MAX)
X+ if(hostnamelen > MAXPATHLEN)
X {
X- assert(hostnamelen <= NAME_MAX);
X- hostnamelen = NAME_MAX;
X+ assert(hostnamelen <= MAXPATHLEN);
X+ hostnamelen = MAXPATHLEN;
X }
X strncpy(hostname, fsname, hostnamelen);
X hostname[hostnamelen] = '\0';
X@@ -84,7 +92,11 @@
X // acregmin, acregmax, actimeo, and noac options in the mount
X // options. Otherwise, use defaults.
X
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ const char * opt = mnt.mnt_mntopts;
X+#else
X const char * opt = mnt.mnt_opts;
X+#endif
X
X bool f_noac = false;
X bool f_actimeo = false;
X@@ -102,20 +114,20 @@
X if (strstr(opt, "noac")) {
X f_noac = true;
X }
X- if ((p = strstr(opt, "actimeo")))
X+ if ((p = strstr((char *)opt, "actimeo")))
X {
X if (sscanf(p, "actimeo=%i", &actimeo) == 1) {
X f_actimeo = true;
X }
X }
X
X- if ((p = strstr(opt, "acregmin"))) {
X+ if ((p = strstr((char *)opt, "acregmin"))) {
X if (sscanf(p, "acregmin=%i", &acregmin) == 1) {
X f_acregmin = true;
X }
X }
X
X- if ((p = strstr(opt, "acregmax"))) {
X+ if ((p = strstr((char *)opt, "acregmax"))) {
X if (sscanf(p, "acregmax=%i", &acregmax) == 1) {
X f_acregmax = true;
X }
END-of-./files/patch-src_NFSFileSystem.c++
echo x - ./files/patch-src_InternalClient.c++
sed 's/^X//' >./files/patch-src_InternalClient.c++ << 'END-of-./files/patch-src_InternalClient.c++'
X$NetBSD: patch-ai,v 1.3 2004/03/28 22:00:05 minskim Exp $
X
X--- src/InternalClient.c++.orig 2003-01-18 08:18:12.000000000 -0600
X+++ src/InternalClient.c++
X@@ -35,8 +35,8 @@ InternalClient::InternalClient(const cha
X {
X assert(filename);
X assert(h);
X- assert(filename[0] == '/');
X Log::debug("%s watching %s", name(), filename);
X+ assert(filename[0] == '/');
X interest = new File(filename, this, Request(0), Cred::SuperUser);
X }
X
END-of-./files/patch-src_InternalClient.c++
echo x - ./files/patch-src_fam-mntent.h
sed 's/^X//' >./files/patch-src_fam-mntent.h << 'END-of-./files/patch-src_fam-mntent.h'
X$NetBSD: patch-ao,v 1.4 2004/11/19 12:35:22 sketch Exp $
X
X--- src/fam-mntent.h.orig Sun May 12 19:15:01 2002
X+++ src/fam-mntent.h
X@@ -0,0 +1,62 @@
X+/*
X+ * mntent
X+ * fam-mntent.h - compatability header for BSD
X+ *
X+ * Copyright (c) 2001 David Rufino <daverufino at btinternet.com>
X+ * All rights reserved.
X+ *
X+ * Redistribution and use in source and binary forms, with or without
X+ * modification, are permitted provided that the following conditions
X+ * are met:
X+ * 1. Redistributions of source code must retain the above copyright
X+ * notice, this list of conditions and the following disclaimer.
X+ * 2. Redistributions in binary form must reproduce the above copyright
X+ * notice, this list of conditions and the following disclaimer in the
X+ * documentation and/or other materials provided with the distribution.
X+ *
X+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X+ * SUCH DAMAGE.
X+ */
X+
X+#if defined(HAVE_MNTENT_H)
X+#include <mntent.h>
X+#elif defined(HAVE_SYS_MNTTAB_H)
X+#include <stdio.h>
X+#include <unistd.h>
X+#include <sys/mntent.h>
X+#include <sys/mnttab.h>
X+#define MOUNTED MNTTAB
X+#else
X+#ifndef _MNTENT_H
X+#define _MNTENT_H
X+#include <stdio.h>
X+
X+#define MOUNTED "dummy"
X+
X+#define MNTTYPE_NFS "nfs"
X+
X+struct mntent {
X+ char *mnt_fsname;
X+ char *mnt_dir;
X+ char *mnt_type;
X+ char *mnt_opts;
X+ int mnt_freq;
X+ int mnt_passno;
X+};
X+
X+#define setmntent(x,y) ((FILE *)0x1)
X+struct mntent *getmntent __P ((FILE *fp));
X+char *hasmntopt __P ((const struct mntent *mnt, const char *option));
X+#define endmntent(x) ((int)1)
X+
X+#endif /* _MNTENT_H */
X+#endif /* HAVE_MNTENT_H */
END-of-./files/patch-src_fam-mntent.h
echo x - ./files/patch-src_ServerHost.h
sed 's/^X//' >./files/patch-src_ServerHost.h << 'END-of-./files/patch-src_ServerHost.h'
X$NetBSD: patch-aq,v 1.4 2004/11/19 12:35:22 sketch Exp $
X
X--- src/ServerHost.h.orig 2003-01-18 14:18:12.000000000 +0000
X+++ src/ServerHost.h 2004-11-08 13:45:49.261211000 +0000
X@@ -24,6 +24,7 @@
X #define ServerHost_included
X
X #include <limits.h>
X+#include <stdio.h>
X #include "Boolean.h"
X #include "ClientInterest.h"
X #include "RequestMap.h"
X@@ -101,7 +102,7 @@
X private:
X
X Request myrequest;
X- char mypath[NAME_MAX];
X+ char mypath[MAXPATHLEN];
X
X };
X
END-of-./files/patch-src_ServerHost.h
echo x - ./files/patch-src_RPC_TCP_Connector.c++
sed 's/^X//' >./files/patch-src_RPC_TCP_Connector.c++ << 'END-of-./files/patch-src_RPC_TCP_Connector.c++'
X$NetBSD: patch-as,v 1.5 2004/12/09 18:45:32 minskim Exp $
X
X--- src/RPC_TCP_Connector.c++.orig 2003-01-18 08:18:12.000000000 -0600
X+++ src/RPC_TCP_Connector.c++
X@@ -21,11 +21,23 @@
X // Temple Place - Suite 330, Boston MA 02111-1307, USA.
X
X #include "RPC_TCP_Connector.h"
X+#include "config.h"
X+
X+#define PORTMAP
X
X #include <errno.h>
X+#ifdef __SUNPRO_CC
X+extern "C" {
X+#endif
X #include <rpc/rpc.h>
X #include <rpc/pmap_prot.h>
X+#ifdef __SUNPRO_CC
X+}
X+#endif
X #include <sys/ioctl.h>
X+#ifdef HAVE_SYS_FILIO_H
X+#include <sys/filio.h>
X+#endif
X #include <sys/socket.h>
X #include <unistd.h>
X #include <string.h>
END-of-./files/patch-src_RPC_TCP_Connector.c++
echo x - ./files/patch-src_FileSystem.h
sed 's/^X//' >./files/patch-src_FileSystem.h << 'END-of-./files/patch-src_FileSystem.h'
X$NetBSD: patch-av,v 1.5 2004/11/19 12:35:22 sketch Exp $
X
X--- src/FileSystem.h.orig 2004-11-08 16:45:59.904416000 +0000
X+++ src/FileSystem.h 2004-11-08 16:48:24.970550000 +0000
X@@ -27,7 +27,13 @@
X #include "Request.h"
X #include "Set.h"
X
X+#include "fam-mntent.h"
X+
X+#if defined(HAVE_SYS_MNTTAB_H)
X+struct mnttab;
X+#else
X struct mntent;
X+#endif
X struct stat;
X
X // FileSystem is the abstract base class for a per-filesystem object.
X@@ -91,12 +97,20 @@
X
X typedef Set<ClientInterest *> Interests;
X
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ FileSystem(const mnttab&);
X+#else
X FileSystem(const mntent&);
X+#endif
X virtual ~FileSystem();
X
X // Miscellaneous routines
X
X+#if defined(HAVE_SYS_MNTTAB_H)
X+ bool matches(const mnttab& m) const;
X+#else
X bool matches(const mntent& m) const;
X+#endif
X const char *dir() const { return mydir; }
X const char *fsname() const { return myfsname; }
X const Interests& interests() { return myinterests; }
END-of-./files/patch-src_FileSystem.h
echo x - ./files/patch-src_LocalFileSystem.c++
sed 's/^X//' >./files/patch-src_LocalFileSystem.c++ << 'END-of-./files/patch-src_LocalFileSystem.c++'
X$NetBSD: patch-az,v 1.1 2004/11/19 12:35:22 sketch Exp $
X
X--- src/LocalFileSystem.c++.orig 2004-11-08 17:28:08.710285000 +0000
X+++ src/LocalFileSystem.c++ 2004-11-08 17:28:53.492174000 +0000
X@@ -27,7 +27,11 @@
X #include "Log.h"
X #include "Pollster.h"
X
X+#if defined(HAVE_SYS_MNTTAB_H)
X+LocalFileSystem::LocalFileSystem(const mnttab& mnt)
X+#else
X LocalFileSystem::LocalFileSystem(const mntent& mnt)
X+#endif
X : FileSystem(mnt)
X { }
X
END-of-./files/patch-src_LocalFileSystem.c++
echo x - ./Makefile
sed 's/^X//' >./Makefile << 'END-of-./Makefile'
X# ports collection makefile for: fam
X# Date created: 20 February 2001
X# Whom: Jeremy Norris <ishmael27 at home.com>
X#
X# $FreeBSD: ports/devel/fam/Makefile,v 1.23 2004/08/03 15:49:35 lofi Exp $
X#
X
XPORTNAME= fam
XPORTVERSION= 2.7.0
XCATEGORIES= devel
XMASTER_SITES= ftp://oss.sgi.com/projects/fam/download/stable/ \
X ftp://ftp.tuwien.ac.at/opsys/linux/gentoo/distfiles/ \
X http://gd.tuwien.ac.at/opsys/linux/gentoo/distfiles/
XDIST_SUBDIR= ${PORTNAME}
X
XMAINTAINER= mbr at FreeBSD.org
XCOMMENT= A file alteration monitor
X
X# TODO:
X# configure problems: use bash, but must work with sh
X# problems with kqueue (threading) segfaults after initial use
X# work a $prefix/etc/rc.d/famd rcNG script
X
XUSE_REINPLACE= yes
XUSE_GMAKE= yes
XGNU_CONFIGURE= yes
XINSTALLS_SHLIB= yes
X
XCONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
XCONFIGURE_ENV+= CPPFLAGS=${CPPFLAGS}
X
X.if defined(WITH_KQUEUE)
XCPPFLAGS+= -DHAVE_KQUEUE ${PTHREAD_CFLAGS}
X.endif
X
XMAN3= fam.3
XMAN5= famd.conf.5
XMAN8= famd.8
X
X
Xpost-extract:
X @${CP} ${FILESDIR}/IMonKQueue.c++ ${WRKSRC}/src
X @${CP} ${FILESDIR}/imon-compat.h ${WRKSRC}/src
X
Xpre-configure:
X.if defined(WITH_KQUEUE)
X @${ECHO_MSG} ">> Enabling kqueue monitoring."
X @${REINPLACE_CMD} -e 's|@MONITOR_FUNCS@|IMonKQueue|g ; \
X s|@LIBS@|@LIBS@ ${PTHREAD_LIBS}|g' \
X ${WRKSRC}/src/Makefile.in
X.endif
X @${ECHO_MSG} ">> Fixing hardcoded paths."
X @${REINPLACE_CMD} -e 's|/usr/local/etc/|${PREFIX}/etc/|g' \
X ${WRKSRC}/man/famd.conf.5 ${WRKSRC}/man/famd.8
X
Xpost-install:
X @${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.mk>
END-of-./Makefile
echo x - ./pkg-descr
sed 's/^X//' >./pkg-descr << 'END-of-./pkg-descr'
XFAM, the File Alteration Monitor, provides an API which applications can use
Xto be notified when specific files or directories are changed.
X
XWWW: http://oss.sgi.com/projects/fam/
END-of-./pkg-descr
echo x - ./pkg-message
sed 's/^X//' >./pkg-message << 'END-of-./pkg-message'
X************************************************************************
X
X1. In order to run this port, please add the following line to /etc/rpc if
Xit is not already there:
X
X==8<====8<====8<====8<====8<====8<====8<====8<====8<====8<==
Xsgi_fam 391002
X==8<====8<====8<====8<====8<====8<====8<====8<====8<====8<==
X
X2. To run fam from inetd (the recommended method), then please add the
Xfollowing lines to /etc/inetd.conf if they are not already there:
X
X==8<====8<====8<====8<====8<====8<====8<====8<====8<====8<==
X# FAM: File Alteration Monitor [devel/fam]
X# Take of -l if you need nfs operation, see famd(8)
Xsgi_fam/1-2 stream rpc/tcp wait root /usr/local/sbin/famd famd -l
X==8<====8<====8<====8<====8<====8<====8<====8<====8<====8<==
X
XAfter modifying /etc/inetd.conf, you must (as root) run:
X
X killall -HUP inetd
X
XFam also requires that portmapper is running. Add the appropriate
Xentry to /etc/rc.conf:
X
XFor 4.x:
XAdd portmap_enable="YES" and either reboot or run /usr/sbin/portmap.
X
XFor 5.x:
XAdd rpcbind_enable="YES" and either reboot or run /usr/sbin/rpcbind.
X
X************************************************************************
END-of-./pkg-message
echo x - ./distinfo
sed 's/^X//' >./distinfo << 'END-of-./distinfo'
XMD5 (fam/fam-2.7.0.tar.gz) = 1bf3ae6c0c58d3201afc97c6a4834e39
XSIZE (fam/fam-2.7.0.tar.gz) = 301974
END-of-./distinfo
echo x - ./pkg-plist
sed 's/^X//' >./pkg-plist << 'END-of-./pkg-plist'
Xinclude/fam.h
Xlib/libfam.a
Xlib/libfam.la
Xlib/libfam.so
Xlib/libfam.so.0
Xsbin/famd
Xshare/examples/fam/fam.conf
X at exec if test ! -s %D/etc/fam.conf; then install -o root -g wheel -m 644 %D/share/examples/fam/fam.conf %D/etc/; fi
X at unexec if cmp -s %D/share/examples/fam/fam.conf %D/etc/famd.conf; then rm -rf %D/etc/fam.conf; fi
X at dirrm share/examples/fam
X at unexec rm -f %D/etc/rc.d/fam.sh || true
END-of-./pkg-plist
exit
More information about the freebsd-ports
mailing list