OLD | NEW |
1 #include <sys/epoll.h> | 1 #include <sys/epoll.h> |
2 #include <signal.h> | 2 #include <signal.h> |
3 #include <errno.h> | 3 #include <errno.h> |
4 #include "syscall.h" | 4 #include "syscall.h" |
5 | 5 |
6 int epoll_create(int size) | 6 int epoll_create(int size) { |
7 { | 7 return epoll_create1(0); |
8 » return epoll_create1(0); | |
9 } | 8 } |
10 | 9 |
11 int epoll_create1(int flags) | 10 int epoll_create1(int flags) { |
12 { | 11 int r = __syscall(SYS_epoll_create1, flags); |
13 » int r = __syscall(SYS_epoll_create1, flags); | |
14 #ifdef SYS_epoll_create | 12 #ifdef SYS_epoll_create |
15 » if (r==-ENOSYS && !flags) r = __syscall(SYS_epoll_create, 1); | 13 if (r == -ENOSYS && !flags) |
| 14 r = __syscall(SYS_epoll_create, 1); |
16 #endif | 15 #endif |
17 » return __syscall_ret(r); | 16 return __syscall_ret(r); |
18 } | 17 } |
19 | 18 |
20 int epoll_ctl(int fd, int op, int fd2, struct epoll_event *ev) | 19 int epoll_ctl(int fd, int op, int fd2, struct epoll_event* ev) { |
21 { | 20 return syscall(SYS_epoll_ctl, fd, op, fd2, ev); |
22 » return syscall(SYS_epoll_ctl, fd, op, fd2, ev); | |
23 } | 21 } |
24 | 22 |
25 int epoll_pwait(int fd, struct epoll_event *ev, int cnt, int to, const sigset_t
*sigs) | 23 int epoll_pwait(int fd, |
26 { | 24 struct epoll_event* ev, |
27 » int r = __syscall(SYS_epoll_pwait, fd, ev, cnt, to, sigs, _NSIG/8); | 25 int cnt, |
| 26 int to, |
| 27 const sigset_t* sigs) { |
| 28 int r = __syscall(SYS_epoll_pwait, fd, ev, cnt, to, sigs, _NSIG / 8); |
28 #ifdef SYS_epoll_wait | 29 #ifdef SYS_epoll_wait |
29 » if (r==-ENOSYS && !sigs) r = __syscall(SYS_epoll_wait, fd, ev, cnt, to); | 30 if (r == -ENOSYS && !sigs) |
| 31 r = __syscall(SYS_epoll_wait, fd, ev, cnt, to); |
30 #endif | 32 #endif |
31 » return __syscall_ret(r); | 33 return __syscall_ret(r); |
32 } | 34 } |
33 | 35 |
34 int epoll_wait(int fd, struct epoll_event *ev, int cnt, int to) | 36 int epoll_wait(int fd, struct epoll_event* ev, int cnt, int to) { |
35 { | 37 return epoll_pwait(fd, ev, cnt, to, 0); |
36 » return epoll_pwait(fd, ev, cnt, to, 0); | |
37 } | 38 } |
OLD | NEW |