/*
- * events.c: the event handling core, poll() version
+ * events.c: the event handling core, epoll() version
*/
#include <stdio.h>
/* Get an epoll FD */
if ((epollfd=epoll_create(STARTFDS))<0) {
- Error("events",ERR_FATAL,"Unable to initialise epoll.");
+ Error("events",ERR_STOP,"Unable to initialise epoll.");
}
registerhook(HOOK_CORE_STATSREQUEST, &eventstats);
}
+void finihandlers() {
+ deregisterhook(HOOK_CORE_STATSREQUEST, &eventstats);
+ free(eventhandlers);
+}
+
/*
* checkindex():
* Given the number of a new file descriptor, makes sure that the array
eventhandlers[fd].handler=handler;
+ memset(&epe, 0, sizeof(epe));
epe.data.fd=fd;
epe.events=polltoepoll(events);
void eventstats(int hooknum, void *arg) {
char buf[512];
- int level=(int) arg;
+ long level=(long) arg;
if (level>5) {
sprintf(buf,"Events :%7d fds registered, %7d fds deregistered",eventadds,eventdels);