summaryrefslogtreecommitdiff
path: root/src/socketengines
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2017-07-12 14:25:28 +0100
committerGitHub <noreply@github.com>2017-07-12 14:25:28 +0100
commitf471083cd0519d47c7c7a09029813ede41994f7b (patch)
tree26d756d60526de438b501fd3da71bffe9e551455 /src/socketengines
parent2f64744dd81cd956780160e8568a42cf952df6c8 (diff)
parentc0aba5b728b0a921d95ec120aa638dab1520b42f (diff)
Merge pull request #1337 from SaberUK/master+merge
Merge v2.0.23 and v2.0.24 into master.
Diffstat (limited to 'src/socketengines')
-rw-r--r--src/socketengines/socketengine_epoll.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp
index a935d786b..c442e340d 100644
--- a/src/socketengines/socketengine_epoll.cpp
+++ b/src/socketengines/socketengine_epoll.cpp
@@ -22,7 +22,7 @@
#include "exitcodes.h"
#include <sys/epoll.h>
-#include <ulimit.h>
+#include <sys/resource.h>
#include <iostream>
/** A specialisation of the SocketEngine class, designed to use linux 2.6 epoll().
@@ -38,8 +38,12 @@ namespace
void SocketEngine::Init()
{
- // MAX_DESCRIPTORS is mainly used for display purposes, no problem if ulimit() fails and returns a negative number
- MAX_DESCRIPTORS = ulimit(4, 0);
+ // MAX_DESCRIPTORS is mainly used for display purposes, no problem if getrlimit() fails
+ struct rlimit limit;
+ if (!getrlimit(RLIMIT_NOFILE, &limit))
+ {
+ MAX_DESCRIPTORS = limit.rlim_cur;
+ }
// 128 is not a maximum, just a hint at the eventual number of sockets that may be polled,
// and it is completely ignored by 2.6.8 and later kernels, except it must be larger than zero.