blob: 4b753839cdf46c5e99e65d03e5db70910859b4b9 [file] [log] [blame]
willy tarreau1c2ad212005-12-18 01:11:29 +01001/*
2 * Those constants were found both in glibc and in the Linux kernel.
3 * They are provided here because the epoll() syscall is featured in
4 * some kernels but in not often included in the glibc, so it needs
5 * just a basic definition.
6 */
7
8#include <linux/unistd.h>
9
10/* epoll_ctl() commands */
11#define EPOLL_CTL_ADD 1
12#define EPOLL_CTL_DEL 2
13#define EPOLL_CTL_MOD 3
14
15/* events types (bit fields) */
16#define EPOLLIN 1
17#define EPOLLPRI 2
18#define EPOLLOUT 4
19#define EPOLLERR 8
20#define EPOLLHUP 16
21#define EPOLLONESHOT (1 << 30)
22#define EPOLLET (1 << 31)
23
24struct epoll_event {
25 uint32_t events;
willy tarreau3c407cd2006-03-19 19:33:33 +010026 union {
willy tarreau1c2ad212005-12-18 01:11:29 +010027 void *ptr;
28 int fd;
29 uint32_t u32;
30 uint64_t u64;
31 } data;
32};
33
34
35#if defined(__powerpc__) || defined(__powerpc64__)
36#define __NR_epoll_create 236
37#define __NR_epoll_ctl 237
38#define __NR_epoll_wait 238
39#elif defined(__sparc__) || defined(__sparc64__)
40#define __NR_epoll_create 193
41#define __NR_epoll_ctl 194
42#define __NR_epoll_wait 195
43#elif defined(__x86_64__)
44#define __NR_epoll_create 213
45#define __NR_epoll_ctl 214
46#define __NR_epoll_wait 215
47#elif defined(__alpha__)
48#define __NR_sys_epoll_create 407
49#define __NR_sys_epoll_ctl 408
50#define __NR_sys_epoll_wait 409
51#elif defined (__i386__)
52#define __NR_epoll_create 254
53#define __NR_epoll_ctl 255
54#define __NR_epoll_wait 256
55#else
56#warning unsupported architecture, guessing __NR_epoll_create=254 like x86...
57#define __NR_epoll_create 254
58#define __NR_epoll_ctl 255
59#define __NR_epoll_wait 256
60#endif
61
62_syscall1 (int, epoll_create, int, size);
63_syscall4 (int, epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, event);
64_syscall4 (int, epoll_wait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout);