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
38typedef union epoll_data {
39 void *ptr;
40 int fd;
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
71
79# ifndef __VSF_APPLET__
81# endif
82#endif
83
84#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_SYS_EPOLL_LIB__))\
85 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_APPLET_USE_SYS_EPOLL == ENABLED
86
87#ifndef VSF_LINUX_APPLET_SYS_EPOLL_VPLT
88# if VSF_LINUX_USE_APPLET == ENABLED
89# define VSF_LINUX_APPLET_SYS_EPOLL_VPLT \
90 ((vsf_linux_sys_epoll_vplt_t *)(VSF_LINUX_APPLET_VPLT->sys_epoll_vplt))
91# else
92# define VSF_LINUX_APPLET_SYS_EPOLL_VPLT \
93 ((vsf_linux_sys_epoll_vplt_t *)vsf_vplt((void *)0))
94# endif
95#endif
96
97#define VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(__NAME) \
98 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_SYS_EPOLL_VPLT, __NAME)
99#define VSF_LINUX_APPLET_SYS_EPOLL_IMP(...) \
100 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_SYS_EPOLL_VPLT, __VA_ARGS__)
101
102VSF_LINUX_APPLET_SYS_EPOLL_IMP(epoll_create, int, int size) {
104 return VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(epoll_create)(size);
105}
106VSF_LINUX_APPLET_SYS_EPOLL_IMP(epoll_create1, int, int flags) {
108 return VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(epoll_create1)(flags);
109}
110VSF_LINUX_APPLET_SYS_EPOLL_IMP(epoll_ctl, int, int epfd, int op, int fd, struct epoll_event *event) {
112 return VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(epoll_ctl)(epfd, op, fd, event);
113}
114VSF_LINUX_APPLET_SYS_EPOLL_IMP(epoll_wait, int, int epfd, struct epoll_event *events, int maxevents, int timeout) {
116 return VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(epoll_wait)(epfd, events, maxevents, timeout);
117}
118VSF_LINUX_APPLET_SYS_EPOLL_IMP(epoll_pwait, int, int epfd, struct epoll_event *events, int maxevents, int timeout, const sigset_t *sigmask) {
120 return VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(epoll_pwait)(epfd, events, maxevents, timeout, sigmask);
121}
122VSF_LINUX_APPLET_SYS_EPOLL_IMP(epoll_pwait2, int, int epfd, struct epoll_event *events, int maxevents, const struct timespec *timeout, const sigset_t *sigmask) {
124 return VSF_LINUX_APPLET_SYS_EPOLL_ENTRY(epoll_pwait2)(epfd, events, maxevents, timeout, sigmask);
125}
126
127#else // __VSF_APPLET__ && VSF_LINUX_APPLET_USE_SYS_EPOLL
128
129int epoll_create(int size);
130int epoll_create1(int flags);
131int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
132int epoll_wait(int epfd, struct epoll_event *events,
133 int maxevents, int timeout);
134int epoll_pwait(int epfd, struct epoll_event *events,
135 int maxevents, int timeout,
136 const sigset_t *sigmask);
137int epoll_pwait2(int epfd, struct epoll_event *events,
138 int maxevents, const struct timespec *timeout,
139 const sigset_t *sigmask);
140
141#endif // __VSF_APPLET__ && VSF_LINUX_APPLET_USE_SYS_EPOLL
142
143#ifdef __cplusplus
144}
145#endif
146
147#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:3569
#define epoll_pwait
Definition epoll.h:55
#define epoll_create
Definition epoll.h:51
#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:66
Definition epoll.h:69
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