summaryrefslogtreecommitdiff
path: root/plugins/imptcp
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2010-11-30 15:09:49 +0100
committerMichael Biebl <biebl@debian.org>2010-11-30 15:09:49 +0100
commit0a5a3fba01d42ef3b380c4ae27699bb42c3af493 (patch)
treecba36f6ed3cf72059d16e4e702be01325c1f73c7 /plugins/imptcp
parent7e2b1add5ffd1d726801b5f3806c7e26f493c3e9 (diff)
downloadrsyslog-0a5a3fba01d42ef3b380c4ae27699bb42c3af493.tar.gz
Imported Upstream version 5.7.2upstream/5.7.2
Diffstat (limited to 'plugins/imptcp')
-rw-r--r--plugins/imptcp/imptcp.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/plugins/imptcp/imptcp.c b/plugins/imptcp/imptcp.c
index 9b24dbc..6449ad6 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>
@@ -1039,7 +1046,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);
}