2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright (c) 2014, Joyent, Inc. All rights reserved.
19 #include <sys/types.h>
26 typedef union epoll_data
{
33 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
37 typedef struct epoll_event
{
38 uint32_t events
; /* events */
39 epoll_data_t data
; /* user-specified data */
42 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
47 * Define the EPOLL* constants in terms of their poll(2)/poll(7) equivalents.
48 * Note that the values match the equivalents in Linux to allow for any binary
49 * compatibility layers to not need to translate them.
51 #define EPOLLIN 0x0001
52 #define EPOLLPRI 0x0002
53 #define EPOLLOUT 0x0004
54 #define EPOLLRDNORM 0x0040
55 #define EPOLLRDBAND 0x0080
56 #define EPOLLWRNORM 0x0100
57 #define EPOLLWRBAND 0x0200
58 #define EPOLLMSG 0x0400 /* not used */
59 #define EPOLLERR 0x0008
60 #define EPOLLHUP 0x0010
61 #define EPOLLRDHUP 0x2000
63 #define EPOLLWAKEUP (1UL << 29) /* no meaning; silently ignored */
64 #define EPOLLONESHOT (1UL << 30) /* translated to POLLONESHOT */
65 #define EPOLLET (1UL << 31) /* translated to POLLET */
67 #define EPOLL_CTL_ADD 1
68 #define EPOLL_CTL_DEL 2
69 #define EPOLL_CTL_MOD 3
71 #define EPOLL_CLOEXEC 02000000
75 extern int epoll_create(int size
);
76 extern int epoll_create1(int flags
);
77 extern int epoll_ctl(int epfd
, int op
, int fd
, struct epoll_event
*event
);
78 extern int epoll_wait(int epfd
, struct epoll_event
*events
,
79 int maxevents
, int timeout
);
80 extern int epoll_pwait(int epfd
, struct epoll_event
*events
,
81 int maxevents
, int timeout
, const sigset_t
*sigmask
);
89 #endif /* _SYS_EPOLL_H */