summaryrefslogtreecommitdiff
path: root/www/spreadlogd/files/patch-spreadlogd.c
diff options
context:
space:
mode:
authorJean-Yves Lefort <jylefort@FreeBSD.org>2005-05-14 11:12:15 +0000
committerJean-Yves Lefort <jylefort@FreeBSD.org>2005-05-14 11:12:15 +0000
commit0ceee22139cdaca93835fd0a1d7c6eb775df0194 (patch)
treed80788c5893cfb22e9592b9355ed07bc508a9fa0 /www/spreadlogd/files/patch-spreadlogd.c
parentAdd mod_log_spread. (diff)
Add spreadlogd.
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). WWW: http://www.lethargy.org/mod_log_spread/ PR: ports/80877 Submitted by: Meno Abels <meno.abels@adviser.com>
Diffstat (limited to '')
-rw-r--r--www/spreadlogd/files/patch-spreadlogd.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/www/spreadlogd/files/patch-spreadlogd.c b/www/spreadlogd/files/patch-spreadlogd.c
new file mode 100644
index 000000000000..79bc81469d34
--- /dev/null
+++ b/www/spreadlogd/files/patch-spreadlogd.c
@@ -0,0 +1,47 @@
+--- spreadlogd.c.orig Tue Jul 3 22:09:48 2001
++++ spreadlogd.c Sat May 14 12:47:05 2005
+@@ -114,9 +114,15 @@
+ }
+ }
+ void daemonize(void) {
++ FILE *fd;
++ char buf[16];
+ if(fork()!=0) exit(0);
+ setsid();
+ if(fork()!=0) exit(0);
++ fd = fopen("/var/run/spreadlogd.pid", "w");
++ sprintf(buf, "%d", getpid());
++ fputs(buf, fd);
++ fclose(fd);
+ }
+ int getnropen(void) {
+ struct rlimit rlim;
+@@ -127,9 +133,6 @@
+ }
+
+ int main(int argc, char **argv) {
+-#ifdef SPREAD_VERSION
+- int mver, miver, pver;
+-#endif
+ char *configfile = default_configfile;
+ char *message;
+ int getoption, debug = 0;
+@@ -137,7 +140,8 @@
+ sigset_t ourmask;
+ nr_open = getnropen();
+
+- fdsetsize = getdtablesize();
++ fdsetsize = 512; /* getdtablesize(); ugly fix for freebsd but the select fdset
++ is not as big as dtablesize returns so we receive some cores MENO */
+ fds = (SpreadConfiguration **)malloc(sizeof(SpreadConfiguration *)*
+ fdsetsize);
+ memset(fds, 0, sizeof(SpreadConfiguration *)*fdsetsize);
+@@ -182,7 +186,7 @@
+ buffsize);
+ }
+
+- if(!debug) daemonize();
++ if(!debug) { daemonize(); }
+
+ /* Set up HUP signal */
+ signalaction.sa_handler = sig_handler;