简体   繁体   中英

What's the purpose of function poll() in file_operations in Linux source code?

I do not quite understand what will poll() do even after I tried to search for it on Google. Is there any documentation related to this function or all the interfaces in the file_operations?

poll() method in VFS struct file_operations is (quoting kernel vfs documentation ):

called by the VFS when a process wants to check if there is activity on this file and (optionally) go to sleep until there is activity. Called by the select(2) and poll(2) system calls

Note that struct contains a pointer to function of signature __poll_t (*poll) (struct file *, struct poll_table_struct *); . If I remember correctly, this (and most of other) file_operations methods are located (and pointers populated) partially by specific filesystem itself (usually in its file.c or similar) or - by filesystem calling out to VFS and VFS populating them by specific code for underlying block/character device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM