epoll.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * epoll_create() / epoll_ctl() / epoll_wait() for uClibc
  4. *
  5. * Copyright (C) 2005 by Erik Andersen <andersen@codepoet.org>
  6. *
  7. * GNU Library General Public License (LGPL) version 2 or later.
  8. */
  9. #include "syscalls.h"
  10. #include <sys/epoll.h>
  11. /*
  12. * epoll_create()
  13. */
  14. #ifdef __NR_epoll_create
  15. #define __NR___syscall_epoll_create __NR_epoll_create
  16. static inline _syscall1(int, __syscall_epoll_create, int, size);
  17. #endif
  18. int epoll_create(int size)
  19. {
  20. #ifdef __NR_epoll_create
  21. return (__syscall_epoll_create(size));
  22. #else
  23. __set_errno(ENOSYS);
  24. return -1;
  25. #endif
  26. }
  27. /*
  28. * epoll_ctl()
  29. */
  30. #ifdef __NR_epoll_ctl
  31. #define __NR___syscall_epoll_ctl __NR_epoll_ctl
  32. static inline _syscall4(int, __syscall_epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, event);
  33. #endif
  34. int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
  35. {
  36. #ifdef __NR_epoll_ctl
  37. return (__syscall_epoll_ctl(epfd, op, fd, event));
  38. #else
  39. __set_errno(ENOSYS);
  40. return -1;
  41. #endif
  42. }
  43. /*
  44. * epoll_wait()
  45. */
  46. #ifdef __NR_epoll_wait
  47. #define __NR___syscall_epoll_wait __NR_epoll_wait
  48. static inline _syscall4(int, __syscall_epoll_wait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout);
  49. #endif
  50. int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
  51. {
  52. #ifdef __NR_epoll_wait
  53. return (__syscall_epoll_wait(epfd, events, maxevents, timeout));
  54. #else
  55. __set_errno(ENOSYS);
  56. return -1;
  57. #endif
  58. }