From 7fa1956da7ea3fa08d3187d3a5d883cfe5a67845 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Thu, 10 Mar 2011 03:23:58 +0100 Subject: bugfix: pmaixforwarded from fails to build Signed-off-by: Rainer Gerhards --- plugins/pmaixforwardedfrom/pmaixforwardedfrom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c b/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c index 11634199..fa4a9087 100644 --- a/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c +++ b/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c @@ -41,6 +41,7 @@ #include "unicode-helper.h" MODULE_TYPE_PARSER +MODULE_TYPE_NOKEEP PARSER_NAME("rsyslog.aixforwardedfrom") /* internal structures -- cgit v1.2.3 From 225aa0e367a604d3891bba13d470bfacc3dfe544 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 10 Mar 2011 03:41:17 +0100 Subject: fixed problem in testbench Makefile, added module to distcheck Thanks to Michael Biebl for mentioning that some modules were not included in make distcheck. --- Makefile.am | 3 +++ tests/Makefile.am | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index f699cc46..4e3e9476 100644 --- a/Makefile.am +++ b/Makefile.am @@ -230,5 +230,8 @@ DISTCHECK_CONFIGURE_FLAGS= --enable-gssapi_krb5 \ --enable-impstats \ --enable-imptcp \ --enable-memcheck \ + --enable-pmaixforwardedfrom \ + --enable-pmcisconames \ + --enable-pmsnare \ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) ACLOCAL_AMFLAGS = -I m4 diff --git a/tests/Makefile.am b/tests/Makefile.am index 4a1bfe57..eb7ad94f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -6,7 +6,6 @@ TESTS = $(TESTRUNS) cfg.sh if ENABLE_IMDIAG TESTS += \ arrayqueue.sh \ - linkedlistqueue.sh \ da-mainmsg-q.sh \ validation-run.sh \ imtcp-multiport.sh \ @@ -54,7 +53,6 @@ TESTS += \ discard-allmark.sh \ discard.sh \ queue-persist.sh \ - arrayqueue.sh \ linkedlistqueue.sh endif @@ -214,7 +212,9 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/rsf_getenv.conf \ diskqueue.sh \ testsuites/diskqueue.conf \ + arrayqueue.sh \ testsuites/arrayqueue.conf \ + linkedlistqueue.sh \ testsuites/linkedlistqueue.conf \ da-mainmsg-q.sh \ testsuites/da-mainmsg-q.conf \ -- cgit v1.2.3 From 9cc963926bad3de9a78df51a19456f419c34492a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 10 Mar 2011 14:46:47 +0100 Subject: bugfix: minor memory leak in omlibdbi (< 1k per instance and run) also testbench improvement (omlibdbi now also receives a couple of tests if we have a life MySQL server). --- ChangeLog | 1 + plugins/omlibdbi/omlibdbi.c | 9 ++++++++- tests/Makefile.am | 11 +++++++++++ tests/libdbi-asyn.sh | 13 +++++++++++++ tests/libdbi-basic-vg.sh | 16 ++++++++++++++++ tests/libdbi-basic.sh | 13 +++++++++++++ tests/testsuites/libdbi-asyn.conf | 12 ++++++++++++ tests/testsuites/libdbi-basic.conf | 9 +++++++++ 8 files changed, 83 insertions(+), 1 deletion(-) create mode 100755 tests/libdbi-asyn.sh create mode 100755 tests/libdbi-basic-vg.sh create mode 100755 tests/libdbi-basic.sh create mode 100644 tests/testsuites/libdbi-asyn.conf create mode 100644 tests/testsuites/libdbi-basic.conf diff --git a/ChangeLog b/ChangeLog index 784a8787..320134e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ Version 5.7.9 [V5-BETA] (rgerhards), 2011-03-?? - improved testbench among others, life tests for ommysql (against a test database) have been added, valgrind-based testing enhanced, ... +- bugfix: minor memory leak in omlibdbi (< 1k per instance and run) - bugfix: (regression) omhdfs did no longer compile - bugfix: omlibdbi did not use password from rsyslog.con closes: http://bugzilla.adiscon.com/show_bug.cgi?id=203 diff --git a/plugins/omlibdbi/omlibdbi.c b/plugins/omlibdbi/omlibdbi.c index f49bef42..7fcf9631 100644 --- a/plugins/omlibdbi/omlibdbi.c +++ b/plugins/omlibdbi/omlibdbi.c @@ -108,6 +108,11 @@ static void closeConn(instanceData *pData) BEGINfreeInstance CODESTARTfreeInstance closeConn(pData); + free(pData->drvrName); + free(pData->host); + free(pData->usrName); + free(pData->pwd); + free(pData->dbName); ENDfreeInstance @@ -171,7 +176,8 @@ static rsRetVal initConn(instanceData *pData, int bSilent) errmsg.LogError(0, RS_RET_SUSPENDED, "libdbi error: libdbi or libdbi drivers not present on this system - suspending."); ABORT_FINALIZE(RS_RET_SUSPENDED); } else if(iDrvrsLoaded < 0) { - errmsg.LogError(0, RS_RET_SUSPENDED, "libdbi error: libdbi could not be initialized - suspending."); + errmsg.LogError(0, RS_RET_SUSPENDED, "libdbi error: libdbi could not be " + "initialized (do you have any dbi drivers installed?) - suspending."); ABORT_FINALIZE(RS_RET_SUSPENDED); } bDbiInitialized = 1; /* we are done for the rest of our existence... */ @@ -367,6 +373,7 @@ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionlibdbipassword", 0, eCmdHdlrGetWord, NULL, &pwd, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionlibdbidbname", 0, eCmdHdlrGetWord, NULL, &dbName, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr( (uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID)); + DBGPRINTF("omlibdbi compiled with version %s loaded, libdbi version %s\n", VERSION, dbi_version()); ENDmodInit /* vim:set ai: diff --git a/tests/Makefile.am b/tests/Makefile.am index eb7ad94f..ea6860d5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -63,10 +63,16 @@ TESTS += \ tcp-msgreduc-vg.sh endif + if ENABLE_MYSQL_TESTS TESTS += \ mysql-basic.sh \ mysql-asyn.sh +if ENABLE_OMLIBDBI +TESTS += \ + libdbi-basic.sh \ + libdbi-asyn.sh +endif if HAVE_VALGRIND TESTS += \ mysql-basic-vg.sh \ @@ -74,6 +80,7 @@ TESTS += \ endif endif + if ENABLE_IMPTCP TESTS += \ manyptcp.sh \ @@ -367,6 +374,10 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ resultdata/imuxsock_ccmiddle.log \ testsuites/mysql-truncate.sql \ testsuites/mysql-select-msg.sql \ + libdbi-basic.sh \ + testsuites/libdbi-basic.conf \ + libdbi-asyn.sh \ + testsuites/libdbi-asyn.conf \ mysql-basic.sh \ mysql-basic-vg.sh \ testsuites/mysql-basic.conf \ diff --git a/tests/libdbi-asyn.sh b/tests/libdbi-asyn.sh new file mode 100755 index 00000000..0076da9c --- /dev/null +++ b/tests/libdbi-asyn.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[libdbi-asyn.sh\]: asyn test for libdbi functionality +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup libdbi-asyn.conf +source $srcdir/diag.sh injectmsg 0 50000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 49999 +source $srcdir/diag.sh exit diff --git a/tests/libdbi-basic-vg.sh b/tests/libdbi-basic-vg.sh new file mode 100755 index 00000000..75d12857 --- /dev/null +++ b/tests/libdbi-basic-vg.sh @@ -0,0 +1,16 @@ +# This file is part of the rsyslog project, released under GPLv3 +# this test is currently not included in the testbench as libdbi +# itself seems to have a memory leak +echo =============================================================================== +echo \[libdbi-basic.sh\]: basic test for libdbi-basic functionality via mysql +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup-vg libdbi-basic.conf +source $srcdir/diag.sh injectmsg 0 5000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/libdbi-basic.sh b/tests/libdbi-basic.sh new file mode 100755 index 00000000..a854a565 --- /dev/null +++ b/tests/libdbi-basic.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[libdbi-basic.sh\]: basic test for libdbi-basic functionality via mysql +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup libdbi-basic.conf +source $srcdir/diag.sh injectmsg 0 5000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/testsuites/libdbi-asyn.conf b/tests/testsuites/libdbi-asyn.conf new file mode 100644 index 00000000..39b01fbc --- /dev/null +++ b/tests/testsuites/libdbi-asyn.conf @@ -0,0 +1,12 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/omlibdbi/.libs/omlibdbi + +$ActionQueueType LinkedList + +$ActionLibdbiDriver mysql +$ActionLibdbiHost 127.0.0.1 +$ActionLibdbiUserName root +$ActionLibdbiPassword pass +$ActionLibdbiDBName Syslog +:msg, contains, "msgnum:" :omlibdbi: diff --git a/tests/testsuites/libdbi-basic.conf b/tests/testsuites/libdbi-basic.conf new file mode 100644 index 00000000..212225cc --- /dev/null +++ b/tests/testsuites/libdbi-basic.conf @@ -0,0 +1,9 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/omlibdbi/.libs/omlibdbi +$ActionLibdbiDriver mysql +$ActionLibdbiHost 127.0.0.1 +$ActionLibdbiUserName root +$ActionLibdbiPassword pass +$ActionLibdbiDBName Syslog +:msg, contains, "msgnum:" :omlibdbi: -- cgit v1.2.3 From 765317d54ec5658dd0c598170d0fc0824f751265 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 10 Mar 2011 15:13:31 +0100 Subject: improved tcpflood test tool to support many more connections even on platforms that place a low limit on the number of file descriptors per processes. The tool now increases the fd limit as required. --- tests/tcpflood.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/tcpflood.c b/tests/tcpflood.c index d8c3f038..138706aa 100644 --- a/tests/tcpflood.c +++ b/tests/tcpflood.c @@ -62,6 +62,7 @@ #include #include #include +#include #define EXIT_FAILURE 1 #define INVALID_SOCKET -1 @@ -377,6 +378,7 @@ int main(int argc, char *argv[]) int ret = 0; int opt; struct sigaction sigAct; + struct rlimit maxFiles; static char buf[1024]; srand(time(NULL)); /* seed is good enough for our needs */ @@ -439,6 +441,18 @@ int main(int argc, char *argv[]) } } + if(numConnections > 100) { + maxFiles.rlim_cur = numConnections + 50; + maxFiles.rlim_max = numConnections + 50; + if(setrlimit(RLIMIT_NOFILE, &maxFiles) < 0) { + perror("set number of open files"); + fprintf(stderr, + "could net set sufficiently large number of " + "open files for required connection count!\n"); + exit(1); + } + } + if(dataFile != NULL) { if((dataFP = fopen(dataFile, "r")) == NULL) { perror(dataFile); -- cgit v1.2.3 From fd26a42bdc04eaf497cafd9ef806a54f3de1a7e9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 10 Mar 2011 03:08:42 +0100 Subject: systemd: do not hook up SIGHUP for reload rsyslog doesn't actually do a configuration reload on SIGHUP, hence let's not pretend it does and drop the ExecReload= line, so that the clients will rather restart than reload the service. --- rsyslog.service.in | 1 - 1 file changed, 1 deletion(-) diff --git a/rsyslog.service.in b/rsyslog.service.in index 03db596e..898354d5 100644 --- a/rsyslog.service.in +++ b/rsyslog.service.in @@ -4,7 +4,6 @@ Description=System Logging Service [Service] ExecStartPre=/bin/systemctl stop systemd-kmsg-syslogd.service ExecStart=@sbindir@/rsyslogd -n -c5 -ExecReload=/bin/kill -HUP $MAINPID Sockets=syslog.socket [Install] -- cgit v1.2.3 From 4195f9cb08cddaeae37dc88c5e879d84391b4359 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 11 Mar 2011 10:58:07 +0100 Subject: added new test for imfile to testbench --- tests/Makefile.am | 11 ++++++++++- tests/diag.sh | 2 ++ tests/imfile-basic.sh | 14 ++++++++++++++ tests/inputfilegen.c | 23 +++++++++++++++++++++++ tests/random.sh | 4 +--- tests/testsuites/imfile-basic.conf | 12 ++++++++++++ 6 files changed, 62 insertions(+), 4 deletions(-) create mode 100755 tests/imfile-basic.sh create mode 100644 tests/inputfilegen.c create mode 100644 tests/testsuites/imfile-basic.conf diff --git a/tests/Makefile.am b/tests/Makefile.am index 0045f00a..a438a926 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,6 @@ if ENABLE_TESTBENCH TESTRUNS = rt_init rscript -check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq randomgen +check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq randomgen inputfilegen TESTS = $(TESTRUNS) cfg.sh \ validation-run.sh \ imtcp-multiport.sh \ @@ -44,6 +44,10 @@ if ENABLE_EXTENDED_TESTS TESTS += random.sh endif +if ENABLE_IMFILE +TESTS += imfile-basic.sh +endif + check_JAVA = DiagTalker.java endif # if ENABLE_TESTBENCH @@ -187,6 +191,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/complex1.conf \ random.sh \ testsuites/random.conf \ + imfile-basic.sh \ + testsuites/imfile-basic.conf \ dynfile_invld_async.sh \ dynfile_invld_sync.sh \ dynfile_cachemiss.sh \ @@ -213,6 +219,9 @@ tcpflood_LDADD = $(SOL_LIBS) randomgen_SOURCES = randomgen.c randomgen_LDADD = $(SOL_LIBS) +inputfilegen_SOURCES = inputfilegen.c +inputfilegen_LDADD = $(SOL_LIBS) + nettester_SOURCES = nettester.c getline.c nettester_LDADD = $(SOL_LIBS) diff --git a/tests/diag.sh b/tests/diag.sh index 51ad5f6a..806edf80 100755 --- a/tests/diag.sh +++ b/tests/diag.sh @@ -22,6 +22,7 @@ case $1 in rm -f work rsyslog.out.log rsyslog.out.log.save # common work files rm -f rsyslog.out.*.log work-presort rm -rf test-spool + rm -f rsyslog.input rm -f core.* vgcore.* mkdir test-spool ;; @@ -30,6 +31,7 @@ case $1 in rm -f work rsyslog.out.log rsyslog.out.log.save # common work files rm -f rsyslog.out.*.log rsyslog.random.data work-presort rm -rf test-spool + rm -f rsyslog.input ;; 'startup') # start rsyslogd with default params. $2 is the config file name to use # returns only after successful startup, $3 is the instance (blank or 2!) diff --git a/tests/imfile-basic.sh b/tests/imfile-basic.sh new file mode 100755 index 00000000..ca6a5d3a --- /dev/null +++ b/tests/imfile-basic.sh @@ -0,0 +1,14 @@ +# This is part of the rsyslog testbench, licensed under GPLv3 +echo [imfile-basic.sh] +source $srcdir/diag.sh init +# generate input file first. Note that rsyslog processes it as +# soon as it start up (so the file should exist at that point). +./inputfilegen 50000 > rsyslog.input +ls -l rsyslog.input +source $srcdir/diag.sh startup imfile-basic.conf +# sleep a little to give rsyslog a chance to begin processing +sleep 1 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished! +source $srcdir/diag.sh seq-check 0 49999 +source $srcdir/diag.sh exit diff --git a/tests/inputfilegen.c b/tests/inputfilegen.c new file mode 100644 index 00000000..26fb79af --- /dev/null +++ b/tests/inputfilegen.c @@ -0,0 +1,23 @@ +/* generate an input file suitable for use by the testbench + * Copyright (C) 2011 by Rainer Gerhards and Adiscon GmbH. + * Part of rsyslog, licensed under GPLv3 + */ +#include +#include + +int main(int argc, char* argv[]) +{ + int nmsgs; + int i; + + if(argc != 2) { + fprintf(stderr, "usage: inputfilegen num-messages\n"); + return 1; + } + + nmsgs = atoi(argv[1]); + for(i = 0 ; i < nmsgs ; ++i) { + printf("msgnum:%8.8d:\n", i); + } + return 0; +} diff --git a/tests/random.sh b/tests/random.sh index d1f392d3..969d720c 100755 --- a/tests/random.sh +++ b/tests/random.sh @@ -5,9 +5,6 @@ echo =============================================================================== echo TEST: \[random.sh\]: testing random data source $srcdir/diag.sh init -# uncomment for debugging support: -#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" -#export RSYSLOG_DEBUGLOG="log" source $srcdir/diag.sh startup random.conf # generate random data ./randomgen -f rsyslog.random.data -s 100000 @@ -17,4 +14,5 @@ source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done proces source $srcdir/diag.sh wait-shutdown # and wait for it to terminate # we do not check anything yet, the point is if rsyslog survived ;) # TODO: check for exit message, but we'll notice an abort anyhow, so not that important +rm -f random.data source $srcdir/diag.sh exit diff --git a/tests/testsuites/imfile-basic.conf b/tests/testsuites/imfile-basic.conf new file mode 100644 index 00000000..9fb9b5ca --- /dev/null +++ b/tests/testsuites/imfile-basic.conf @@ -0,0 +1,12 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/imfile/.libs/imfile +$InputFileName ./rsyslog.input +$InputFileTag file: +$InputFileStateFile stat-file1 +$InputFileSeverity error +$InputFileFacility local7 +$InputRunFileMonitor + +$template outfmt,"%msg:F,58:2%\n" +:msg, contains, "msgnum:" ./rsyslog.out.log;outfmt -- cgit v1.2.3 From 6dbd70732a19a13bacae7b4bea07097458974cc9 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 11 Mar 2011 11:56:37 +0100 Subject: added one more test for imfile (under valgrind) --- tests/Makefile.am | 4 ++++ tests/imfile-basic-vg.sh | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100755 tests/imfile-basic-vg.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index 9986cf80..c64d44e9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -125,6 +125,9 @@ endif if ENABLE_IMFILE TESTS += imfile-basic.sh +if HAVE_VALGRIND +TESTS += imfile-basic-vg.sh +endif endif endif # if ENABLE_TESTBENCH @@ -327,6 +330,7 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ random.sh \ testsuites/random.conf \ imfile-basic.sh \ + imfile-basic-vg.sh \ testsuites/imfile-basic.conf \ dynfile_invld_async.sh \ dynfile_invld_sync.sh \ diff --git a/tests/imfile-basic-vg.sh b/tests/imfile-basic-vg.sh new file mode 100755 index 00000000..92cfc7f6 --- /dev/null +++ b/tests/imfile-basic-vg.sh @@ -0,0 +1,15 @@ +# This is part of the rsyslog testbench, licensed under GPLv3 +echo [imfile-basic.sh] +source $srcdir/diag.sh init +# generate input file first. Note that rsyslog processes it as +# soon as it start up (so the file should exist at that point). +./inputfilegen 50000 > rsyslog.input +ls -l rsyslog.input +source $srcdir/diag.sh startup-vg imfile-basic.conf +# sleep a little to give rsyslog a chance to begin processing +sleep 1 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +source $srcdir/diag.sh seq-check 0 49999 +source $srcdir/diag.sh exit -- cgit v1.2.3 From 4671cad51221f1cb03822481e46669ffba3c6d95 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sun, 13 Mar 2011 12:09:06 +0100 Subject: Fall back to epoll_create() if epoll_create1() is not available epoll_create1() was introduced in Linux kernel 2.6.27. If rsyslog was compiled on a newer kernel but run on a kernel older than 2.6.27, remote syslog fails. Apply a runtime check for epoll_create1() and fall back to epoll_create() in this case. Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=617996 --- plugins/imptcp/imptcp.c | 13 ++++++++----- plugins/imudp/imudp.c | 13 ++++++++----- runtime/nsdpoll_ptcp.c | 13 ++++++++----- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/plugins/imptcp/imptcp.c b/plugins/imptcp/imptcp.c index 3197564e..c4fbab3d 100644 --- a/plugins/imptcp/imptcp.c +++ b/plugins/imptcp/imptcp.c @@ -1047,17 +1047,20 @@ CODESTARTwillRun ABORT_FINALIZE(RS_RET_NO_RUN); } -# if defined(EPOLL_CLOEXEC) && defined(HAVE_EPOLL_CREATE1) - DBGPRINTF("imptcp uses epoll_create1()\n"); - epollfd = epoll_create1(EPOLL_CLOEXEC); -# else +#if defined(EPOLL_CLOEXEC) && defined(HAVE_EPOLL_CREATE1) + DBGPRINTF("imptcp uses epoll_create1()\n"); + epollfd = epoll_create1(EPOLL_CLOEXEC); + if(epollfd < 0 && errno ENOSYS) +#endif + { DBGPRINTF("imptcp uses epoll_create()\n"); /* reading the docs, the number of epoll events passed to * epoll_create() seems not to be used at all in kernels. So * we just provide "a" number, happens to be 10. */ epollfd = epoll_create(10); -# endif + } + if(epollfd < 0) { errmsg.LogError(0, RS_RET_EPOLL_CR_FAILED, "error: epoll_create() failed"); ABORT_FINALIZE(RS_RET_NO_RUN); diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c index 56cdab28..a5002591 100644 --- a/plugins/imudp/imudp.c +++ b/plugins/imudp/imudp.c @@ -453,13 +453,16 @@ rsRetVal rcvMainLoop(thrdInfo_t *pThrd) CHKmalloc(udpEPollEvt = calloc(udpLstnSocks[0], sizeof(struct epoll_event))); -# if defined(EPOLL_CLOEXEC) && defined(HAVE_EPOLL_CREATE1) - DBGPRINTF("imudp uses epoll_create1()\n"); - efd = epoll_create1(EPOLL_CLOEXEC); -# else +#if defined(EPOLL_CLOEXEC) && defined(HAVE_EPOLL_CREATE1) + DBGPRINTF("imudp uses epoll_create1()\n"); + efd = epoll_create1(EPOLL_CLOEXEC); + if(efd < 0 && errno == ENOSYS) +#endif + { DBGPRINTF("imudp uses epoll_create()\n"); efd = epoll_create(NUM_EPOLL_EVENTS); -# endif + } + if(efd < 0) { DBGPRINTF("epoll_create1() could not create fd\n"); ABORT_FINALIZE(RS_RET_IO_ERROR); diff --git a/runtime/nsdpoll_ptcp.c b/runtime/nsdpoll_ptcp.c index bc374c60..ef9c37a3 100644 --- a/runtime/nsdpoll_ptcp.c +++ b/runtime/nsdpoll_ptcp.c @@ -133,13 +133,16 @@ delEvent(nsdpoll_epollevt_lst_t **ppEvtLst) { /* Standard-Constructor */ BEGINobjConstruct(nsdpoll_ptcp) /* be sure to specify the object type also in END macro! */ -# if defined(EPOLL_CLOEXEC) && defined(HAVE_EPOLL_CREATE1) - DBGPRINTF("nsdpoll_ptcp uses epoll_create1()\n"); - pThis->efd = epoll_create1(EPOLL_CLOEXEC); -# else +#if defined(EPOLL_CLOEXEC) && defined(HAVE_EPOLL_CREATE1) + DBGPRINTF("nsdpoll_ptcp uses epoll_create1()\n"); + pThis->efd = epoll_create1(EPOLL_CLOEXEC); + if(pThis->efd < 0 && errno == ENOSYS) +#endif + { DBGPRINTF("nsdpoll_ptcp uses epoll_create()\n"); pThis->efd = epoll_create(100); /* size is ignored in newer kernels, but 100 is not bad... */ -# endif + } + if(pThis->efd < 0) { DBGPRINTF("epoll_create1() could not create fd\n"); ABORT_FINALIZE(RS_RET_IO_ERROR); -- cgit v1.2.3 From 91d4e54a6707fa87298e367fb734fed931310b40 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 14 Mar 2011 09:24:57 +0100 Subject: fixed compile problem from epoll_create patch --- ChangeLog | 4 +++- plugins/imptcp/imptcp.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 320134e4..d5f855ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,9 +3,11 @@ Version 5.7.9 [V5-BETA] (rgerhards), 2011-03-?? - improved testbench among others, life tests for ommysql (against a test database) have been added, valgrind-based testing enhanced, ... +- enhance: fallback *at runtime* to epoll_create if epoll_create1 is not + available. Thanks to Michael Biebl for analysis and patch! - bugfix: minor memory leak in omlibdbi (< 1k per instance and run) - bugfix: (regression) omhdfs did no longer compile -- bugfix: omlibdbi did not use password from rsyslog.con +- bugfix: omlibdbi did not use password from rsyslog.conf closes: http://bugzilla.adiscon.com/show_bug.cgi?id=203 --------------------------------------------------------------------------- Version 5.7.8 [V5-BETA] (rgerhards), 2011-03-09 diff --git a/plugins/imptcp/imptcp.c b/plugins/imptcp/imptcp.c index c4fbab3d..e8cffbb0 100644 --- a/plugins/imptcp/imptcp.c +++ b/plugins/imptcp/imptcp.c @@ -1050,7 +1050,7 @@ CODESTARTwillRun #if defined(EPOLL_CLOEXEC) && defined(HAVE_EPOLL_CREATE1) DBGPRINTF("imptcp uses epoll_create1()\n"); epollfd = epoll_create1(EPOLL_CLOEXEC); - if(epollfd < 0 && errno ENOSYS) + if(epollfd < 0 && errno == ENOSYS) #endif { DBGPRINTF("imptcp uses epoll_create()\n"); -- cgit v1.2.3 From 33366f2f1e271f47edeed75f69d9885171e61ea0 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 14 Mar 2011 09:36:37 +0100 Subject: added the template modules to the things being checked during distcheck While they are not meant for production, interface changes may not show up if they are not included in distecheck. This may be distrubing to users. The chances is even greater as there usually is no need to compile and/or check these modules during regular development. --- Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.am b/Makefile.am index 4e3e9476..53c04922 100644 --- a/Makefile.am +++ b/Makefile.am @@ -233,5 +233,7 @@ DISTCHECK_CONFIGURE_FLAGS= --enable-gssapi_krb5 \ --enable-pmaixforwardedfrom \ --enable-pmcisconames \ --enable-pmsnare \ + --enable-imtemplate \ + --enable-omtemplate \ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) ACLOCAL_AMFLAGS = -I m4 -- cgit v1.2.3