diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-08-25 11:38:00 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-08-25 11:38:00 +0000 |
commit | 425c584feb52e504c59491b4cffc7528d51e32c4 (patch) | |
tree | 8fd0787478bb22a1dfb6b914b922f53341c5f3b4 | |
parent | 3f94e1fbcd6f0e6a2b1082a6e0a93a1aa5e6344f (diff) |
Numerous changes to make this build..
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10268 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/socketengines/socketengine_poll.h | 1 | ||||
-rw-r--r-- | src/socketengines/socketengine_poll.cpp | 24 |
2 files changed, 14 insertions, 11 deletions
diff --git a/include/socketengines/socketengine_poll.h b/include/socketengines/socketengine_poll.h index c3ef6c51e..4669ecfba 100644 --- a/include/socketengines/socketengine_poll.h +++ b/include/socketengines/socketengine_poll.h @@ -24,6 +24,7 @@ #define __USE_XOPEN /* fuck every fucking OS ever made. needed by poll.h to work.*/ #endif #include <poll.h> +#include <sys/poll.h> class InspIRCd; diff --git a/src/socketengines/socketengine_poll.cpp b/src/socketengines/socketengine_poll.cpp index ddeb057d6..8a1ae6b9a 100644 --- a/src/socketengines/socketengine_poll.cpp +++ b/src/socketengines/socketengine_poll.cpp @@ -14,6 +14,8 @@ #include "inspircd.h" #include "exitcodes.h" #include "socketengines/socketengine_poll.h" +#include <poll.h> +#include <ulimit.h> PollEngine::PollEngine(InspIRCd* Instance) : SocketEngine(Instance) { @@ -21,9 +23,9 @@ PollEngine::PollEngine(InspIRCd* Instance) : SocketEngine(Instance) CurrentSetSize = 0; ref = new EventHandler* [GetMaxFds()]; - events = new struct epoll_event[GetMaxFds()]; + events = new struct pollfd[GetMaxFds()]; - memset(&events, 0, GetMaxFds() * sizeof(struct pollfds*)); + memset(&events, 0, GetMaxFds() * sizeof(struct pollfd*)); } PollEngine::~PollEngine() @@ -55,24 +57,24 @@ bool PollEngine::AddFd(EventHandler* eh) } ref[fd] = eh; - events[fd]->fd = fd; + events[fd].fd = fd; if (eh->Readable()) { - events[fd]->events = POLLIN; + events[fd].events = POLLIN; } else { - events[fd]->events = POLLOUT; + events[fd].events = POLLOUT; } - ServerInstance->Log(DEBUG,"New file descriptor: %d (%d)", fd, events[fd]->events); + ServerInstance->Logs->Log("SOCKET", DEBUG,"New file descriptor: %d (%d)", fd, events[fd].events); CurrentSetSize++; return true; } void PollEngine::WantWrite(EventHandler* eh) { - events[eh->GetFd()]->events = POLLIN | POLLOUT; + events[eh->GetFd()].events = POLLIN | POLLOUT; } bool PollEngine::DelFd(EventHandler* eh, bool force) @@ -80,17 +82,17 @@ bool PollEngine::DelFd(EventHandler* eh, bool force) int fd = eh->GetFd(); if ((fd < 0) || (fd > MAX_DESCRIPTORS)) { - ServerInstance->Logs->Log("SOCKET",DEBUG,"DelFd out of range: (fd: %d, max: %d)", fd, GetMaxFds()); + ServerInstance->Logs->Log("SOCKET", DEBUG, "DelFd out of range: (fd: %d, max: %d)", fd, GetMaxFds()); return false; } - events[fd]->fd = -1; - events[fd]->events = 0; + events[fd].fd = -1; + events[fd].events = 0; CurrentSetSize--; ref[fd] = NULL; - ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET", DEBUG, "Remove file descriptor: %d", fd); return true; } |