• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1917
  • Last Modified:


sir ,
below i wrote some code related to poll implementation in linux device drivers found in oreilly publications "linux device drivers " book .
 unsigned int scull_p_poll(struct file *filp ,
                  poll_table *wait)
          int mask ;
  poll_wait(filp,&wait_queue1 ,wait);
  poll_wait(filp ,&wait_queue2 ,wait);

 if(readable) mask|=POLLIN | POLLRDNORM;
            mask|=POLLOUT | POLLWRNORM;

poll method is used to check whether a operation will succed before actually calling it .

So , what is the need for poll_wait() ? .
we have to check only condition for readability or writability and return corresponding mask .

1 Solution
The short answer is that it's just necessary for the xxpoll() routine to add to one or more wait queues so that it can be awakened when I/O is ready. The kernel can't do this before calling xxpoll() because only the driver knows how to access the queues.

It looks like you have an old edition of this book. The Third Edition, available freely online at:


has a lot more detail on the subject.

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now