October 2017
Intermediate to advanced
586 pages
14h 8m
English
When you implement the poll function, either the read or write method may change:
static DECLARE_WAIT_QUEUE_HEAD(my_wq); static DECLARE_WAIT_QUEUE_HEAD(my_rq);
#include <linux/poll.h>
static unsigned int eep_poll(struct file *file, poll_table *wait)
{
unsigned int reval_mask = 0;
poll_wait(file, &my_wq, wait);
poll_wait(file, &my_rq, wait);
if (new-data-is-ready)
reval_mask |= (POLLIN | POLLRDNORM);
if (ready_to_be_written)
reval_mask |= (POLLOUT | POLLWRNORM);
return reval_mask;
}