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 2009-01-17 "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 epoll instance
31 referred to by the file descriptor
33 It requests that the operation
35 be performed for the target file descriptor,
43 Register the target file descriptor
47 instance referred to by the file descriptor
49 and associate the event
51 with the internal file linked to
57 associated with the target file descriptor
61 Remove (deregister) the target file descriptor
65 instance referred to by
69 is ignored and can be NULL (but see BUGS below).
73 argument describes the object linked to the file descriptor
81 typedef union epoll_data {
89 __uint32_t events; /* Epoll events */
90 epoll_data_t data; /* User data variable */
97 member is a bit set composed using the following available event
101 The associated file is available for
106 The associated file is available for
110 .BR EPOLLRDHUP " (since Linux 2.6.17)"
111 Stream socket peer closed connection,
112 or shut down writing half of connection.
113 (This flag is especially useful for writing simple code to detect
114 peer shutdown when using Edge Triggered monitoring.)
117 There is urgent data available for
122 Error condition happened on the associated file descriptor.
124 will always wait for this event; it is not necessary to set it in
128 Hang up happened on the associated file descriptor.
130 will always wait for this event; it is not necessary to set it in
134 Sets the Edge Triggered behavior for the associated file descriptor.
135 The default behavior for
140 for more detailed information about Edge and Level Triggered event
141 distribution architectures.
143 .BR EPOLLONESHOT " (since Linux 2.6.2)"
144 Sets the one-shot behavior for the associated file descriptor.
145 This means that after an event is pulled out with
147 the associated file descriptor is internally disabled and no other events
148 will be reported by the
155 to re-arm the file descriptor with a new event mask.
160 When an error occurs,
164 is set appropriately.
171 is not a valid file descriptor.
177 and the supplied file descriptor
179 is already registered with this epoll instance.
190 or the requested operation
192 is not supported by this interface.
202 is not registered on with this epoll instance.
205 There was insufficient memory to handle the requested
210 .I /proc/sys/fs/epoll/max_user_watches
211 was encountered while trying to register
212 .RB ( EPOLL_CTL_ADD )
213 a new file descriptor on an epoll instance.
225 is Linux-specific, and was introduced in kernel 2.5.44.
226 .\" The interface should be finalized by Linux kernel 2.5.66.
230 interface supports all file descriptors that support
233 In kernel versions before 2.6.9, the
235 operation required a non-NULL pointer in
237 even though this argument is ignored.
240 can be specified as NULL
243 Applications that need to be portable to kernels before 2.6.9
244 should specify a non-NULL pointer in
247 .BR epoll_create (2),