.\"
.\" Davide Libenzi <davidel@xmailserver.org>
.\"
-.TH EPOLL 7 2012-04-17 "Linux" "Linux Programmer's Manual"
+.TH EPOLL 7 2015-01-10 "Linux" "Linux Programmer's Manual"
.SH NAME
epoll \- I/O event notification facility
.SH SYNOPSIS
input buffer;
meanwhile the remote peer might be expecting a response based on the
data it already sent.
-The reason for this is that edge-triggered mode only
-delivers events when changes occur on the monitored file descriptor.
+The reason for this is that edge-triggered mode
+delivers events only when changes occur on the monitored file descriptor.
So, in step
.B 5
the caller might end up waiting for some data that is already present inside
.BR epoll_ctl (2)
with
.BR EPOLL_CTL_MOD .
+.SS Interaction with autosleep
+If the system is in
+.B autosleep
+mode via
+.I /sys/power/autosleep
+and an event happens which wakes the device from sleep, the device
+driver will keep the device awake only until that event is queued.
+To keep the device awake until the event has been processed,
+it is necessary to use the
+.BR epoll (7)
+.B EPOLLWAKEUP
+flag.
+
+When the
+.B EPOLLWAKEUP
+flag is set in the
+.B events
+field for a
+.IR "struct epoll_event" ,
+the system will be kept awake from the moment the event is queued,
+through the
+.BR epoll_wait (2)
+call which returns the event until the subsequent
+.BR epoll_wait (2)
+call.
+If the event should keep the system awake beyond that time,
+then a separate
+.I wake_lock
+should be taken before the second
+.BR epoll_wait (2)
+call.
.SS /proc interfaces
The following interfaces can be used to limit the amount of
kernel memory consumed by epoll:
struct epoll_event ev, events[MAX_EVENTS];
int listen_sock, conn_sock, nfds, epollfd;
-/* Set up listening socket, \(aqlisten_sock\(aq (socket(),
- bind(), listen()) */
+/* Code to set up listening socket, \(aqlisten_sock\(aq,
+ (socket(), bind(), listen()) omitted */
-epollfd = epoll_create(10);
+epollfd = epoll_create1(0);
if (epollfd == \-1) {
- perror("epoll_create");
+ perror("epoll_create1");
exit(EXIT_FAILURE);
}
Yes.
If an
.B epoll
-file descriptor has events waiting then it will
+file descriptor has events waiting, then it will
indicate as being readable.
.TP
.B Q4
.BR epoll_create1 (2),
.BR epoll_ctl (2),
.BR epoll_wait (2)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.