Am 13.03.2011 11:37, schrieb Rainer Gerhards: >> -----Original Message----- >> From: Michael Biebl [mailto:bi...@debian.org] >> Sent: Sunday, March 13, 2011 11:22 AM >> To: Phil Dibowitz; 617...@bugs.debian.org; Rainer Gerhards >> Cc: cont...@bugs.debian.org >> Subject: Re: Bug#617996: rsyslog: remote syslog messages not logged >>
>> >> Rainer, the epoll usage in rsyslog should apply runtime checks when >> using epoll >> and fall back gracefully. the following was suggested in a similar >> situation [1]: > > Mmmhhhh... Is that really something we need to support? I can think of many > other places where the code relies on the outcome of configure. If I need to > redo all (well: some of) the configure checks at runtime, the codebase gets > really complicated and probably hard to maintain. > > So far, I assumed that the configure checks are sufficient to build the code. To build the code, yes. > Wouldn't it then be better to just disable epoll support in the regularly > distributed version and only have it activated for folks that build the code > for a specific environment? That sounds much more clean to me (it has a > price, of course, but if we want to support very old systems at all costs, we > need to pay a price...). I'd say, let's fix issues when they come up and let's not be too pro-active. Attached is a very simple (though untested) patch, which imho doesn't really complicate the code. Phil, could you please try that patch. Compile it using your new kernel, test rsyslog using your new kernel, the boot the old kernel again and see if it still works correctly. Cheers, Michael -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
diff --git a/plugins/imptcp/imptcp.c b/plugins/imptcp/imptcp.c index 3197564..c4fbab3 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 56cdab2..a500259 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 bc374c6..ef9c37a 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);
signature.asc
Description: OpenPGP digital signature