// SPDX-License-Identifier: GPL-2.0/* * This file contains the procedures for the handling of select and poll * * Created for Linux based loosely upon Mathius Lattner's minix * patches by Peter MacDonald. Heavily edited by Linus. * * 4 February 1994 * COFF/ELF binary emulation. If the process has the STICKY_TIMEOUTS * flag set in its personality we do *not* modify the given timeout * parameter to reflect time remaining. * * 24 January 2000 * Changed sys_poll()/do_poll() to use PAGE_SIZE chunk-based allocation * of fds to overcome nfds < 16390 descriptors limit (Tigran Aivazian). */#include<linux/kernel.h>#include<linux/sched/signal.h>#include<linux/sched/rt.h>#include<linux/syscalls.h>#include<linux/export.h>#include<linux/slab.h>#include<linux/poll.h>#include<linux/personality.h> /* for STICKY_TIMEOUTS */#include<linux/file.h>#include<linux/fdtable.h>#include<linux/fs.h>#include<linux/rcupdate.h>#include<linux/hrtimer.h>#include<linux/freezer.h>#include<net/busy_poll.h>#include<linux/vmalloc.h>#include<linux/uaccess.h>__poll_tvfs_poll(structfile*file,structpoll_table_struct*pt){if(file->f_op->poll){returnfile->f_op->poll(file,pt);}elseif(file_has_poll_mask(file)){unsignedintevents=poll_requested_events(pt);structwait_queue_head*head;if(pt&&pt->_qproc){head=