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

poll_wait()

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;
 if(writable)
            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 .


0
karana
Asked:
karana
1 Solution
 
TimEliseoCommented:
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:

   http://www.oreilly.com/catalog/linuxdrive3/book/

has a lot more detail on the subject.
0

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