Reputation: 620
I'm trying to wrap my head around epoll in Linux.
The normal operation seems to be:
// Create the epoll_fd
int epoll_fd = epoll_create(10);
...
// Add file descriptors to it
struct epoll_event ev = {0};
ev.events |= EPOLLIN;
ev.data.ptr = ...;
/* for brevity, I don't do error checking here */
epoll_ctl(epoll_fd, EPOLL_CTL_ADD, some_fd, &ev);
...
// Wait for IO events
struct epoll_event events[10];
int num_events = epoll_wait(epoll_fd, events, 10, -1);
// Now handle the events
...
My question is this: given the epoll_fd
seems to be a regular file descriptor, are there any other file operations that I can do with it, besides the three epoll function calls?
Upvotes: 2
Views: 2186
Reputation: 37930
From the man page:
Q3 Is the epoll fd itself poll/epoll/selectable?
A3 Yes.
Upvotes: 4