diff options
author | Marcin Juszkiewicz <marcin@juszkiewicz.com.pl> | 2014-01-22 11:17:35 +0100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-01-22 11:45:45 -0500 |
commit | dfe1e526f5bb9db3c0b28d848170f35521ebd314 (patch) | |
tree | dcde5919424e4cfda2b1a327f8c5a10ecf2f26a4 | |
parent | eaa79cd45954cdb4c10c4def1339c25c429b1fd9 (diff) | |
download | libevent-dfe1e526f5bb9db3c0b28d848170f35521ebd314.tar.gz |
Check does arch have the epoll_create and __NR_epoll_wait syscalls.
Some architectures (like AArch64) do not have deprecated syscalls.
Signed-off-by: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
-rw-r--r-- | epoll_sub.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/epoll_sub.c b/epoll_sub.c index 3738b26b..facbc09f 100644 --- a/epoll_sub.c +++ b/epoll_sub.c @@ -31,11 +31,20 @@ #include <sys/syscall.h> #include <sys/epoll.h> #include <unistd.h> +#include <errno.h> int epoll_create(int size) { +#if !defined(__NR_epoll_create) && defined(__NR_epoll_create1) + if (size <= 0) { + errno = EINVAL; + return -1; + } + return (syscall(__NR_epoll_create1, 0)); +#else return (syscall(__NR_epoll_create, size)); +#endif } int @@ -48,5 +57,9 @@ epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout) { +#if !defined(__NR_epoll_wait) && defined(__NR_epoll_pwait) + return (syscall(__NR_epoll_pwait, epfd, events, maxevents, timeout, NULL, 0)); +#else return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout)); +#endif } |