1 .\" Copyright (C) 2003 Davide Libenzi
2 .\" and Copyright 2008, 2009, 2012 Michael Kerrisk <tk.manpages@gmail.com>
3 .\" Davide Libenzi <davidel@xmailserver.org>
5 .\" SPDX-License-Identifier: GPL-2.0-or-later
7 .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
8 .\" Modified 2005-04-04 by Marko Kohtala <marko.kohtala@gmail.com>
9 .\" 2008-10-10, mtk: add description of epoll_create1()
11 .TH EPOLL_CREATE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
13 epoll_create, epoll_create1 \- open an epoll file descriptor
16 .RI ( libc ", " \-lc )
19 .B #include <sys/epoll.h>
21 .BI "int epoll_create(int " size );
22 .BI "int epoll_create1(int " flags );
29 Since Linux 2.6.8, the
31 argument is ignored, but must be greater than zero; see NOTES.
34 returns a file descriptor referring to the new epoll instance.
35 This file descriptor is used for all the subsequent calls to the
38 When no longer required, the file descriptor returned by
40 should be closed by using
42 When all file descriptors referring to an epoll instance have been closed,
43 the kernel destroys the instance
44 and releases the associated resources for reuse.
48 is 0, then, other than the fact that the obsolete
54 The following value can be included in
56 to obtain different behavior:
61 flag on the new file descriptor.
62 See the description of the
66 for reasons why this may be useful.
70 return a file descriptor (a nonnegative integer).
71 On error, \-1 is returned, and
73 is set to indicate the error.
81 .RB ( epoll_create1 ())
82 Invalid value specified in
86 The per-user limit on the number of epoll instances imposed by
87 .I /proc/sys/fs/epoll/max_user_instances
94 The per-process limit on the number of open file descriptors has been reached.
97 The system-wide limit on the total number of open files has been reached.
100 There was insufficient memory to create the kernel object.
103 was added to the kernel in version 2.6.
104 Library support is provided in glibc starting with version 2.3.2.
106 .\" To be precise: kernel 2.5.44.
107 .\" The interface should be finalized by Linux kernel 2.5.66.
109 was added to the kernel in version 2.6.27.
110 Library support is provided in glibc starting with version 2.9.
121 argument informed the kernel of the number of file descriptors
122 that the caller expected to add to the
125 The kernel used this information as a hint for the amount of
126 space to initially allocate in internal data structures describing events.
127 (If necessary, the kernel would allocate more space
128 if the caller's usage exceeded the hint given in
131 this hint is no longer required
132 (the kernel dynamically sizes the required data structures
133 without needing the hint), but
135 must still be greater than zero,
136 in order to ensure backward compatibility when new
138 applications are run on older kernels.