VSF Documented
epoll.h
Go to the documentation of this file.
1#ifndef __VSF_LINUX_SYS_EPOLL_H__
2#define __VSF_LINUX_SYS_EPOLL_H__
3
5
6#if VSF_LINUX_CFG_RELATIVE_PATH == ENABLED
7# include "../sys/types.h"
8# include "../fcntl.h"
9# include "../poll.h"
10#else
11# include <sys/types.h>
12# include <fcntl.h>
13# include <poll.h>
14#endif
15#include <stdint.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#define EPOLL_CLOEXEC O_CLOEXEC
22
23#define EPOLL_CTL_ADD 0
24#define EPOLL_CTL_MOD 1
25#define EPOLL_CTL_DEL 2
26
27#define EPOLLIN POLLIN
28#define EPOLLOUT POLLOUT
29#define EPOLLHUP POLLHUP
30#define EPOLLERR POLLERR
31#define EPOLLPRI POLLPRI
32
33#define EPOLLET (1 << 16)
34#define EPOLLONESHOT (1 << 17)
35#define EPOLLWAKEUP (1 << 18)
36#define EPOLLEXCLUSIVE (1 << 19)
37
44
49
50#if VSF_LINUX_CFG_WRAPPER == ENABLED
51#define epoll_create VSF_LINUX_WRAPPER(epoll_create)
52#define epoll_create1 VSF_LINUX_WRAPPER(epoll_create1)
53#define epoll_ctl VSF_LINUX_WRAPPER(epoll_ctl)
54#define epoll_wait VSF_LINUX_WRAPPER(epoll_wait)
55#define epoll_pwait VSF_LINUX_WRAPPER(epoll_pwait)
56#define epoll_pwait2 VSF_LINUX_WRAPPER(epoll_pwait2)
57#endif
58
59// syscalls
60
61#define __NR_epoll_create epoll_create
62#define __NR_epoll_create1 epoll_create1
63#define __NR_epoll_ctl epoll_ctl
64#define __NR_epoll_wait epoll_wait
65#define __NR_epoll_pwait(__epfd, __events, __maxevents, __timeout, __set, __set_size)\
66 epoll_pwait((__epfd), (__events), (__maxevents), (__timeout), (__set))
67
68#if VSF_LINUX_APPLET_USE_SYS_EPOLL == ENABLED
80# ifndef __VSF_APPLET__
82# endif
83#endif
84
85#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_SYS_EPOLL_LIB__))\
86 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_APPLET_USE_SYS_EPOLL == ENABLED
87
88#ifndef VSF_LINUX_APPLET_SYS_EPOLL_VPLT
89# if VSF_LINUX_USE_APPLET == ENABLED
90# define VSF_LINUX_APPLET_SYS_EPOLL_VPLT \
91 ((vsf_linux_sys_epoll_vplt_t *)(VSF_LINUX_APPLET_VPLT->sys_epoll_vplt))
92# else
93# define VSF_LINUX_APPLET_SYS_EPOLL_VPLT \
94 ((vsf_linux_sys_epoll_vplt_t *)vsf_vplt((void *)0))
95# endif
96#endif
97
98#define VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(__NAME) \
99 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_SYS_EPOLL_VPLT, __NAME)
100#define VSF_LINUX_APPLET_SYS_EPOLL_IMP(...) \
101 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_SYS_EPOLL_VPLT, __VA_ARGS__)
102
103VSF_LINUX_APPLET_SYS_EPOLL_IMP(epoll_create, int, int size) {
105 return VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(epoll_create)(size);
106}
107VSF_LINUX_APPLET_SYS_EPOLL_IMP(epoll_create1, int, int flags) {
109 return VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(epoll_create1)(flags);
110}
111VSF_LINUX_APPLET_SYS_EPOLL_IMP(epoll_ctl, int, int epfd, int op, int fd, struct epoll_event *event) {
113 return VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(epoll_ctl)(epfd, op, fd, event);
114}
115VSF_LINUX_APPLET_SYS_EPOLL_IMP(epoll_wait, int, int epfd, struct epoll_event *events, int maxevents, int timeout) {
117 return VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(epoll_wait)(epfd, events, maxevents, timeout);
118}
119VSF_LINUX_APPLET_SYS_EPOLL_IMP(epoll_pwait, int, int epfd, struct epoll_event *events, int maxevents, int timeout, const sigset_t *sigmask) {
121 return VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(epoll_pwait)(epfd, events, maxevents, timeout, sigmask);
122}
123VSF_LINUX_APPLET_SYS_EPOLL_IMP(epoll_pwait2, int, int epfd, struct epoll_event *events, int maxevents, const struct timespec *timeout, const sigset_t *sigmask) {
125 return VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(epoll_pwait2)(epfd, events, maxevents, timeout, sigmask);
126}
127
128#else // __VSF_APPLET__ && VSF_LINUX_APPLET_USE_SYS_EPOLL
129
130int epoll_create(int size);
131int epoll_create1(int flags);
132int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
133int epoll_wait(int epfd, struct epoll_event *events,
134 int maxevents, int timeout);
135int epoll_pwait(int epfd, struct epoll_event *events,
136 int maxevents, int timeout,
137 const sigset_t *sigmask);
138int epoll_pwait2(int epfd, struct epoll_event *events,
139 int maxevents, const struct timespec *timeout,
140 const sigset_t *sigmask);
141
142#endif // __VSF_APPLET__ && VSF_LINUX_APPLET_USE_SYS_EPOLL
143
144#ifdef __cplusplus
145}
146#endif
147
148#endif
#define epoll_ctl
Definition epoll.h:53
#define epoll_create1
Definition epoll.h:52
#define epoll_pwait2
Definition epoll.h:56
__VSF_VPLT_DECORATOR__ vsf_linux_sys_epoll_vplt_t vsf_linux_sys_epoll_vplt
Definition vsf_linux_fs.c:3941
#define epoll_pwait
Definition epoll.h:55
#define epoll_create
Definition epoll.h:51
struct vsf_linux_sys_epoll_vplt_t vsf_linux_sys_epoll_vplt_t
#define epoll_wait
Definition epoll.h:54
union epoll_data epoll_data_t
struct epoll_event VSF_CAL_PACKED
__le16 timeout
Definition ieee80211.h:94
unsigned uint32_t
Definition stdint.h:9
unsigned long long uint64_t
Definition stdint.h:11
Definition epoll.h:45
uint32_t events
Definition epoll.h:46
epoll_data_t data
Definition epoll.h:47
Definition signal.h:131
Definition time.h:67
Definition epoll.h:69
VSF_APPLET_VPLT_ENTRY_MOD_DEF(libsys_epoll)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(epoll_pwait)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(epoll_create)
vsf_vplt_info_t info
Definition epoll.h:70
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(epoll_wait)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(epoll_ctl)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(epoll_create1)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(epoll_pwait2)
Definition epoll.h:38
uint64_t u64
Definition epoll.h:42
uint32_t u32
Definition epoll.h:41
void * ptr
Definition epoll.h:39
int fd
Definition epoll.h:40
Definition vsf_cfg.h:95
#define __VSF_VPLT_DECORATOR__
Definition vsf_cfg.h:93
#define VSF_APPLET_VPLT_ENTRY_FUNC_TRACE()
Definition vsf_cfg.h:165
uint32_t size
Definition vsf_memfs.h:50
struct event_t events[32]
Definition vsf_xboot.c:36
Generated from commit: vsfteam/vsf@2a137b0