summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2011-03-13 12:09:06 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2011-03-14 09:18:43 +0100
commit4671cad51221f1cb03822481e46669ffba3c6d95 (patch)
tree61629a4d678a2dbf0b67d61f27200109248c2823 /runtime
parent6dbd70732a19a13bacae7b4bea07097458974cc9 (diff)
downloadrsyslog-4671cad51221f1cb03822481e46669ffba3c6d95.tar.gz
rsyslog-4671cad51221f1cb03822481e46669ffba3c6d95.tar.xz
rsyslog-4671cad51221f1cb03822481e46669ffba3c6d95.zip
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
Diffstat (limited to 'runtime')
-rw-r--r--runtime/nsdpoll_ptcp.c13
1 files changed, 8 insertions, 5 deletions
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);