1 '\" te 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 6 .\" 1.0 of the CDDL. 7 .\" 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" 12 .SH NAME 13 epoll_wait, epoll_pwait \- wait for epoll events 14 .SH SYNOPSIS 15 16 .LP 17 .nf 18 #include <sys/epoll.h> 19 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); 22 .fi 23 24 .LP 25 .nf 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); 29 .fi 30 31 .SH DESCRIPTION 32 .LP 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. 39 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). 46 47 .SH RETURN VALUES 48 .LP 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 52 the error. 53 54 .SH ERRORS 55 .LP 56 The \fBepoll_wait()\fR and \fBepoll_pwait()\fR functions will fail if: 57 .sp 58 .ne 2 59 .na 60 \fB\fBEBADF\fR\fR 61 .ad 62 .RS 10n 63 \fIepfd\fR is not a valid file descriptor. 64 .RE 65 66 .sp 67 .ne 2 68 .na 69 \fB\fBEFAULT\fR\fR 70 .ad 71 .RS 10n 72 The memory associated with \fIevents\fR was not mapped or was not writable. 73 .RE 74 75 .sp 76 .ne 2 77 .na 78 \fB\fBEINTR\fR\fR 79 .ad 80 .RS 10n 81 A signal was received during the \fBepoll_wait()\fR or \fBepoll_pwait()\fR. 82 .RE 83 84 .sp 85 .ne 2 86 .na 87 \fB\fBEINVAL\fR\fR 88 .ad 89 .RS 10n 90 Either \fIepfd\fR is not a valid \fBepoll\fR(5) instance or \fImaxevents\fR 91 is not greater than zero. 92 .RE 93 94 .sp 95 .SH NOTES 96 .LP 97 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. 103 104 .SH SEE ALSO 105 .LP 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)