2 .\" Copyright (c) 2014, Joyent, Inc. All Rights Reserved.
3 .\" This file and its contents are supplied under the terms of the
4 .\" Common Development and Distribution License ("CDDL"), version 1.0.
5 .\" You may only use this file in accordance with the terms of version
8 .\" A full copy of the text of the CDDL should have accompanied this
9 .\" source. A copy of the CDDL is also available via the Internet at
10 .\" http://www.illumos.org/license/CDDL.
11 .TH EPOLL_WAIT 3C "Apr 17, 2014"
13 epoll_wait, epoll_pwait \- wait for epoll events
18 #include <sys/epoll.h>
20 \fBint\fR \fBepoll_wait\fR(\fBint\fR \fIepfd\fR, \fBstruct epoll_event *\fR\fIevents\fR,
21 \fBint\fR \fImaxevents\fR, \fBint\fR \fItimeout\fR);
26 \fBint\fR \fBepoll_pwait\fR(\fBint\fR \fIepfd\fR, \fBstruct epoll_event *\fR\fIevents\fR,
27 \fBint\fR \fImaxevents\fR, \fBint\fR \fItimeout\fR,
28 \fBconst sigset_t *\fR\fIsigmask\fR);
33 The \fBepoll_wait()\fR function waits for events on the \fBepoll\fR(5)
34 instance specified by \fIepfd\fR. The \fIevents\fR parameter must point to
35 an array of \fImaxevents\fR \fIepoll_event\fR structures to be
36 filled in with pending events. The \fItimeout\fR argument specifies the
37 number of milliseconds to wait for an event if none is pending. A
38 \fItimeout\fR of -1 denotes an infinite timeout.
40 The \fBepoll_pwait()\fR is similar to \fBepoll_wait()\fR, but takes an
41 additional \fIsigmask\fR argument that specifies the desired signal mask
42 when \fBepoll_pwait()\fR is blocked. It is equivalent to atomically
43 setting the signal mask, calling \fBepoll_wait()\fR, and restoring the
44 signal mask upon return, and is therefore similar to the relationship
45 between \fBselect\fR(3C) and \fBpselect\fR(3C).
49 Upon successful completion, \fBepoll_wait()\fR and \fBepoll_pwait()\fR return
50 the number of events, or 0 if none was pending and \fItimeout\fR milliseconds
51 elapsed. If an error occurs, -1 is returned and errno is set to indicate
56 The \fBepoll_wait()\fR and \fBepoll_pwait()\fR functions will fail if:
63 \fIepfd\fR is not a valid file descriptor.
72 The memory associated with \fIevents\fR was not mapped or was not writable.
81 A signal was received during the \fBepoll_wait()\fR or \fBepoll_pwait()\fR.
90 Either \fIepfd\fR is not a valid \fBepoll\fR(5) instance or \fImaxevents\fR
91 is not greater than zero.
98 The \fBepoll\fR(5) facility is implemented for purposes of offering
99 compatibility for Linux-borne applications; native
100 applications should continue to prefer using event ports via the
101 \fBport_create\fR(3C), \fBport_associate\fR(3C) and \fBport_get\fR(3C)
102 interfaces. See \fBepoll\fR(5) for compatibility details and restrictions.
106 \fBepoll_create\fR(3C), \fBepoll_ctl\fR(3C),
107 \fBport_create\fR(3C), \fBport_associate\fR(3C), \fBport_get\fR(3C),
108 \fBpselect\fR(3C), \fBepoll\fR(5)