Search the web
Sign In
New User? Sign Up
linux-bangalore-programming · LB Programming Discussions
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Kernel programming : poll_wait, polling on a file descriptor   Message List  
Reply | Forward Message #7527 of 7596 |
Hello,

Would someone kindly explain the effect of invoking poll_wait() kernel routine?

My limited/half baked understanding is that when an user space application
invokes polls on a file descriptor, it leads to the kernel invoking the poll
handler registered with file_operations for the desired device.

It is now the responsibility of the poll handler to either return a mask to the
user space application indicating what operations (such as Read, write)are
likely to succeed or even place the calling process in sleep state.

An example straight from Mssrs Rubini and Corbet text book is as follows:

unsigned int xxx_poll(struct file *filp, poll_table *wait)
{
if (write_data_available)mask = Write flags;
if (read_data_available)mask = Read flags;

poll_wait(filp, &ReadWaitQueue, wait);
poll_wait(filp, &WriteWaitQueue, wait);

return mask;
}

What is poll_wait trying to accomplish? Or rather, how is the calling process
placed in sleep state?

Best regards,
Prakash







Thu Mar 5, 2009 10:08 am

prakash_kb
Offline Offline
Send Email Send Email

Forward
Message #7527 of 7596 |
Expand Messages Author Sort by Date

Hello, Would someone kindly explain the effect of invoking poll_wait() kernel routine? My limited/half baked understanding is that when an user space...
Prakash K.B.
prakash_kb
Offline Send Email
Mar 6, 2009
7:55 am

Hi Prakash, Your understanding is correct. What exactly happens is that on calling poll_wait() the kernel calls all the fops->poll on all associated fds, ...
Ankit
ankit4128
Offline Send Email
Mar 6, 2009
12:29 pm

... Thanks Ankit. I think you meant to say "what happens is that on callin user space::poll(fd,..)" ... In an exp tried out earlier in the day, poll_wait...
Prakash K.B.
prakash_kb
Offline Send Email
Mar 6, 2009
1:25 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help