1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 23:26:39 +02:00

Use getrlimit instead of ulimit, fixes freebsd build

This commit is contained in:
Adam
2011-07-07 02:23:11 -04:00
parent 1a4fc39d7b
commit d2832b1045
+8 -11
View File
@@ -1,9 +1,11 @@
#include "module.h"
#ifndef _WIN32
# include <ulimit.h>
# include <sys/poll.h>
# include <poll.h>
# include <sys/types.h>
# include <sys/time.h>
# include <sys/resource.h>
# ifndef POLLRDHUP
# define POLLRDHUP 0
# endif
@@ -20,17 +22,12 @@ static std::map<int, int> socket_positions;
void SocketEngine::Init()
{
SocketCount = 0;
#ifndef _WIN32
max = ulimit(4, 0);
#else
max = 1024;
#endif
if (max <= 0)
{
Log() << "Can't determine maximum number of open sockets";
throw CoreException("Can't determine maximum number of open sockets");
}
rlimit fd_limit;
if (getrlimit(RLIMIT_NOFILE, &fd_limit) == -1)
throw CoreException(Anope::LastError());
max = fd_limit.rlim_cur;
events = new pollfd[max];
}