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