epoll.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * epoll_create() / epoll_ctl() / epoll_wait() / epoll_pwait() for uClibc
  4. *
  5. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  6. *
  7. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  8. */
  9. #include <sys/syscall.h>
  10. #include <sys/epoll.h>
  11. #include <cancel.h>
  12. #ifdef __NR_epoll_create
  13. _syscall1(int, epoll_create, int, size)
  14. #endif
  15. #ifdef __NR_epoll_create1
  16. _syscall1(int, epoll_create1, int, flags)
  17. #endif
  18. #ifdef __NR_epoll_ctl
  19. _syscall4(int, epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, event)
  20. #endif
  21. #ifdef __NR_epoll_wait
  22. static int __NC(epoll_wait)(int epfd, struct epoll_event *events, int maxevents, int timeout)
  23. {
  24. return INLINE_SYSCALL(epoll_wait, 4, epfd, events, maxevents, timeout);
  25. }
  26. CANCELLABLE_SYSCALL(int, epoll_wait, (int epfd, struct epoll_event *events, int maxevents, int timeout),
  27. (epfd, events, maxevents, timeout))
  28. #endif
  29. #ifdef __NR_epoll_pwait
  30. # include <signal.h>
  31. # define __NR___syscall_epoll_pwait __NR_epoll_pwait
  32. static __always_inline _syscall6(int, __syscall_epoll_pwait, int, epfd, struct epoll_event *, events,
  33. int, maxevents, int, timeout, const sigset_t *, sigmask, size_t, sigsetsize)
  34. static int __NC(epoll_pwait)(int epfd, struct epoll_event *events, int maxevents, int timeout,
  35. const sigset_t *set)
  36. {
  37. return __syscall_epoll_pwait(epfd, events, maxevents, timeout, set, __SYSCALL_SIGSET_T_SIZE);
  38. }
  39. CANCELLABLE_SYSCALL(int, epoll_pwait, (int epfd, struct epoll_event *events, int maxevents, int timeout,
  40. const sigset_t *set),
  41. (epfd, events, maxevents, timeout, set))
  42. #endif