值得注意的是,本文中的poll并非system call,而是内核中file_operations的poll函数。 强烈建议先阅读 select usage and implementation in kernel 。 注:代码中的细节可参见 Advanced Char Driver Operations 。 内容源于: select()/poll() 的内核实现 For every file descriptor, it calls that fd’s poll() method, which will add the caller to that fd’s wait queue, and return which events (readable, writeable, exception) currently apply to that fd. 1. How to add poll function to the kernel module code? Include needed headers: 12 #include <linux/poll.h> Declare waitqueue variable: 1 static (fortune_wait); Add fortune_poll() function and add it (as .poll callback)