1epoll_ctl(2) System Calls Manual epoll_ctl(2)
2
3
4
6 epoll_ctl - control interface for an epoll file descriptor
7
9 Standard C library (libc, -lc)
10
12 #include <sys/epoll.h>
13
14 int epoll_ctl(int epfd, int op, int fd,
15 struct epoll_event *_Nullable event);
16
18 This system call is used to add, modify, or remove entries in the in‐
19 terest list of the epoll(7) instance referred to by the file descriptor
20 epfd. It requests that the operation op be performed for the target
21 file descriptor, fd.
22
23 Valid values for the op argument are:
24
25 EPOLL_CTL_ADD
26 Add an entry to the interest list of the epoll file descriptor,
27 epfd. The entry includes the file descriptor, fd, a reference
28 to the corresponding open file description (see epoll(7) and
29 open(2)), and the settings specified in event.
30
31 EPOLL_CTL_MOD
32 Change the settings associated with fd in the interest list to
33 the new settings specified in event.
34
35 EPOLL_CTL_DEL
36 Remove (deregister) the target file descriptor fd from the in‐
37 terest list. The event argument is ignored and can be NULL (but
38 see BUGS below).
39
40 The event argument describes the object linked to the file descriptor
41 fd. The struct epoll_event is described in epoll_event(3type).
42
43 The data member of the epoll_event structure specifies data that the
44 kernel should save and then return (via epoll_wait(2)) when this file
45 descriptor becomes ready.
46
47 The events member of the epoll_event structure is a bit mask composed
48 by ORing together zero or more event types, returned by epoll_wait(2),
49 and input flags, which affect its behaviour, but aren't returned. The
50 available event types are:
51
52 EPOLLIN
53 The associated file is available for read(2) operations.
54
55 EPOLLOUT
56 The associated file is available for write(2) operations.
57
58 EPOLLRDHUP (since Linux 2.6.17)
59 Stream socket peer closed connection, or shut down writing half
60 of connection. (This flag is especially useful for writing sim‐
61 ple code to detect peer shutdown when using edge-triggered moni‐
62 toring.)
63
64 EPOLLPRI
65 There is an exceptional condition on the file descriptor. See
66 the discussion of POLLPRI in poll(2).
67
68 EPOLLERR
69 Error condition happened on the associated file descriptor.
70 This event is also reported for the write end of a pipe when the
71 read end has been closed.
72
73 epoll_wait(2) will always report for this event; it is not nec‐
74 essary to set it in events when calling epoll_ctl().
75
76 EPOLLHUP