• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1EPOLL_CTL(2)               Linux Programmer's Manual              EPOLL_CTL(2)
2
3
4
5NAME
6       epoll_ctl - control interface for an epoll descriptor
7
8SYNOPSIS
9       #include <sys/epoll.h>
10
11       int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
12
13DESCRIPTION
14       Control  an  epoll  descriptor, epfd, by requesting the operation op be
15       performed on the target file descriptor, fd.  The event  describes  the
16       object  linked  to  the  file descriptor fd.  The struct epoll_event is
17       defined as :
18
19
20            typedef union epoll_data {
21                 void *ptr;
22                 int fd;
23                 __uint32_t u32;
24                 __uint64_t u64;
25            } epoll_data_t;
26
27            struct epoll_event {
28                 __uint32_t events;  /* Epoll events */
29                 epoll_data_t data;  /* User data variable */
30            };
31
32
33       The events member is a bit set composed using the  following  available
34       event types :
35
36       EPOLLIN
37              The associated file is available for read(2) operations.
38
39       EPOLLOUT
40              The associated file is available for write(2) operations.
41
42       EPOLLPRI
43              There is urgent data available for read(2) operations.
44
45       EPOLLERR
46              Error condition happened on the associated file descriptor.
47
48       EPOLLHUP
49              Hang up happened on the associated file descriptor.
50
51       EPOLLET
52              Sets  the  Edge  Triggered  behaviour  for  the  associated file
53              descriptor.  The default behaviour for epoll is Level Triggered.
54              See epoll(4) for more detailed informations about Edge and Level
55              Triggered event distribution architectures.
56
57       EPOLLONESHOT
58              Sets the One-Shot behaviour for the associated file  descriptor.
59              It  means  that  after an event is pulled out with epoll_wait(2)
60              the associated file descriptor is  internally  disabled  and  no
61              other  events  will be reported by the epoll interface. The user
62              must call epoll_ctl(2) with EPOLL_CTL_MOD to re-enable the  file
63              descriptor with a new event mask.
64
65
66       The epoll interface supports all file descriptors that support poll(2).
67       Valid values for the op parameter are :
68
69       EPOLL_CTL_ADD
70              Add the target file descriptor fd to the epoll  descriptor  epfd
71              and  associate  the event event with the internal file linked to
72              fd.
73
74       EPOLL_CTL_MOD
75              Change the event event associated to the target file  descriptor
76              fd.
77
78       EPOLL_CTL_DEL
79              Remove  the  target  file  descriptor  fd  from  the  epoll file
80              descriptor, epfd.
81
82RETURN VALUE
83       When successful, epoll_ctl(2)  returns  zero.  When  an  error  occurs,
84       epoll_ctl(2) returns -1 and errno is set appropriately.
85
86ERRORS
87       EBADF  The epfd file descriptor is not a valid file descriptor.
88
89       EPERM  The target file fd is not supported by epoll.
90
91       EINVAL The  supplied  file  descriptor,  epfd,  is  not  an  epoll file
92              descriptor, or the requested operation op is  not  supported  by
93              this interface.
94
95       ENOMEM There was insufficient memory to handle the requested op control
96              operation.
97
98CONFORMING TO
99       epoll_ctl(2) is a new API  introduced  in  Linux  kernel  2.5.44.   The
100       interface should be finalized by Linux kernel 2.5.66.
101
102SEE ALSO
103       epoll(4) epoll_create(2) epoll_wait(2)
104
105
106
107
108Linux                           23 October 2002                   EPOLL_CTL(2)
109