On Thu, Aug 13, 2009 at 5:23 PM, Daniel Baluta <daniel.baluta@xxxxxxxxx> wrote:
Thanks. How do VFS know which of the queue is woke-up (read -WQ or write - WQ ) ? . As any ISR or relevant function wil wake-up the wait-queue.
On Thu, Aug 13, 2009 at 2:17 PM, Shankar Ganesh<shankarganeshk@xxxxxxxxx> wrote:
> Hi ,
>
> I have a doubt regarding poll function in char driver . Let us consider
> following code
>
> --------------------------------------------------------------------------------------
> static unsigned int random_poll(struct file *file, poll_table * wait)
> {
> unsigned int mask;
> poll_wait(file, &random_read_wait, wait);
> poll_wait(file, &random_write_wait, wait);
> mask = 0;
> ........
> return mask;
> }
>
>
> read() / write()
> {
> wait_event_interuptable()
> }
> --------------------------------------------------------------------------------------
>
> Does the above code (poll function) is in sleep state until both
> random_read_wait & random_write_wait are awakened ? . If i have use case If
> i want my user space application to poll only for read , then can i remove
> one of the above ?
t beautiful thing we can experience is the mysterious. It is theAFAIK your actual random_poll function nevers sleeps. The calls for
> source of all true art and science."
>
poll_wait just inform the VFS layer
about the existence of random_read_wait and random_write_wait wait
queues. An upper layer will use the return mask
to actual put your current process to sleep if there are no data
available for reading/writing.
Thanks. How do VFS know which of the queue is woke-up (read -WQ or write - WQ ) ? . As any ISR or relevant function wil wake-up the wait-queue.
I think you should not care about what type of operation a user space
application is watching for.
Daniel.
--
With Regards,
ShankarGanesh K .
"The most beautiful thing we can experience is the mysterious. It is the source of all true art and science."