X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=innduct.git;a=blobdiff_plain;f=filemon.c;h=b06bfaa20e1ebc449df3ff335bd4f48d3c2adc17;hp=9a362dbd7dfe0ca11edb950dccfd405c16eed377;hb=c2ec61d4f426a04f288559c5ad50df822b7dcfb8;hpb=f4aee95c41a0d6231d115386b8fbb23f6b8e349a diff --git a/filemon.c b/filemon.c index 9a362db..b06bfaa 100644 --- 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 + * + * 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 . + * + * (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);