函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\eventpoll.c Create Date:2022-07-29 10:50:59
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:p_poll - Retrieves ready events, and delivers them to the caller supplied* event buffer.*@ep: Pointer to the eventpoll context.*@events: Pointer to the userspace buffer where the ready events should be* stored.

函数原型:static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, int maxevents, long timeout)

返回类型:int

参数:

类型参数名称
struct eventpoll *ep
struct epoll_event __user *events
intmaxevents
longtimeout
1807  res等于0, timed_out等于0
1808  slack等于0
1809  bool waiter = false
1811  ktime_t expires, * to = NULL
1813  lockdep_assert_irqs_enabled()
1815  如果timeout大于0则
1816  end_time等于ep_set_mstimeout(timeout)
1818  slack等于select_estimate_accuracy( & end_time)
1819  to等于expires
1820  to等于vert a timespec64 to ktime_t format:
1821  否则如果timeout恒等于0则
1829  timed_out等于1
1831  write_lock_irq( & Lock which protects rdllist and ovflist )
1832  eavail等于p_events_available - Checks if ready events might be available.*@ep: Pointer to the eventpoll context.* Returns: Returns a value different than zero if ready events are available,* or zero otherwise.
1833  write_unlock_irq( & Lock which protects rdllist and ovflist )
1835  转到:send_events
1838  fetch_events :
1840  如果非p_events_available - Checks if ready events might be available.*@ep: Pointer to the eventpoll context.* Returns: Returns a value different than zero if ready events are available,* or zero otherwise.ep_busy_loop(ep, timed_out)
1843  eavail等于p_events_available - Checks if ready events might be available.*@ep: Pointer to the eventpoll context.* Returns: Returns a value different than zero if ready events are available,* or zero otherwise.
1844  如果eavail则转到:send_events
1852  ep_reset_busy_poll_napi_id(ep)
1859  如果非waiter
1860  waiter = true
1861  init_waitqueue_entry( & wait, 当前进程)
1863  spin_lock_irq( & lock)
1864  Used for wake-one threads:
1865  spin_unlock_irq( & lock)
1868  循环
1874  set_current_state(睡眠态)
1882  res等于负EINTR
1883  退出
1886  eavail等于p_events_available - Checks if ready events might be available.*@ep: Pointer to the eventpoll context.* Returns: Returns a value different than zero if ready events are available,* or zero otherwise.
1887  如果eavail退出
1889  如果signal_pending(当前进程)则
1890  res等于负EINTR
1891  退出
1895  timed_out等于1
1896  退出
1900  set_current_state() includes a barrier so that the write of current->state* is correctly serialised wrt the caller's subsequent test of whether to* actually sleep:* for (;;) {* set_current_state(TASK_UNINTERRUPTIBLE);* if (!need_sleep)* break;* (就绪态)
1902  send_events :
1908  如果非reseavail且非res等于ep_send_events(ep, events, maxevents)且非timed_out则转到:fetch_events
1912  如果waiter
1913  spin_lock_irq( & lock)
1914  __remove_wait_queue( & Wait queue used by sys_epoll_wait() , & wait)
1915  spin_unlock_irq( & lock)
1918  返回:res
调用者
名称描述
do_epoll_waitImplement the event wait interface for the eventpoll file. It is the kernel* part of the user space epoll_wait(2).