1epoll_create(2)               System Calls Manual              epoll_create(2)
2
3
4

NAME

6       epoll_create, epoll_create1 - open an epoll file descriptor
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <sys/epoll.h>
13
14       int epoll_create(int size);
15       int epoll_create1(int flags);
16

DESCRIPTION

18       epoll_create() creates a new epoll(7) instance.  Since Linux 2.6.8, the
19       size argument is ignored, but must be greater than zero; see HISTORY.
20
21       epoll_create() returns a file descriptor referring to the new epoll in‐
22       stance.   This  file descriptor is used for all the subsequent calls to
23       the epoll interface.  When no longer required, the file descriptor  re‐
24       turned  by epoll_create() should be closed by using close(2).  When all
25       file descriptors referring to an epoll instance have been  closed,  the
26       kernel  destroys the instance and releases the associated resources for
27       reuse.
28
29   epoll_create1()
30       If flags is 0, then, other than the fact that the obsolete  size  argu‐
31       ment  is  dropped,  epoll_create1() is the same as epoll_create().  The
32       following value can be included in flags to obtain different behavior:
33
34       EPOLL_CLOEXEC
35              Set the close-on-exec (FD_CLOEXEC) flag on the new file descrip‐
36              tor.   See  the description of the O_CLOEXEC flag in open(2) for
37              reasons why this may be useful.
38

RETURN VALUE

40       On success, these system calls return a file descriptor (a  nonnegative
41       integer).   On  error, -1 is returned, and errno is set to indicate the
42       error.
43

ERRORS

45       EINVAL size is not positive.
46
47       EINVAL (epoll_create1()) Invalid value specified in flags.
48
49       EMFILE The per-user limit on the number of epoll instances  imposed  by
50              /proc/sys/fs/epoll/max_user_instances   was   encountered.   See
51              epoll(7) for further details.
52
53       EMFILE The per-process limit on the number of open file descriptors has
54              been reached.
55
56       ENFILE The system-wide limit on the total number of open files has been
57              reached.
58
59       ENOMEM There was insufficient memory to create the kernel object.
60

STANDARDS

62       Linux.
63

HISTORY

65       epoll_create()
66              Linux 2.6, glibc 2.3.2.
67
68       epoll_create1()
69              Linux 2.6.27, glibc 2.9.
70
71       In the initial epoll_create() implementation,  the  size  argument  in‐
72       formed the kernel of the number of file descriptors that the caller ex‐
73       pected to add to the epoll instance.  The kernel used this  information
74       as  a  hint  for  the amount of space to initially allocate in internal
75       data structures describing events.  (If necessary, the kernel would al‐
76       locate  more  space  if  the  caller's usage exceeded the hint given in
77       size.)  Nowadays, this hint is no longer required (the  kernel  dynami‐
78       cally sizes the required data structures without needing the hint), but
79       size must still be greater than zero, in order to ensure backward  com‐
80       patibility when new epoll applications are run on older kernels.
81

SEE ALSO

83       close(2), epoll_ctl(2), epoll_wait(2), epoll(7)
84
85
86
87Linux man-pages 6.04              2023-03-30                   epoll_create(2)
Impressum