chiark / gitweb /
Accumulate backlog counts rather than reporting every file
[innduct.git] / filemon.c
index 9a362dbd7dfe0ca11edb950dccfd405c16eed377..b06bfaa20e1ebc449df3ff335bd4f48d3c2adc17 100644 (file)
--- a/filemon.c
+++ b/filemon.c
@@ -1,3 +1,31 @@
+/*
+ *  innduct
+ *  tailing reliable realtime streaming feeder for inn
+ *  filemon.c - file monitoring (inotify, kqueue, poll, etc.)
+ *
+ *  Copyright (C) 2010 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ * 
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ * 
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ * 
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *  (I believe that when you compile and link this as part of the inn2
+ *  build, with the Makefile runes I have provided, all the libraries
+ *  and files which end up included in innduct are licence-compatible
+ *  with GPLv3.  If not then please let me know.  -Ian Jackson.)
+ */
+
+#include "innduct.h"
+
 /*---------- filemon implemented with inotify ----------*/
 
 #if defined(HAVE_SYS_INOTIFY_H) && !defined(HAVE_FILEMON)
@@ -63,7 +91,7 @@ static void *filemon_inotify_readable(oop_source *lp, int fd,
   return OOP_CONTINUE;
 }
 
-static int filemon_method_init(void) {
+int filemon_method_init(void) {
   filemon_inotify_fd= inotify_init();
   if (filemon_inotify_fd<0) {
     syswarn("filemon/inotify: inotify_init failed");
@@ -76,7 +104,7 @@ static int filemon_method_init(void) {
   return 1;
 }
 
-static void filemon_method_dump_info(FILE *f) {
+void filemon_method_dump_info(FILE *f) {
   int i;
   fprintf(f,"inotify");
   DUMPV("%d",,filemon_inotify_fd);
@@ -93,26 +121,26 @@ static void filemon_method_dump_info(FILE *f) {
 
 struct Filemon_Perfile { int dummy; };
 
-static int filemon_method_init(void) {
+int filemon_method_init(void) {
   warn("filemon/dummy: no filemon method compiled in");
   return 0;
 }
 static void filemon_method_startfile(InputFile *ipf, Filemon_Perfile *pf) { }
 static void filemon_method_stopfile(InputFile *ipf, Filemon_Perfile *pf) { }
-static void filemon_method_dump_info(FILE *f) { fprintf(f,"dummy\n"); }
+void filemon_method_dump_info(FILE *f) { fprintf(f,"dummy\n"); }
 
 #endif /* !HAVE_FILEMON */
 
 /*---------- filemon generic interface ----------*/
 
-static void filemon_start(InputFile *ipf) {
+void filemon_start(InputFile *ipf) {
   assert(!ipf->filemon);
 
   NEW(ipf->filemon);
   filemon_method_startfile(ipf, ipf->filemon);
 }
 
-static void filemon_stop(InputFile *ipf) {
+void filemon_stop(InputFile *ipf) {
   if (!ipf->filemon) return;
   filemon_method_stopfile(ipf, ipf->filemon);
   free(ipf->filemon);