1 .\" epoll by Davide Libenzi ( efficient event notification retrieval )
2 .\" Copyright (C) 2003 Davide Libenzi
4 .\" This program is free software; you can redistribute it and/or modify
5 .\" it under the terms of the GNU General Public License as published by
6 .\" the Free Software Foundation; either version 2 of the License, or
7 .\" (at your option) any later version.
9 .\" This program is distributed in the hope that it will be useful,
10 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
11 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 .\" GNU General Public License for more details.
14 .\" You should have received a copy of the GNU General Public
15 .\" License along with this manual; if not, see
16 .\" <http://www.gnu.org/licenses/>.
18 .\" Davide Libenzi <davidel@xmailserver.org>
20 .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
21 .\" Modified 2005-04-04 by Marko Kohtala <marko.kohtala@gmail.com>
22 .\" 2008-10-10, mtk: add description of epoll_create1()
24 .TH EPOLL_CREATE 2 2012-04-15 "Linux" "Linux Programmer's Manual"
26 epoll_create, epoll_create1 \- open an epoll file descriptor
29 .B #include <sys/epoll.h>
31 .BI "int epoll_create(int " size );
32 .BI "int epoll_create1(int " flags );
39 Since Linux 2.6.8, the
41 argument is ignored, but must be greater than zero; see NOTES below.
44 returns a file descriptor referring to the new epoll instance.
45 This file descriptor is used for all the subsequent calls to the
48 When no longer required, the file descriptor returned by
50 should be closed by using
52 When all file descriptors referring to an epoll instance have been closed,
53 the kernel destroys the instance
54 and releases the associated resources for reuse.
58 is 0, then, other than the fact that the obsolete
64 The following value can be included in
66 to obtain different behavior:
71 flag on the new file descriptor.
72 See the description of the
76 for reasons why this may be useful.
80 return a nonnegative file descriptor.
81 On error, \-1 is returned, and
83 is set to indicate the error.
91 .RB ( epoll_create1 ())
92 Invalid value specified in
96 The per-user limit on the number of epoll instances imposed by
97 .I /proc/sys/fs/epoll/max_user_instances
104 The system limit on the total number of open files has been reached.
107 There was insufficient memory to create the kernel object.
110 was added to the kernel in version 2.6.
111 Library support is provided in glibc starting with version 2.3.2.
113 .\" To be precise: kernel 2.5.44.
114 .\" The interface should be finalized by Linux kernel 2.5.66.
116 was added to the kernel in version 2.6.27.
117 Library support is provided in glibc starting with version 2.9.
126 argument informed the kernel of the number of file descriptors
127 that the caller expected to add to the
130 The kernel used this information as a hint for the amount of
131 space to initially allocate in internal data structures describing events.
132 (If necessary, the kernel would allocate more space
133 if the caller's usage exceeded the hint given in
136 this hint is no longer required
137 (the kernel dynamically sizes the required data structures
138 without needing the hint), but
140 must still be greater than zero,
141 in order to ensure backward compatibility when new
143 applications are run on older kernels.