summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-12-17 14:59:44 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-12-17 14:59:44 +0100
commit8d862730d297cbf88d9301b7a4cbee47a3f8fb9e (patch)
tree45daabe8ff0b0cdcfa27fb29eff1f34250a9dcbd
parentcc8237736d11b54a3d6089d836da7ccb6972a29c (diff)
downloadrsyslog-8d862730d297cbf88d9301b7a4cbee47a3f8fb9e.tar.gz
rsyslog-8d862730d297cbf88d9301b7a4cbee47a3f8fb9e.tar.xz
rsyslog-8d862730d297cbf88d9301b7a4cbee47a3f8fb9e.zip
added support for systems without epoll_create1()
-rw-r--r--configure.ac2
-rw-r--r--plugins/imptcp/imptcp.c20
2 files changed, 20 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index b5c2d1c2..8e940e53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,7 +105,7 @@ AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_STRERROR_R
AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([flock basename alarm clock_gettime gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setid socket strcasecmp strchr strdup strerror strndup strnlen strrchr strstr strtol strtoul uname ttyname_r epoll_wait getline malloc_trim prctl fdatasync lseek64])
+AC_CHECK_FUNCS([flock basename alarm clock_gettime gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setid socket strcasecmp strchr strdup strerror strndup strnlen strrchr strstr strtol strtoul uname ttyname_r epoll_wait getline malloc_trim prctl epoll_create epoll_create1 fdatasync lseek64])
# Check for MAXHOSTNAMELEN
AC_MSG_CHECKING(for MAXHOSTNAMELEN)
diff --git a/plugins/imptcp/imptcp.c b/plugins/imptcp/imptcp.c
index 93906ba0..2afb340f 100644
--- a/plugins/imptcp/imptcp.c
+++ b/plugins/imptcp/imptcp.c
@@ -30,6 +30,13 @@
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*/
#include "config.h"
+#if !defined(HAVE_EPOLL_CREATE)
+# error imptcp requires OS support for epoll - can not build
+ /* imptcp gains speed by using modern Linux capabilities. As such,
+ * it can only be build on platforms supporting the epoll API.
+ */
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
@@ -1040,7 +1047,18 @@ CODESTARTwillRun
ABORT_FINALIZE(RS_RET_NO_RUN);
}
- if((epollfd = epoll_create1(EPOLL_CLOEXEC)) < 0) {
+# if defined(EPOLL_CLOEXEC) && defined(HAVE_EPOLL_CREATE1)
+ DBGPRINTF("imptcp uses epoll_create1()\n");
+ epollfd = epoll_create1(EPOLL_CLOEXEC);
+# else
+ 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);
}