AUTHORS: Update contributor list and sort it alphabetically
[netsniff-ng.git] / epoll2.c
blob71a7ac6e4106245d64a6ead9ceef45b810bc9356
1 #include <sys/epoll.h>
2 #include <string.h>
4 #include "epoll2.h"
5 #include "die.h"
7 void set_epoll_descriptor(int fd_epoll, int action, int fd_toadd, int events)
9 int ret;
10 struct epoll_event ev;
12 memset(&ev, 0, sizeof(ev));
13 ev.events = events;
14 ev.data.fd = fd_toadd;
16 ret = epoll_ctl(fd_epoll, action, fd_toadd, &ev);
17 if (ret < 0)
18 panic("Cannot add socket for epoll!\n");
21 int set_epoll_descriptor2(int fd_epoll, int action, int fd_toadd, int events)
23 struct epoll_event ev;
25 memset(&ev, 0, sizeof(ev));
26 ev.events = events;
27 ev.data.fd = fd_toadd;
29 return epoll_ctl(fd_epoll, action, fd_toadd, &ev);