0ff3d491ab7be387e46fea5b1b0d7fa973a03424
[musl] / include / sys / epoll.h
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 EPOLLRDBAND 0x080
25 #define EPOLLWRNORM 0x100
26 #define EPOLLWRBAND 0x200
27 #define EPOLLMSG 0x400
28 #define EPOLLERR 0x008
29 #define EPOLLHUP 0x010
30 #define EPOLLRDHUP 0x2000
31 #define EPOLLONESHOT (1U<<30)
32 #define EPOLLET (1U<<31)
33
34 #define EPOLL_CTL_ADD 1
35 #define EPOLL_CTL_DEL 2
36 #define EPOLL_CTL_MOD 3
37
38 typedef union epoll_data {
39         void *ptr;
40         int fd;
41         uint32_t u32;
42         uint64_t u64;
43 } epoll_data_t;
44
45 struct epoll_event {
46         uint32_t events;
47         epoll_data_t data;
48 } __attribute__ ((__packed__));
49
50
51 int epoll_create(int);
52 int epoll_create1(int);
53 int epoll_ctl(int, int, int, struct epoll_event *);
54 int epoll_wait(int, struct epoll_event *, int, int);
55 int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
56
57
58 #ifdef __cplusplus
59 }
60 #endif
61
62 #endif /* sys/epoll.h */