Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\select.c Create Date:2022-07-28 20:07:02
Last Modify:2020-03-18 10:25:38 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:We can actually return ERESTARTSYS instead of EINTR, but I'd* like to be certain this leads to no problems. So I return* EINTR just for safety.* Update: ERESTARTSYS breaks at least the xview clock binary, so

Proto:int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timespec64 *end_time)

Type:int

Parameter:

TypeParameterName
intn
fd_set __user *inp
fd_set __user *outp
fd_set __user *exp
struct timespec64 *end_time
632  ret = -EINVAL
633  If n < 0 Then Go to out_nofds
637  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
638  fdt = files_fdtable(files)
639  max_fds = max_fds
640  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
641  If n > max_fds Then n = max_fds
649  size = FDS_BYTES(n)
650  bits = stack_fds
651  If size > size of stack_fds / 6 Then
653  ret = -ENOMEM
654  If size > SIZE_MAX / 6 Then Go to out_nofds
657  alloc_size = 6 * size
658  bits = kvmalloc(alloc_size, GFP_KERNEL)
659  If Not bits Then Go to out_nofds
662  in = bits
663  out = bits + size
664  ex = bits + 2 * size
665  res_in = bits + 3 * size
666  res_out = bits + 4 * size
667  res_ex = bits + 5 * size
669  If (ret = Use "unsigned long" accesses to let user-mode fd_set's be long-aligned.) || (ret = Use "unsigned long" accesses to let user-mode fd_set's be long-aligned.) || (ret = Use "unsigned long" accesses to let user-mode fd_set's be long-aligned.) Then Go to out
673  zero_fd_set(n, res_in)
674  zero_fd_set(n, res_out)
675  zero_fd_set(n, res_ex)
677  ret = do_select(n, & fds, end_time)
679  If ret < 0 Then Go to out
681  If Not ret Then
682  ret = -start if no handler..
683  If signal_pending(current process) Then Go to out
685  ret = 0
688  If set_fd_set(n, inp, res_in) || set_fd_set(n, outp, res_out) || set_fd_set(n, exp, res_ex) Then ret = -EFAULT
693  out :
694  If bits != stack_fds Then kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
696  out_nofds :
697  Return ret
Caller
NameDescribe
kern_select
do_pselect