epoll.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 EPOLLEXCLUSIVE (1U<<28)
  26. #define EPOLLWAKEUP (1U<<29)
  27. #define EPOLLONESHOT (1U<<30)
  28. #define EPOLLET (1U<<31)
  29. #define EPOLL_CTL_ADD 1
  30. #define EPOLL_CTL_DEL 2
  31. #define EPOLL_CTL_MOD 3
  32. typedef union epoll_data {
  33. void *ptr;
  34. int fd;
  35. uint32_t u32;
  36. uint64_t u64;
  37. } epoll_data_t;
  38. struct epoll_event {
  39. uint32_t events;
  40. epoll_data_t data;
  41. }
  42. #ifdef __x86_64__
  43. __attribute__ ((__packed__))
  44. #endif
  45. ;
  46. int epoll_create(int);
  47. int epoll_create1(int);
  48. int epoll_ctl(int, int, int, struct epoll_event *);
  49. int epoll_wait(int, struct epoll_event *, int, int);
  50. int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif /* sys/epoll.h */