epoll.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 EPOLLRDBAND 0x080
  19. #define EPOLLWRNORM 0x100
  20. #define EPOLLWRBAND 0x200
  21. #define EPOLLMSG 0x400
  22. #define EPOLLERR 0x008
  23. #define EPOLLHUP 0x010
  24. #define EPOLLRDHUP 0x2000
  25. #define EPOLLWAKEUP (1U<<29)
  26. #define EPOLLONESHOT (1U<<30)
  27. #define EPOLLET (1U<<31)
  28. #define EPOLL_CTL_ADD 1
  29. #define EPOLL_CTL_DEL 2
  30. #define EPOLL_CTL_MOD 3
  31. typedef union epoll_data {
  32. void *ptr;
  33. int fd;
  34. uint32_t u32;
  35. uint64_t u64;
  36. } epoll_data_t;
  37. struct epoll_event {
  38. uint32_t events;
  39. epoll_data_t data;
  40. }
  41. #ifdef __x86_64__
  42. __attribute__ ((__packed__))
  43. #endif
  44. ;
  45. int epoll_create(int);
  46. int epoll_create1(int);
  47. int epoll_ctl(int, int, int, struct epoll_event *);
  48. int epoll_wait(int, struct epoll_event *, int, int);
  49. int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif /* sys/epoll.h */