1
votes

I'm reading Linux Device Driver 3rd. In chapter 6: poll and select, the author says:

"*unsigned int (*poll) (struct file *filp, poll_table wait); The driver method is called whenever the user-space program performs a poll, select, or epoll system call involving a file descriptor associated with the driver."

So if I have hundreds of fd in my epoll call, every time I reach epoll(), this poll in the driver will be called for hundreds of times?

Thanks.

1

1 Answers

1
votes

Yes, the kernel will loop through all the file descriptors and call the poll() method. It needs to sample the current state of all the file descriptors in order to report them back to the caller in userspace.

Note, that this is true for select and poll, I'm not familiar with epoll, but if it uses the same file op, then it should apply here as well.