1 /* vi: set sw=4 ts=4: */
3 * epoll_create() / epoll_ctl() / epoll_wait() / epoll_pwait() for uClibc
5 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
7 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
10 #include <sys/syscall.h>
11 #include <sys/epoll.h>
14 #ifdef __NR_epoll_create
15 _syscall1(int, epoll_create, int, size)
18 #ifdef __NR_epoll_create1
19 _syscall1(int, epoll_create1, int, flags)
22 #if defined __NR_epoll_create1 && !defined __NR_epoll_create
23 int epoll_create(int size)
25 return INLINE_SYSCALL(epoll_create1, 1, 0);
31 _syscall4(int, epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, event)
34 #ifdef __NR_epoll_wait
35 static int __NC(epoll_wait)(int epfd, struct epoll_event *events, int maxevents, int timeout)
37 return INLINE_SYSCALL(epoll_wait, 4, epfd, events, maxevents, timeout);
39 CANCELLABLE_SYSCALL(int, epoll_wait, (int epfd, struct epoll_event *events, int maxevents, int timeout),
40 (epfd, events, maxevents, timeout))
43 #ifdef __NR_epoll_pwait
46 # define __NR___syscall_epoll_pwait __NR_epoll_pwait
47 static __always_inline _syscall6(int, __syscall_epoll_pwait, int, epfd, struct epoll_event *, events,
48 int, maxevents, int, timeout, const sigset_t *, sigmask, size_t, sigsetsize)
50 static int __NC(epoll_pwait)(int epfd, struct epoll_event *events, int maxevents, int timeout,
53 return __syscall_epoll_pwait(epfd, events, maxevents, timeout, set, __SYSCALL_SIGSET_T_SIZE);
55 CANCELLABLE_SYSCALL(int, epoll_pwait, (int epfd, struct epoll_event *events, int maxevents, int timeout,
57 (epfd, events, maxevents, timeout, set))
59 * If epoll_wait is not defined, then call epoll_pwait instead using NULL
60 * for sigmask argument
62 # ifndef __NR_epoll_wait
64 int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
66 return INLINE_SYSCALL(epoll_pwait, 5, epfd, events, maxevents, timeout, NULL);