October 2017
Intermediate to advanced
586 pages
14h 8m
English
If you need to implement a passive wait (not wasting CPU cycles while sensing the character device), you must implement the poll() function, which will be called whenever a user space program performs select() or poll() system calls on the file associated with the device:
unsigned int (*poll) (struct file *, struct poll_table_struct *);
The kernel function at the heart of this method is poll_wait(), defined in <linux/poll.h>, which is the header you should include in driver code:
void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
poll_wait() adds the device associated with a struct file structure (given as the first parameter) to a list of those that can wake up processes (which have been ...
Read now
Unlock full access