@@ -10,6 +10,8 @@ module core.sys.linux.epoll;
10
10
11
11
version (linux ):
12
12
13
+ import core.sys.posix.signal : sigset_t;
14
+
13
15
extern (C ):
14
16
@system :
15
17
@nogc :
52
54
EPOLLHUP = 0x010 ,
53
55
EPOLLRDHUP = 0x2000 , // since Linux 2.6.17
54
56
EPOLLEXCLUSIVE = 1u << 28 , // since Linux 4.5
57
+ EPOLLWAKEUP = 1u << 29 ,
55
58
EPOLLONESHOT = 1u << 30 ,
56
59
EPOLLET = 1u << 31
57
60
}
58
61
59
- /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
62
+ /**
63
+ * Valid opcodes ( "op" parameter ) to issue to epoll_ctl().
64
+ */
60
65
enum
61
66
{
62
- EPOLL_CTL_ADD = 1 , // Add a file descriptor to the interface.
63
- EPOLL_CTL_DEL = 2 , // Remove a file descriptor from the interface.
64
- EPOLL_CTL_MOD = 3 , // Change file descriptor epoll_event structure.
67
+ EPOLL_CTL_ADD = 1 , // / Add a file descriptor to the interface.
68
+ EPOLL_CTL_DEL = 2 , // / Remove a file descriptor from the interface.
69
+ EPOLL_CTL_MOD = 3 , // / Change file descriptor epoll_event structure.
65
70
}
66
71
67
72
version (X86_Any)
@@ -142,7 +147,82 @@ union epoll_data_t
142
147
ulong u64;
143
148
}
144
149
150
+ /**
151
+ * Creates an epoll instance.
152
+ *
153
+ * Params:
154
+ * size = a hint specifying the number of file descriptors to be associated
155
+ * with the new instance. T
156
+ * Returns: an fd for the new instance. The fd returned by epoll_create() should
157
+ * be closed with close().
158
+ * See_also: epoll_create1 (int flags)
159
+ */
145
160
int epoll_create (int size);
161
+
162
+ /* Same as epoll_create but with an FLAGS parameter. The unused SIZE
163
+ parameter has been dropped. */
164
+
165
+ /**
166
+ * Creates an epoll instance.
167
+ *
168
+ * Params:
169
+ * flags = a specified flag. If flags is 0, then, other than the fact that the
170
+ * obsolete size argument is dropped, epoll_create1() is the same as
171
+ * epoll_create().
172
+ * Returns: an fd for the new instance. The fd returned by epoll_create() should
173
+ * be closed with close().
174
+ * See_also: epoll_create (int size)
175
+ */
146
176
int epoll_create1 (int flags);
177
+
178
+ /**
179
+ * Manipulate an epoll instance
180
+ *
181
+ * Params:
182
+ * epfd = an epoll file descriptor instance
183
+ * op = one of the EPOLL_CTL_* constants
184
+ * fd = target file descriptor of the operation
185
+ * event = describes which events the caller is interested in and any
186
+ * associated user dat
187
+ * Returns: 0 in case of success, -1 in case of error ( the "errno" variable
188
+ * will contain the specific error code )
189
+ */
147
190
int epoll_ctl (int epfd, int op, int fd, epoll_event * event);
191
+
192
+
193
+ /**
194
+ * Wait for events on an epoll instance.
195
+ *
196
+ *
197
+ * Params:
198
+ * epfd = an epoll file descriptor instance
199
+ * events = a buffer that will contain triggered events
200
+ * maxevents = the maximum number of events to be returned ( usually size of
201
+ * "events" )
202
+ * timeout = specifies the maximum wait time in milliseconds (-1 == infinite)
203
+ *
204
+ * Returns: the number of triggered events returned in "events" buffer. Or -1 in
205
+ * case of error with the "errno" variable set to the specific error
206
+ * code.
207
+ */
148
208
int epoll_wait (int epfd, epoll_event * events, int maxevents, int timeout);
209
+
210
+ /**
211
+ * Wait for events on an epoll instance
212
+ *
213
+ *
214
+ * Params:
215
+ * epfd = an epoll file descriptor instance
216
+ * events = a buffer that will contain triggered events
217
+ * maxevents = the maximum number of events to be returned ( usually size of
218
+ * "events" )
219
+ * timeout = specifies the maximum wait time in milliseconds (-1 == infinite)
220
+ * ss = a signal set. May be specified as `null`, in which case epoll_pwait() is
221
+ * equivalent to epoll_wait().
222
+ *
223
+ * Returns: the number of triggered events returned in "events" buffer. Or -1 in
224
+ * case of error with the "errno" variable set to the specific error
225
+ * code.
226
+ */
227
+ int epoll_pwait (int epfd, epoll_event * events, int maxevents, int timeout,
228
+ const sigset_t * ss);
0 commit comments