mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
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>
This commit is contained in:
parent
eaa79cd459
commit
dfe1e526f5
13
epoll_sub.c
13
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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user