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