From 31f7689b959ced7dd2f220ccfaa28d5719d4798d Mon Sep 17 00:00:00 2001 From: obache Date: Sun, 29 Jul 2007 06:58:59 +0000 Subject: Import spreadlogd version 2.0.0. Packaged and provided by Mark Blackman via PR 36348. Spreadlogd is a general purpose daemon for receiving Spread toolkit broadcast/multicast messages and logging them either to a file or for further processing by a Perl module as an interpreter is embedded. --- net/spreadlogd/DESCR | 10 ++++ net/spreadlogd/Makefile | 39 ++++++++++++++ net/spreadlogd/PLIST | 5 ++ net/spreadlogd/distinfo | 8 +++ net/spreadlogd/files/spreadlogd.sh | 27 ++++++++++ net/spreadlogd/patches/patch-aa | 104 +++++++++++++++++++++++++++++++++++++ net/spreadlogd/patches/patch-ab | 16 ++++++ net/spreadlogd/patches/patch-ac | 15 ++++++ 8 files changed, 224 insertions(+) create mode 100644 net/spreadlogd/DESCR create mode 100644 net/spreadlogd/Makefile create mode 100644 net/spreadlogd/PLIST create mode 100644 net/spreadlogd/distinfo create mode 100644 net/spreadlogd/files/spreadlogd.sh create mode 100644 net/spreadlogd/patches/patch-aa create mode 100644 net/spreadlogd/patches/patch-ab create mode 100644 net/spreadlogd/patches/patch-ac diff --git a/net/spreadlogd/DESCR b/net/spreadlogd/DESCR new file mode 100644 index 00000000000..44a36c89347 --- /dev/null +++ b/net/spreadlogd/DESCR @@ -0,0 +1,10 @@ +Spreadlogd is a daemon to log to file, messages from spread toolkit clients. + +If you kill -HUP or kill the spreadlogd process, it will not actually process +the signal until after it has received its next message from Spread. You can +move you log files to new names and then kill -HUP and it will reopen the log +files. This is useful for seamless log rotation without losing any messages. + +Spread is really cool. It is a poweful group communication toolkit developed +at the Center for Networking and Distributed Systems at the Johns Hopkins +University (http://www.spread.org/ and http://www.cnds.jhu.edu/, respectively). diff --git a/net/spreadlogd/Makefile b/net/spreadlogd/Makefile new file mode 100644 index 00000000000..27d6cea6c49 --- /dev/null +++ b/net/spreadlogd/Makefile @@ -0,0 +1,39 @@ +# $NetBSD: Makefile,v 1.1.1.1 2007/07/29 06:58:59 obache Exp $ +# + +DISTNAME= spreadlogd +PKGNAME= spreadlogd-2.0.0 +CATEGORIES= net +MASTER_SITES= http://www.backhand.org/mod_log_spread/ +DIST_SUBDIR= ${PKGNAME_NOREV} + +MAINTAINER= mark@exonetric.com +HOMEPAGE= http://www.backhand.org/mod_log_spread/ +COMMENT= Daemon to log to file, messages from spread toolkit clients + +GNU_CONFIGURE= yes +USE_TOOLS+= perl +WRKSRC= ${WRKDIR}/${PKGNAME_NOREV} + +RCD_SCRIPTS= spreadlogd +# define the "example" directory for post-install target and for the CONF_FILES +# variable used by pkginstall +EXAMPLEDIR= ${PREFIX}/share/examples/spreadlogd + +# tell pkginstall where to pluck virgin configuration files from in the case of a new +# install, knowing that the post-install target in *this* Makefile will put the +# sample configuration in the example directory for us (as well as creating it) +CONF_FILES+= ${EXAMPLEDIR}/spreadlogd.conf.sample ${PKG_SYSCONFDIR}/spreadlogd.conf + +# create example directory *and* put the sample configuration file here with the suffix +# .sample so that pkginstall can drop it in for us. +post-install: + ${INSTALL_DATA_DIR} ${EXAMPLEDIR} + ${INSTALL_DATA} ${WRKSRC}/spreadlogd.conf ${EXAMPLEDIR}/spreadlogd.conf.sample + +BUILDLINK_API_DEPENDS.libevent+=libevent>=1.0c + +.include "../../net/spread/buildlink3.mk" +.include "../../devel/libevent/buildlink3.mk" +.include "../../lang/perl5/buildlink3.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/net/spreadlogd/PLIST b/net/spreadlogd/PLIST new file mode 100644 index 00000000000..19ce91c5049 --- /dev/null +++ b/net/spreadlogd/PLIST @@ -0,0 +1,5 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2007/07/29 06:58:59 obache Exp $ +sbin/spreadlogd +share/examples/rc.d/spreadlogd +share/examples/spreadlogd/spreadlogd.conf.sample +@dirrm share/examples/spreadlogd diff --git a/net/spreadlogd/distinfo b/net/spreadlogd/distinfo new file mode 100644 index 00000000000..dc5f39770eb --- /dev/null +++ b/net/spreadlogd/distinfo @@ -0,0 +1,8 @@ +$NetBSD: distinfo,v 1.1.1.1 2007/07/29 06:58:59 obache Exp $ + +SHA1 (spreadlogd-2.0.0/spreadlogd.tar.gz) = 4fd88a3b804e4fbd655c822350d3137505120234 +RMD160 (spreadlogd-2.0.0/spreadlogd.tar.gz) = 2f70a3a0b6768128b2152321e016d795540a6ada +Size (spreadlogd-2.0.0/spreadlogd.tar.gz) = 79559 bytes +SHA1 (patch-aa) = 952d46b24ec2a8bea5335290bc7ba4aedd9f3a7d +SHA1 (patch-ab) = c70fd89f4839213969febac0825329acbf61b59a +SHA1 (patch-ac) = d38e189fbaceb97f4fffde25ff78a671eb39d4e9 diff --git a/net/spreadlogd/files/spreadlogd.sh b/net/spreadlogd/files/spreadlogd.sh new file mode 100644 index 00000000000..afb02e7b5d7 --- /dev/null +++ b/net/spreadlogd/files/spreadlogd.sh @@ -0,0 +1,27 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# PROVIDE: spreadlogd +# REQUIRE: DAEMON +# +# To start spreadlogd at startup, copy this script to /etc/rc.d and set +# spreadlogd=YES in /etc/rc.conf. +# +# Addtionally you may set spread_log to a file where to log stuff. + +if [ -f /etc/rc.subr ]; then + . /etc/rc.subr +fi + +rcd_dir=`@DIRNAME@ $0` + +name="spreadlogd" +rcvar=$name +command="@PREFIX@/sbin/${name}" +sig_stop=INT + +required_files="@PKG_SYSCONFDIR@/spreadlogd.conf" + +command_args="" + +load_rc_config $name +run_rc_command "$1" diff --git a/net/spreadlogd/patches/patch-aa b/net/spreadlogd/patches/patch-aa new file mode 100644 index 00000000000..36f2afba6b6 --- /dev/null +++ b/net/spreadlogd/patches/patch-aa @@ -0,0 +1,104 @@ +$NetBSD: patch-aa,v 1.1.1.1 2007/07/29 06:58:59 obache Exp $ + +--- config.c.orig 2006-05-05 20:25:41.000000000 +0100 ++++ config.c +@@ -301,6 +301,15 @@ int config_close(void) { + SpreadConfiguration *sc; + LogFacility *lf; + int i; ++#ifdef HAVE_FCNTL_H ++ struct flock fl; ++ ++ fl.l_type = F_UNLCK; /* tell it to unlock the region */ ++ fl.l_whence = SEEK_SET; /* SEEK_SET, SEEK_CUR, SEEK_END */ ++ fl.l_start = 0; /* Offset from l_whence */ ++ fl.l_len = 0; /* length, 0 = to EOF */ ++ fl.l_pid = getpid(); /* our PID */ ++#endif + sciter = sl_getlist(&spreaddaemons); + if(!sciter) return 0; + sc = (SpreadConfiguration *)sciter->data; +@@ -314,13 +323,23 @@ int config_close(void) { + if(lf->vhostdir) { + for (i=0;i< FHASH_SIZE;i++) { + if(lf->hash[i].fd>0) { +- if(!skiplocking) flock(lf->hash[i].fd, LOCK_UN); ++ if(!skiplocking) ++#ifdef HAVE_FCNTL_H ++ fcntl(lf->hash[i].fd, F_SETLK, &fl); ++#else ++ flock(lf->hash[i].fd, LOCK_UN); ++#endif + close(lf->hash[i].fd); + lf->hash[i].fd = -1; + } + } + } else if(lf->logfile && lf->logfile->fd>0) { +- if(!skiplocking) flock(lf->logfile->fd, LOCK_UN); ++ if(!skiplocking) ++#ifdef HAVE_FCNTL_H ++ fcntl(lf->logfile->fd, F_SETLK, &fl); ++#else ++ flock(lf->logfile->fd, LOCK_UN); ++#endif + close(lf->logfile->fd); + lf->logfile->fd = -1; + } +@@ -356,6 +375,15 @@ int config_start(void) { + struct skiplistnode *sciter, *lfiter; + SpreadConfiguration *sc; + LogFacility *lf; ++#ifdef HAVE_FCNTL_H ++ struct flock fl; ++ ++ fl.l_type = F_WRLCK; /* F_RDLCK, F_WRLCK, F_UNLCK */ ++ fl.l_whence = SEEK_SET; /* SEEK_SET, SEEK_CUR, SEEK_END */ ++ fl.l_start = 0; /* Offset from l_whence */ ++ fl.l_len = 0; /* length, 0 = to EOF */ ++ fl.l_pid = getpid(); /* our PID */ ++#endif + sciter = sl_getlist(&spreaddaemons); + if(!sciter) return 0; + sc = (SpreadConfiguration *)sciter->data; +@@ -381,7 +409,11 @@ int config_start(void) { + } + } + if(!skiplocking) { +- if(flock(lf->logfile->fd, LOCK_NB|LOCK_EX)==-1) { ++#ifdef HAVE_FCNTL_H ++ if(fcntl(lf->logfile->fd, F_SETLK, &fl)==-1) { ++#else ++ if(flock(lf->logfile->fd, LOCK_NB|LOCK_EX)==-1) { ++#endif + fprintf(stderr, "Cannot lock %s, is another spreadlogd running?\n", + lf->logfile->filename); + exit(1); +@@ -441,6 +473,15 @@ int config_get_fd(SpreadConfiguration *s + hash_element temp; + char *cp; + char fullpath[MAXPATHLEN]; ++#ifdef HAVE_FCNTL_H ++ struct flock fl; ++ ++ fl.l_type = F_WRLCK; /* F_RDLCK, F_WRLCK, F_UNLCK */ ++ fl.l_whence = SEEK_SET; /* SEEK_SET, SEEK_CUR, SEEK_END */ ++ fl.l_start = 0; /* Offset from l_whence */ ++ fl.l_len = 0; /* length, 0 = to EOF */ ++ fl.l_pid = getpid(); /* our PID */ ++#endif + lf = sl_find(sc->logfacilities, group, NULL); + if(!lf || !lf->logfile || !lf->logfile->filename) return -1; + if(lf->vhostdir) { +@@ -457,7 +498,11 @@ int config_get_fd(SpreadConfiguration *s + O_CREAT|O_APPEND|O_WRONLY, + 00644); + if(!skiplocking) { +- if(flock(temp.fd, LOCK_NB|LOCK_EX)==-1) { ++#ifdef HAVE_FCNTL_H ++ if(fcntl(temp.fd, F_SETLK, &fl)==-1) { ++#else ++ if(flock(temp.fd, LOCK_NB|LOCK_EX)==-1) { ++#endif + fprintf(stderr, "Cannot lock %s, is another spreadlogd running?\n", + fullpath); + exit(1); diff --git a/net/spreadlogd/patches/patch-ab b/net/spreadlogd/patches/patch-ab new file mode 100644 index 00000000000..1ff6cb23521 --- /dev/null +++ b/net/spreadlogd/patches/patch-ab @@ -0,0 +1,16 @@ +$NetBSD: patch-ab,v 1.1.1.1 2007/07/29 06:58:59 obache Exp $ + +--- echash.h.orig 2006-05-04 13:21:46.000000000 +0100 ++++ echash.h +@@ -88,11 +88,4 @@ API_EXPORT(int) echash_next(ec_hash_tabl + API_EXPORT(int) echash_firstkey(ec_hash_table *h, const char **k, int *klen); + API_EXPORT(int) echash_nextkey(ec_hash_table *h, const char **k, int *klen, char *lk, int lklen); + +-/* This function serves no real API use sans calculating expected buckets +- for keys (or extending the hash... which is unsupported) */ +-API_EXPORT(unsigned int) echash__hash(const char *k, u_int32_t length, +- u_int32_t initval); +-API_EXPORT(ec_hash_bucket *) echash__new_bucket(const char *k, int klen, +- void *data); +-API_EXPORT(void) echash__rebucket(ec_hash_table *h, int newsize); + #endif diff --git a/net/spreadlogd/patches/patch-ac b/net/spreadlogd/patches/patch-ac new file mode 100644 index 00000000000..57abd4794ef --- /dev/null +++ b/net/spreadlogd/patches/patch-ac @@ -0,0 +1,15 @@ +$NetBSD: patch-ac,v 1.1.1.1 2007/07/29 06:58:59 obache Exp $ + +--- Makefile.in.orig 2007-05-16 09:47:12.216090000 +0100 ++++ Makefile.in +@@ -53,8 +53,8 @@ spreadlogd: $(OBJS) + install: spreadlogd + $(srcdir)/mkinstalldirs $(DESTDIR)$(sbindir) + $(INSTALL) -m 0755 spreadlogd $(DESTDIR)$(sbindir)/spreadlogd +- $(srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir) +- $(INSTALL) -m 0755 spreadlogd.conf $(DESTDIR)$(sysconfdir)/spreadlogd.conf.sample ++# $(srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir) ++# $(INSTALL) -m 0755 spreadlogd.conf $(DESTDIR)$(sysconfdir)/spreadlogd.conf.sample + + clean: + rm -f *~ *.o spreadlogd libskiplist.a y.tab.h y.tab.c lex.sld_.c \ -- cgit v1.2.3