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)
|
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 .nf
16 #include <sys/epoll.h>
17
18 \fBint\fR \fBepoll_wait\fR(\fBint\fR \fIepfd\fR, \fBstruct epoll_event *\fR\fIevents\fR,
19 \fBint\fR \fImaxevents\fR, \fBint\fR \fItimeout\fR);
20 .fi
21
22 .LP
23 .nf
24 \fBint\fR \fBepoll_pwait\fR(\fBint\fR \fIepfd\fR, \fBstruct epoll_event *\fR\fIevents\fR,
25 \fBint\fR \fImaxevents\fR, \fBint\fR \fItimeout\fR,
26 \fBconst sigset_t *\fR\fIsigmask\fR);
27 .fi
28
29 .SH DESCRIPTION
30 The \fBepoll_wait()\fR function waits for events on the \fBepoll\fR(5)
31 instance specified by \fIepfd\fR. The \fIevents\fR parameter must point to
32 an array of \fImaxevents\fR \fIepoll_event\fR structures to be
33 filled in with pending events. The \fItimeout\fR argument specifies the
34 number of milliseconds to wait for an event if none is pending. A
35 \fItimeout\fR of -1 denotes an infinite timeout.
36
37 The \fBepoll_pwait()\fR is similar to \fBepoll_wait()\fR, but takes an
38 additional \fIsigmask\fR argument that specifies the desired signal mask
39 when \fBepoll_pwait()\fR is blocked. It is equivalent to atomically
40 setting the signal mask, calling \fBepoll_wait()\fR, and restoring the
41 signal mask upon return, and is therefore similar to the relationship
42 between \fBselect\fR(3C) and \fBpselect\fR(3C).
43
44 .SH RETURN VALUES
45 Upon successful completion, \fBepoll_wait()\fR and \fBepoll_pwait()\fR return
46 the number of events, or 0 if none was pending and \fItimeout\fR milliseconds
47 elapsed. If an error occurs, -1 is returned and errno is set to indicate
48 the error.
49
50 .SH ERRORS
51 The \fBepoll_wait()\fR and \fBepoll_pwait()\fR functions will fail if:
52 .sp
53 .ne 2
54 .na
55 \fB\fBEBADF\fR\fR
56 .ad
57 .RS 10n
58 \fIepfd\fR is not a valid file descriptor.
59 .RE
60
61 .sp
62 .ne 2
63 .na
64 \fB\fBEFAULT\fR\fR
65 .ad
66 .RS 10n
67 The memory associated with \fIevents\fR was not mapped or was not writable.
68 .RE
69
70 .sp
71 .ne 2
72 .na
73 \fB\fBEINTR\fR\fR
74 .ad
75 .RS 10n
76 A signal was received during the \fBepoll_wait()\fR or \fBepoll_pwait()\fR.
77 .RE
78
79 .sp
80 .ne 2
81 .na
82 \fB\fBEINVAL\fR\fR
83 .ad
84 .RS 10n
85 Either \fIepfd\fR is not a valid \fBepoll\fR(5) instance or \fImaxevents\fR
86 is not greater than zero.
87 .RE
88
89 .sp
90 .SH NOTES
91 The \fBepoll\fR(5) facility is implemented for purposes of offering
92 compatibility for Linux-borne applications; native
93 applications should continue to prefer using event ports via the
94 \fBport_create\fR(3C), \fBport_associate\fR(3C) and \fBport_get\fR(3C)
95 interfaces. See \fBepoll\fR(5) for compatibility details and restrictions.
96
97 .SH SEE ALSO
98 \fBepoll_create\fR(3C), \fBepoll_ctl\fR(3C),
99 \fBport_create\fR(3C), \fBport_associate\fR(3C), \fBport_get\fR(3C),
100 \fBpselect\fR(3C), \fBepoll\fR(5)
|