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 the > source of all true art and science." > AFAIK your actual random_poll function nevers sleeps. The calls for 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. I think you should not care about what type of operation a user space application is watching for. Daniel. -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ