1
0

epoll.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef _SYS_EPOLL_H
  2. #define _SYS_EPOLL_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <stdint.h>
  7. #include <sys/types.h>
  8. #include <fcntl.h>
  9. #define __NEED_sigset_t
  10. #include <bits/alltypes.h>
  11. #define EPOLL_CLOEXEC O_CLOEXEC
  12. #define EPOLL_NONBLOCK O_NONBLOCK
  13. enum EPOLL_EVENTS { __EPOLL_DUMMY };
  14. #define EPOLLIN 0x001
  15. #define EPOLLPRI 0x002
  16. #define EPOLLOUT 0x004
  17. #define EPOLLRDNORM 0x040
  18. #define EPOLLNVAL 0x020
  19. #define EPOLLRDBAND 0x080
  20. #define EPOLLWRNORM 0x100
  21. #define EPOLLWRBAND 0x200
  22. #define EPOLLMSG 0x400
  23. #define EPOLLERR 0x008
  24. #define EPOLLHUP 0x010
  25. #define EPOLLRDHUP 0x2000
  26. #define EPOLLEXCLUSIVE (1U<<28)
  27. #define EPOLLWAKEUP (1U<<29)
  28. #define EPOLLONESHOT (1U<<30)
  29. #define EPOLLET (1U<<31)
  30. #define EPOLL_CTL_ADD 1
  31. #define EPOLL_CTL_DEL 2
  32. #define EPOLL_CTL_MOD 3
  33. typedef union epoll_data {
  34. void *ptr;
  35. int fd;
  36. uint32_t u32;
  37. uint64_t u64;
  38. } epoll_data_t;
  39. struct epoll_event {
  40. uint32_t events;
  41. epoll_data_t data;
  42. }
  43. #ifdef __x86_64__
  44. __attribute__ ((__packed__))
  45. #endif
  46. ;
  47. int epoll_create(int);
  48. int epoll_create1(int);
  49. int epoll_ctl(int, int, int, struct epoll_event *);
  50. int epoll_wait(int, struct epoll_event *, int, int);
  51. int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif /* sys/epoll.h */