2 .\" epoll by Davide Libenzi ( efficient event notification retrieval )
3 .\" Copyright (C) 2003 Davide Libenzi
5 .\" This program is free software; you can redistribute it and/or modify
6 .\" it under the terms of the GNU General Public License as published by
7 .\" the Free Software Foundation; either version 2 of the License, or
8 .\" (at your option) any later version.
10 .\" This program is distributed in the hope that it will be useful,
11 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
12 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 .\" GNU General Public License for more details.
15 .\" You should have received a copy of the GNU General Public License
16 .\" along with this program; if not, write to the Free Software
17 .\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 .\" Davide Libenzi <davidel@xmailserver.org>
21 .TH EPOLL_CTL 2 2012-04-15 "Linux" "Linux Programmer's Manual"
23 epoll_ctl \- control interface for an epoll descriptor
25 .B #include <sys/epoll.h>
27 .BI "int epoll_ctl(int " epfd ", int " op ", int " fd \
28 ", struct epoll_event *" event );
30 This system call performs control operations on the
33 referred to by the file descriptor
35 It requests that the operation
37 be performed for the target file descriptor,
45 Register the target file descriptor
49 instance referred to by the file descriptor
51 and associate the event
53 with the internal file linked to
59 associated with the target file descriptor
63 Remove (deregister) the target file descriptor
67 instance referred to by
71 is ignored and can be NULL (but see BUGS below).
75 argument describes the object linked to the file descriptor
83 typedef union epoll_data {
91 uint32_t events; /* Epoll events */
92 epoll_data_t data; /* User data variable */
99 member is a bit set composed using the following available event
103 The associated file is available for
108 The associated file is available for
112 .BR EPOLLRDHUP " (since Linux 2.6.17)"
113 Stream socket peer closed connection,
114 or shut down writing half of connection.
115 (This flag is especially useful for writing simple code to detect
116 peer shutdown when using Edge Triggered monitoring.)
119 There is urgent data available for
124 Error condition happened on the associated file descriptor.
126 will always wait for this event; it is not necessary to set it in
130 Hang up happened on the associated file descriptor.
132 will always wait for this event; it is not necessary to set it in
136 Sets the Edge Triggered behavior for the associated file descriptor.
137 The default behavior for
142 for more detailed information about Edge and Level Triggered event
143 distribution architectures.
145 .BR EPOLLONESHOT " (since Linux 2.6.2)"
146 Sets the one-shot behavior for the associated file descriptor.
147 This means that after an event is pulled out with
149 the associated file descriptor is internally disabled and no other events
150 will be reported by the
157 to rearm the file descriptor with a new event mask.
162 When an error occurs,
166 is set appropriately.
173 is not a valid file descriptor.
179 and the supplied file descriptor
181 is already registered with this epoll instance.
192 or the requested operation
194 is not supported by this interface.
204 is not registered with this epoll instance.
207 There was insufficient memory to handle the requested
213 .I /proc/sys/fs/epoll/max_user_watches
214 was encountered while trying to register
215 .RB ( EPOLL_CTL_ADD )
216 a new file descriptor on an epoll instance.
228 was added to the kernel in version 2.6.
229 .\" To be precise: kernel 2.5.44.
230 .\" The interface should be finalized by Linux kernel 2.5.66.
234 Library support is provided in glibc starting with version 2.3.2.
238 interface supports all file descriptors that support
241 In kernel versions before 2.6.9, the
243 operation required a non-NULL pointer in
245 even though this argument is ignored.
248 can be specified as NULL
251 Applications that need to be portable to kernels before 2.6.9
252 should specify a non-NULL pointer in
255 .BR epoll_create (2),