man-pages/man7/epoll.7

547 lines
15 KiB
Groff
Raw Normal View History

2004-11-03 13:51:07 +00:00
.\"
.\" epoll by Davide Libenzi ( efficient event notification retrieval )
.\" Copyright (C) 2003 Davide Libenzi
.\"
.\" This program is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
.\"
.\" Davide Libenzi <davidel@xmailserver.org>
.\"
.TH EPOLL 7 2009-02-01 "Linux" "Linux Programmer's Manual"
2004-11-03 13:51:07 +00:00
.SH NAME
epoll \- I/O event notification facility
.SH SYNOPSIS
.B #include <sys/epoll.h>
.SH DESCRIPTION
.B epoll
is a variant of
2004-11-03 13:51:07 +00:00
.BR poll (2)
2007-06-14 21:11:22 +00:00
that can be used either as an edge-triggered or a level-triggered
interface and scales well to large numbers of watched file descriptors.
The following system calls are provided to
create and manage an
2004-11-03 13:51:07 +00:00
.B epoll
instance:
.IP * 3
2004-11-03 13:51:07 +00:00
An
.B epoll
instance created by
.BR epoll_create (2),
which returns a file descriptor referring to the epoll instance.
(The more recent
.BR epoll_create1 (2)
extends the functionality of
.BR epoll_create (2).)
.IP *
Interest in particular file descriptors is then registered via
2004-11-03 13:51:07 +00:00
.BR epoll_ctl (2).
The set of file descriptors currently registered on an
.B epoll
instance is sometimes called an
.I epoll
set.
.IP *
Finally, the actual wait is started by
2004-11-03 13:51:07 +00:00
.BR epoll_wait (2).
2007-06-14 21:11:22 +00:00
.SS Level-Triggered and Edge-Triggered
2004-11-03 13:51:07 +00:00
The
.B epoll
2007-06-14 21:11:22 +00:00
event distribution interface is able to behave both as edge-triggered
(ET) and as level-triggered (LT).
2007-06-16 05:58:39 +00:00
The difference between the two mechanisms
can be described as follows.
Suppose that
2008-02-26 13:29:53 +00:00
this scenario happens:
2007-06-16 05:58:39 +00:00
.IP 1. 3
2007-06-14 21:11:22 +00:00
The file descriptor that represents the read side of a pipe
.RI ( rfd )
is registered on the
2004-11-03 13:51:07 +00:00
.B epoll
instance.
2007-06-16 05:58:39 +00:00
.IP 2.
A pipe writer writes 2 kB of data on the write side of the pipe.
.IP 3.
2004-11-03 13:51:07 +00:00
A call to
.BR epoll_wait (2)
is done that will return
2007-06-14 21:11:22 +00:00
.I rfd
as a ready file descriptor.
2007-06-16 05:58:39 +00:00
.IP 4.
The pipe reader reads 1 kB of data from
2007-06-14 21:11:22 +00:00
.IR rfd .
2007-06-16 05:58:39 +00:00
.IP 5.
2004-11-03 13:51:07 +00:00
A call to
.BR epoll_wait (2)
is done.
.PP
If the
2007-06-14 21:11:22 +00:00
.I rfd
2004-11-03 13:51:07 +00:00
file descriptor has been added to the
.B epoll
interface using the
.B EPOLLET
2008-02-26 12:44:38 +00:00
(edge-triggered)
2004-11-03 13:51:07 +00:00
flag, the call to
.BR epoll_wait (2)
2007-06-21 22:55:04 +00:00
done in step
2004-11-03 13:51:07 +00:00
.B 5
2007-06-14 21:11:22 +00:00
will probably hang despite the available data still present in the file
input buffer;
meanwhile the remote peer might be expecting a response based on the
data it already sent.
2007-06-16 05:58:39 +00:00
The reason for this is that edge-triggered mode only
delivers events when changes occur on the monitored file descriptor.
2004-11-03 13:51:07 +00:00
So, in step
.B 5
the caller might end up waiting for some data that is already present inside
the input buffer.
In the above example, an event on
2007-06-14 21:11:22 +00:00
.I rfd
2004-11-03 13:51:07 +00:00
will be generated because of the write done in
2007-09-20 16:26:31 +00:00
.B 2
2005-10-28 17:48:03 +00:00
and the event is consumed in
2004-11-03 13:51:07 +00:00
.BR 3 .
Since the read operation done in
.B 4
does not consume the whole buffer data, the call to
.BR epoll_wait (2)
done in step
.B 5
2007-06-14 21:11:22 +00:00
might block indefinitely.
An application that employs the
2004-11-03 13:51:07 +00:00
.B EPOLLET
flag should use nonblocking file descriptors to avoid having a blocking
2007-06-14 21:11:22 +00:00
read or write starve a task that is handling multiple file descriptors.
2004-11-03 13:51:07 +00:00
The suggested way to use
.B epoll
2007-06-14 21:11:22 +00:00
as an edge-triggered
2005-10-28 17:48:03 +00:00
.RB ( EPOLLET )
2007-06-14 21:11:22 +00:00
interface is as follows:
2004-11-03 13:51:07 +00:00
.RS
2008-02-28 16:04:59 +00:00
.TP 4
2004-11-03 13:51:07 +00:00
.B i
with nonblocking file descriptors; and
.TP
2004-11-03 13:51:07 +00:00
.B ii
2007-06-16 05:58:39 +00:00
by waiting for an event only after
2004-11-03 13:51:07 +00:00
.BR read (2)
or
2004-11-03 13:51:07 +00:00
.BR write (2)
2007-06-22 20:40:07 +00:00
return
.BR EAGAIN .
2004-11-03 13:51:07 +00:00
.RE
.PP
2008-02-26 12:44:38 +00:00
By contrast, when used as a level-triggered interface
(the default, when
.B EPOLLET
is not specified),
2004-11-03 13:51:07 +00:00
.B epoll
2007-09-17 17:02:45 +00:00
is simply a faster
2004-11-03 13:51:07 +00:00
.BR poll (2),
and can be used wherever the latter is used since it shares the
same semantics.
2007-06-14 21:11:22 +00:00
Since even with edge-triggered
.BR epoll ,
2007-06-14 21:11:22 +00:00
multiple events can be generated upon receipt of multiple chunks of data,
2004-11-03 13:51:07 +00:00
the caller has the option to specify the
.B EPOLLONESHOT
flag, to tell
.B epoll
2006-05-29 01:20:08 +00:00
to disable the associated file descriptor after the receipt of an event with
2004-11-03 13:51:07 +00:00
.BR epoll_wait (2).
When the
.B EPOLLONESHOT
flag is specified,
2007-06-14 21:11:22 +00:00
it is the caller's responsibility to rearm the file descriptor using
2004-11-03 13:51:07 +00:00
.BR epoll_ctl (2)
with
.BR EPOLL_CTL_MOD .
.SS /proc interfaces
The following interfaces can be used to limit the amount of
kernel memory consumed by epoll:
.\" Following was added in 2.6.28, but them removed in 2.6.29
.\" .TP
.\" .IR /proc/sys/fs/epoll/max_user_instances " (since Linux 2.6.28)"
.\" This specifies an upper limit on the number of epoll instances
.\" that can be created per real user ID.
.TP
.IR /proc/sys/fs/epoll/max_user_watches " (since Linux 2.6.28)"
This specifies a limit on the total number of
file descriptors that a user can register across
all epoll instances on the system.
The limit is per real user ID.
Each registered file descriptor costs roughly 90 bytes on a 32-bit kernel,
and roughly 160 bytes on a 64-bit kernel.
Currently,
.\" 2.6.29 (in 2.6.28, the default was 1/32 of lowmem)
the default value for
.I max_user_watches
is 1/25 (4%) of the available low memory,
divided by the registration cost in bytes.
.SS Example for Suggested Usage
2004-11-03 13:51:07 +00:00
While the usage of
.B epoll
2007-06-14 21:11:22 +00:00
when employed as a level-triggered interface does have the same
semantics as
2004-11-03 13:51:07 +00:00
.BR poll (2),
2007-06-14 21:11:22 +00:00
the edge-triggered usage requires more clarification to avoid stalls
in the application event loop.
In this example, listener is a
nonblocking socket on which
2004-11-03 13:51:07 +00:00
.BR listen (2)
has been called.
2008-02-29 16:28:54 +00:00
The function
.I do_use_fd()
uses the new ready file descriptor until
2007-06-22 20:40:07 +00:00
.B EAGAIN
is returned by either
2004-11-03 13:51:07 +00:00
.BR read (2)
or
.BR write (2).
2007-06-14 21:11:22 +00:00
An event-driven state machine application should, after having received
2007-06-22 20:40:07 +00:00
.BR EAGAIN ,
2008-02-29 16:28:54 +00:00
record its current state so that at the next call to
.I do_use_fd()
2004-11-03 13:51:07 +00:00
it will continue to
.BR read (2)
or
.BR write (2)
from where it stopped before.
2004-11-03 13:51:07 +00:00
2008-02-28 16:04:59 +00:00
.in +4n
2004-11-03 13:51:07 +00:00
.nf
#define MAX_EVENTS 10
struct epoll_event ev, events[MAX_EVENTS];
int listen_sock, conn_sock, nfds, epollfd;
/* Set up listening socket, \(aqlisten_sock\(aq (socket(),
bind(), listen()) */
epollfd = epoll_create(10);
if (epollfd == \-1) {
perror("epoll_create");
exit(EXIT_FAILURE);
}
ev.events = EPOLLIN;
ev.data.fd = listen_sock;
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, listen_sock, &ev) == \-1) {
perror("epoll_ctl: listen_sock");
exit(EXIT_FAILURE);
}
2004-11-03 13:51:07 +00:00
2007-06-20 20:52:14 +00:00
for (;;) {
nfds = epoll_wait(epollfd, events, MAX_EVENTS, \-1);
if (nfds == \-1) {
perror("epoll_pwait");
exit(EXIT_FAILURE);
}
2004-11-03 13:51:07 +00:00
2007-04-05 12:36:57 +00:00
for (n = 0; n < nfds; ++n) {
if (events[n].data.fd == listen_sock) {
conn_sock = accept(listen_sock,
(struct sockaddr *) &local, &addrlen);
if (conn_sock == \-1) {
2004-11-03 13:51:07 +00:00
perror("accept");
exit(EXIT_FAILURE);
2004-11-03 13:51:07 +00:00
}
setnonblocking(conn_sock);
2004-11-03 13:51:07 +00:00
ev.events = EPOLLIN | EPOLLET;
ev.data.fd = conn_sock;
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, conn_sock,
&ev) == \-1) {
perror("epoll_ctl: conn_sock");
exit(EXIT_FAILURE);
2004-11-03 13:51:07 +00:00
}
2007-04-05 12:36:57 +00:00
} else {
2004-11-03 13:51:07 +00:00
do_use_fd(events[n].data.fd);
2007-04-05 12:36:57 +00:00
}
2004-11-03 13:51:07 +00:00
}
}
.fi
2008-02-28 16:04:59 +00:00
.in
2004-11-03 13:51:07 +00:00
2007-06-14 21:11:22 +00:00
When used as an edge-triggered interface, for performance reasons, it is
2008-02-28 16:04:59 +00:00
possible to add the file descriptor inside the
.B epoll
interface
2007-06-14 21:11:22 +00:00
.RB ( EPOLL_CTL_ADD )
2007-06-16 05:58:39 +00:00
once by specifying
2007-06-14 21:11:22 +00:00
.RB ( EPOLLIN | EPOLLOUT ).
This allows you to avoid
2004-11-03 13:51:07 +00:00
continuously switching between
.B EPOLLIN
and
.B EPOLLOUT
calling
.BR epoll_ctl (2)
with
.BR EPOLL_CTL_MOD .
.SS Questions and Answers
2008-02-26 14:20:26 +00:00
.TP 4
.B Q0
What is the key used to distinguish the file descriptors registered in an
2008-02-28 16:04:59 +00:00
.B epoll
set?
.TP
.B A0
The key is the combination of the file descriptor number and
the open file description
(also known as an "open file handle",
the kernel's internal representation of an open file).
.TP
.B Q1
What happens if you register the same file descriptor on an
2008-02-28 16:04:59 +00:00
.B epoll
instance twice?
2004-11-03 13:51:07 +00:00
.TP
.B A1
2007-06-22 20:40:07 +00:00
You will probably get
.BR EEXIST .
However, it is possible to add a duplicate
.RB ( dup (2),
.BR dup2 (2),
.BR fcntl (2)
.BR F_DUPFD )
descriptor to the same
.B epoll
instance.
.\" But a descriptor duplicated by fork(2) can't be added to the
.\" set, because the [file *, fd] pair is already in the epoll set.
.\" That is a somewhat ugly inconsistency. On the one hand, a child process
.\" cannot add the duplicate file descriptor to the epoll set. (In every
.\" other case that I can think of, descriptors duplicated by fork have
.\" similar semantics to descriptors duplicated by dup() and friends.) On
.\" the other hand, the very fact that the child has a duplicate of the
.\" descriptor means that even if the parent closes its descriptor, then
.\" epoll_wait() in the parent will continue to receive notifications for
.\" that descriptor because of the duplicated descriptor in the child.
.\"
.\" See http://thread.gmane.org/gmane.linux.kernel/596462/
.\" "epoll design problems with common fork/exec patterns"
.\"
.\" mtk, Feb 2008
This can be a useful technique for filtering events,
if the duplicate file descriptors are registered with different
.I events
masks.
2004-11-03 13:51:07 +00:00
.TP
.B Q2
2004-11-03 13:51:07 +00:00
Can two
.B epoll
instances wait for the same file descriptor?
If so, are events reported to both
2004-11-03 13:51:07 +00:00
.B epoll
2007-06-14 21:11:22 +00:00
file descriptors?
2004-11-03 13:51:07 +00:00
.TP
.B A2
2007-06-14 21:11:22 +00:00
Yes, and events would be reported to both.
However, careful programming may be needed to do this correctly.
2004-11-03 13:51:07 +00:00
.TP
.B Q3
Is the
.B epoll
2007-06-14 21:11:22 +00:00
file descriptor itself poll/epoll/selectable?
2004-11-03 13:51:07 +00:00
.TP
.B A3
Yes.
If an
.B epoll
file descriptor has events waiting then it will
indicate as being readable.
2004-11-03 13:51:07 +00:00
.TP
.B Q4
What happens if one attempts to put an
2004-11-03 13:51:07 +00:00
.B epoll
file descriptor into its own file descriptor set?
2004-11-03 13:51:07 +00:00
.TP
.B A4
The
.BR epoll_ctl (2)
call will fail
.RB ( EINVAL ).
However, you can add an
2004-11-03 13:51:07 +00:00
.B epoll
2008-02-28 16:04:59 +00:00
file descriptor inside another
.B epoll
file descriptor set.
2004-11-03 13:51:07 +00:00
.TP
.B Q5
2008-02-29 16:28:54 +00:00
Can I send an
2004-11-03 13:51:07 +00:00
.B epoll
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/ The man pages were rather inconsistent in the use of "Unix" versus "UNIX". Let's go with the trademark usage. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
file descriptor over a UNIX domain socket to another process?
2004-11-03 13:51:07 +00:00
.TP
.B A5
2008-02-29 16:28:54 +00:00
Yes, but it does not make sense to do this, since the receiving process
would not have copies of the file descriptors in the
.B epoll
set.
2004-11-03 13:51:07 +00:00
.TP
.B Q6
2007-06-14 21:11:22 +00:00
Will closing a file descriptor cause it to be removed from all
2004-11-03 13:51:07 +00:00
.B epoll
sets automatically?
.TP
.B A6
Yes, but be aware of the following point.
A file descriptor is a reference to an open file description (see
.BR open (2)).
Whenever a descriptor is duplicated via
.BR dup (2),
.BR dup2 (2),
.BR fcntl (2)
.BR F_DUPFD ,
or
.BR fork (2),
a new file descriptor referring to the same open file description is
created.
An open file description continues to exist until all
file descriptors referring to it have been closed.
A file descriptor is removed from an
.B epoll
set only after all the file descriptors referring to the underlying
open file description have been closed
2008-04-18 15:52:17 +00:00
(or before if the descriptor is explicitly removed using
.BR epoll_ctl (2)
.BR EPOLL_CTL_DEL ).
This means that even after a file descriptor that is part of an
.B epoll
set has been closed,
events may be reported for that file descriptor if other file
descriptors referring to the same underlying file description remain open.
2004-11-03 13:51:07 +00:00
.TP
.B Q7
2007-06-14 21:11:22 +00:00
If more than one event occurs between
2004-11-03 13:51:07 +00:00
.BR epoll_wait (2)
calls, are they combined or reported separately?
.TP
.B A7
They will be combined.
.TP
.B Q8
2007-06-21 22:55:04 +00:00
Does an operation on a file descriptor affect the
2007-06-14 21:11:22 +00:00
already collected but not yet reported events?
2004-11-03 13:51:07 +00:00
.TP
.B A8
2007-06-14 21:11:22 +00:00
You can do two operations on an existing file descriptor.
Remove would be meaningless for
this case.
Modify will reread available I/O.
2004-11-03 13:51:07 +00:00
.TP
.B Q9
2007-06-14 21:11:22 +00:00
Do I need to continuously read/write a file descriptor
2007-06-22 20:40:07 +00:00
until
.B EAGAIN
when using the
2004-11-03 13:51:07 +00:00
.B EPOLLET
2007-06-14 21:11:22 +00:00
flag (edge-triggered behavior) ?
2004-11-03 13:51:07 +00:00
.TP
.B A9
Receiving an event from
2004-11-03 13:51:07 +00:00
.BR epoll_wait (2)
2008-02-28 13:49:29 +00:00
should suggest to you that such
2008-02-28 14:40:15 +00:00
file descriptor is ready for the requested I/O operation.
You must consider it ready until the next (nonblocking)
2008-02-28 15:54:33 +00:00
read/write yields
2007-06-22 20:40:07 +00:00
.BR EAGAIN .
2008-02-28 13:49:29 +00:00
When and how you will use the file descriptor is entirely up to you.
.sp
2008-02-28 15:54:33 +00:00
For packet/token-oriented files (e.g., datagram socket,
terminal in canonical mode),
2008-02-28 16:10:54 +00:00
the only way to detect the end of the read/write I/O space
2008-02-28 15:54:33 +00:00
is to continue to read/write until
.BR EAGAIN .
.sp
For stream-oriented files (e.g., pipe, FIFO, stream socket), the
2008-02-28 13:49:29 +00:00
condition that the read/write I/O space is exhausted can also be detected by
checking the amount of data read from / written to the target file
descriptor.
For example, if you call
2004-11-03 13:51:07 +00:00
.BR read (2)
2008-02-28 14:40:15 +00:00
by asking to read a certain amount of data and
2004-11-03 13:51:07 +00:00
.BR read (2)
2008-02-28 13:49:29 +00:00
returns a lower number of bytes, you
can be sure of having exhausted the read I/O space for the file
descriptor.
2008-02-28 14:40:15 +00:00
The same is true when writing using
2007-06-14 21:11:22 +00:00
.BR write (2).
2008-02-28 15:54:33 +00:00
(Avoid this latter technique if you cannot guarantee that
the monitored file descriptor always refers to a stream-oriented file.)
.SS Possible Pitfalls and Ways to Avoid Them
2004-11-03 13:51:07 +00:00
.TP
2007-06-14 21:11:22 +00:00
.B o Starvation (edge-triggered)
2004-11-03 13:51:07 +00:00
.PP
If there is a large amount of I/O space,
it is possible that by trying to drain
it the other files will not get processed causing starvation.
2007-06-14 21:11:22 +00:00
(This problem is not specific to
.BR epoll .)
2004-11-03 13:51:07 +00:00
.PP
The solution is to maintain a ready list
and mark the file descriptor as ready
2004-11-03 13:51:07 +00:00
in its associated data structure, thereby allowing the application to
remember which files need to be processed but still round robin amongst
all the ready files.
This also supports ignoring subsequent events you
2007-06-14 21:11:22 +00:00
receive for file descriptors that are already ready.
2004-11-03 13:51:07 +00:00
.TP
.B o If using an event cache...
2004-11-03 13:51:07 +00:00
.PP
2007-06-14 21:11:22 +00:00
If you use an event cache or store all the file descriptors returned from
2004-11-03 13:51:07 +00:00
.BR epoll_wait (2),
then make sure to provide a way to mark
2007-06-14 21:11:22 +00:00
its closure dynamically (i.e., caused by
a previous event's processing).
Suppose you receive 100 events from
2004-11-03 13:51:07 +00:00
.BR epoll_wait (2),
and in event #47 a condition causes event #13 to be closed.
If you remove the structure and
2007-05-11 23:29:44 +00:00
.BR close (2)
2007-06-14 21:11:22 +00:00
the file descriptor for event #13, then your
event cache might still say there are events waiting for that
file descriptor causing confusion.
.PP
2004-11-03 13:51:07 +00:00
One solution for this is to call, during the processing of event 47,
.BR epoll_ctl ( EPOLL_CTL_DEL )
2007-06-14 21:11:22 +00:00
to delete file descriptor 13 and
2007-05-11 23:29:44 +00:00
.BR close (2),
2005-10-19 16:30:05 +00:00
then mark its associated
data structure as removed and link it to a cleanup list.
If you find another
2007-06-14 21:11:22 +00:00
event for file descriptor 13 in your batch processing,
you will discover the file descriptor had been
2004-11-03 13:51:07 +00:00
previously removed and there will be no confusion.
.SH VERSIONS
2007-11-24 09:51:48 +00:00
The
.B epoll
API was introduced in Linux kernel 2.5.44.
.\" Its interface should be finalized in Linux kernel 2.5.66.
Support was added to glibc in version 2.3.2.
2004-11-03 13:51:07 +00:00
.SH CONFORMING TO
2008-02-28 16:04:59 +00:00
The
.B epoll
API is Linux-specific.
Some other systems provide similar
mechanisms, for example, FreeBSD has
.IR kqueue ,
and Solaris has
.IR /dev/poll .
2004-11-03 13:51:07 +00:00
.SH "SEE ALSO"
.BR epoll_create (2),
.BR epoll_create1 (2),
2004-11-03 13:51:07 +00:00
.BR epoll_ctl (2),
.BR epoll_wait (2)