Control interface for an epoll descriptor.
Arguments
eax |
255 |
ebx |
epoll descriptor to control. |
ecx |
Operation to be performed on the target file descriptor. It may be one of the following values:
EPOLL_CTL_ADD |
Add the target file descriptor edx to the epoll descriptor ebx and associate the event esi with the internal file linked to edx. |
EPOLL_CTL_MOD |
Change the event esi associated with the target file descriptor edx. |
EPOLL_CTL_DEL |
Remove the target file descriptor edx from the epoll file descriptor, ebx. The esi is ignored and can be NULL (but see Remarks below). |
|
|
edx |
Target file descriptor. |
esi |
Pointer to an epoll_event structure which describes the object linked to the target file descriptor:
struc epoll_event
{
events rd 1
data rq 1
} |
epoll_event members:
events
This member is a bit set composed using the following available event types:
EPOLLIN |
The associated file is available for sys_read operations. |
EPOLLOUT |
The associated file is available for sys_write operations. |
EPOLLRDHUP |
Stream socket peer closed connection, or shut down writing half of connection. (This flag is especially useful for writing simple code to detect peer shutdown when using Edge Triggered monitoring.) |
EPOLLPRI |
There is urgent data available for sys_read operations. |
EPOLLERR |
Error condition happened on the associated file descriptor. sys_epoll_wait will always wait for this event; it is not necessary to set it in epoll_event.events. |
EPOLLHUP |
Hang up happened on the associated file descriptor. sys_epoll_wait will always wait for this event; it is not necessary to set it in epoll_event.events. |
EPOLLET |
Sets the Edge Triggered behavior for the associated file descriptor. The default behavior for epoll is Level Triggered. |
EPOLLONESHOT |
(since kernel 2.6.2)
Sets the one-shot behavior for the associated file descriptor. This means that after an event is pulled out with sys_epoll_wait the associated file descriptor is internally disabled and no other events will be reported by the epoll interface. The user must call sys_epoll_ctl with EPOLL_CTL_MOD to re-enable the file descriptor with a new event mask.
|
|
Return values
If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:
-EBADF |
ebx or edx is not a valid file descriptor. |
-EEXIST |
ecx was EPOLL_CTL_ADD, and the supplied file descriptor edx is already in ebx. |
-EINVAL |
ebx is not an epoll file descriptor, or edx is the same as ebx, or the requested operation ecx is not supported by this interface. |
-ENOENT |
ecx was EPOLL_CTL_MOD or EPOLL_CTL_DEL, and edx is not in ebx. |
-ENOMEM |
There was insufficient memory to handle the requested ecx control operation. |
-EPERM |
The target file edx does not support epoll. |
|
Remarks
In kernel versions before 2.6.9, the EPOLL_CTL_DEL operation required a non-NULL pointer in esi, even though this argument is ignored. Since kernel 2.6.9, esi can be specified as NULL when using EPOLL_CTL_DEL.
Compatibility
n/a
|