epoll.h 1.1 KB

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