epoll_ctl
Name
epoll_ctl -- control an epoll file descriptor
Synopsis
int
epoll_ctl
(int
epfd, int
op, int
fd, struct epoll_event *
event);
Description
The interface epoll_ctl() shall control an epoll file descriptor.
The parameter epfd shall specify
the epoll file descriptor to control.
The parameter op shall specify
the operation to perform on the specified target file descriptor.
The parameter fd shall specify
the target file descriptor on which to perform the
specified operation.
The parameter event shall specify
the object associated with the target file descriptor.
The events
member of the
event parameter is a bit set
composed of the event types listed below.
Event types
EPOLLERR | | An error condition occurred on the target file descriptor.
It shall not be necessary to set this event in
events ;
this interface
shall always wait for it. |
EPOLLET | | This event shall set edge-triggered behavior
for the target file descriptor.
The default epoll behavior shall be level-triggered. |
EPOLLHUP | | A hang up occurred on the target file descriptor.
It shall not be necessary to set this event in
events ;
this interface
shall always wait for it. |
EPOLLIN | | The file is accessible to read() operations. |
EPOLLONESHOT | | This event shall set one-shot behavior
for the target file descriptor.
After epoll_wait() retrieves an event,
the file descriptor shall be disabled and epoll shall not
report any other events.
To reenable the file descriptor with a new event mask,
the user should invoke epoll_ctl()
with EPOLL_CTL_MOD in the
op parameter. |
EPOLLOUT | | The file is accessible to write() operations. |
EPOLLPRI | | Urgent data exists for read() operations. |
EPOLLRDHUP | | A stream socket peer closed the connection,
or else the peer shut down the writing half
of the connection. |
Values of the op parameter
EPOLL_CTL_ADD | | Associate event
with the file described by fd,
and add fd
to the epoll descriptor epfd. |
EPOLL_CTL_DEL | | Remove fd from
epfd, and
ignore event, which
can be NULL. |
EPOLL_CTL_MOD | | Change the event event
associated with fd. |
Return Value
On success, epoll_ctl() shall return
0.
On failure, epoll_ctl() shall return
-1 and set errno
as follows.
Errors
EBADF | | The parameter epfd or the
parameter fd is an invalid file descriptor. |
EEXIST | | The parameter op was EPOLL_CTL_ADD ,
but the file descriptor fd is already in
epfd. |
EINVAL | | The parameter epfd is invalid,
or it is the same as fd,
or the operation specified by the parameter op
is unsupported. |
ENOENT | | The parameter op was
EPOLL_CTL_MOD or EPOLL_CTL_DEL ,
but the file descriptor fd is not in
epfd. |
ENOMEM | | Not enough memory for the operation specified by the parameter op. |
EPERM | | The file specified by fd does not support epoll. |
See Also
close(), epoll_create(),
epoll_wait(), poll().