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