函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\select.c Create Date:2022-07-29 10:37:01
Last Modify:2020-03-18 10:25:38 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:do_select

函数原型:static int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time)

返回类型:int

参数:

类型参数名称
intn
fd_set_bits *fds
struct timespec64 *end_time
478  ktime_t expire, * to = NULL
481  timed_out等于0
482  slack等于0
483  busy_flag等于如果net_busy_loop_on()则POLL_BUSY_LOOP否则0
484  busy_start等于0
486  _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
487  retval等于max_select_fd(n, fds)
488  _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()
490  如果retval小于0则返回:retval
492  n等于retval
494  poll_initwait( & table)
495  wait等于pt
496  如果end_time且非 seconds 且非 nanoseconds
497  _qproc = NULL
498  timed_out等于1
501  如果end_time且非timed_outslack等于select_estimate_accuracy(end_time)
504  retval等于0
505  循环
507  bool can_busy_loop = false
509  inp等于in
509  outp等于out
509  exp等于ex
510  rinp等于res_in
510  routp等于res_out
510  rexp等于res_ex
512 i小于n循环
513  bit等于1
514  res_in等于0, res_out等于0, res_ex等于0
517  in等于inp自加
517  out等于outp自加
517  ex等于exp自加
518  all_bits等于in按位或out按位或ex
519  如果all_bits恒等于0则
520  i加等于BITS_PER_LONG
521  继续下一循环
524 j小于BITS_PER_LONG循环
526  如果i大于等于n退出
528  如果非bit按位与all_bits的值则继续下一循环
530  f等于fdget(i)
531  如果file
534  mask等于vfs_poll(file, wait)
536  fdput(f)
537  如果mask按位与POLLIN_SETin按位与bit
538  res_in或等于bit
539  retval自加
540  _qproc = NULL
542  如果mask按位与POLLOUT_SETout按位与bit
543  res_out或等于bit
544  retval自加
545  _qproc = NULL
547  如果mask按位与POLLEX_SETex按位与bit
548  res_ex或等于bit
549  retval自加
550  _qproc = NULL
553  如果retval
554  can_busy_loop = false
555  busy_flag等于0
561  否则如果busy_flag按位与maskcan_busy_loop = true
566  如果res_inrinp等于res_in
568  如果res_outroutp等于res_out
570  如果res_exrexp等于res_ex
572  cond_resched()
574  _qproc = NULL
575  如果retvaltimed_outsignal_pending(当前进程)则退出
577  如果error
578  retval等于error
579  退出
583  如果can_busy_loop且非need_resched()则
584  如果非busy_start
586  继续下一循环
588  如果非 poll/select we use the global sysctl_net_ll_poll value 则继续下一循环
591  busy_flag等于0
598  如果end_time且非to
600  to等于expire
603  如果非poll_schedule_timeout( & table, 睡眠态, to, slack)则timed_out等于1
608  poll_freewait( & table)
610  返回:retval
调用者
名称描述
core_sys_selectWe 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
compat_core_sys_selectWe 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