1
0

epoll.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #define __NEED_sigset_t
  9. #include <bits/alltypes.h>
  10. #define EPOLL_CLOEXEC 02000000
  11. #define EPOLL_NONBLOCK 04000
  12. enum EPOLL_EVENTS { __EPOLL_DUMMY };
  13. #define EPOLLIN 0x001
  14. #define EPOLLPRI 0x002
  15. #define EPOLLOUT 0x004
  16. #define EPOLLRDNORM 0x040
  17. #define EPOLLRDBAND 0x080
  18. #define EPOLLWRNORM 0x100
  19. #define EPOLLWRBAND 0x200
  20. #define EPOLLMSG 0x400
  21. #define EPOLLERR 0x008
  22. #define EPOLLHUP 0x010
  23. #define EPOLLRDHUP 0x2000
  24. #define EPOLLONESHOT (1U<<30)
  25. #define EPOLLET (1U<<31)
  26. #define EPOLL_CTL_ADD 1
  27. #define EPOLL_CTL_DEL 2
  28. #define EPOLL_CTL_MOD 3
  29. typedef union epoll_data {
  30. void *ptr;
  31. int fd;
  32. uint32_t u32;
  33. uint64_t u64;
  34. } epoll_data_t;
  35. struct epoll_event {
  36. uint32_t events;
  37. epoll_data_t data;
  38. } __attribute__ ((__packed__));
  39. int epoll_create(int);
  40. int epoll_create1(int);
  41. int epoll_ctl(int, int, int, struct epoll_event *);
  42. int epoll_wait(int, struct epoll_event *, int, int);
  43. int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif /* sys/epoll.h */