函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:userfaultfd_ctx_read

函数原型:static ssize_t userfaultfd_ctx_read(struct userfaultfd_ctx *ctx, int no_wait, struct uffd_msg *msg)

返回类型:ssize_t

参数:

类型参数名称
struct userfaultfd_ctx *ctx
intno_wait
struct uffd_msg *msg
1039  DECLARE_WAITQUEUE(wait, 当前进程)
1048  LIST_HEAD(fork_event)
1049  struct userfaultfd_ctx * fork_nctx = NULL
1052  spin_lock_irq( & lock)
1053  __add_wait_queue( & waitqueue head for the pseudo fd to wakeup poll/read , & wait)
1054  循环
1055  set_current_state(睡眠态)
1056  加自旋锁
1057  uwq等于find_userfault(ctx)
1058  如果uwq
1095  msg等于msg
1097  ret等于0
1098  退出
1100  自旋锁解锁
1102  加自旋锁
1103  uwq等于find_userfault_evt(ctx)
1104  如果uwq
1105  msg等于msg
1107  如果event恒等于UFFD_EVENT_FORK
1125  ret等于0
1126  退出
1128  自旋锁解锁
1130  如果signal_pending(当前进程)则
1132  退出
1134  如果no_wait
1135  ret等于负EAGAIN
1136  退出
1138  spin_unlock_irq( & lock)
1139  进程调度
1140  spin_lock_irq( & lock)
1142  __remove_wait_queue( & waitqueue head for the pseudo fd to wakeup poll/read , & wait)
1143  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;* (就绪态)
1144  spin_unlock_irq( & lock)
1146  如果非retevent恒等于UFFD_EVENT_FORK
1147  ret等于resolve_userfault_fork(ctx, fork_nctx, msg)
1148  spin_lock_irq( & lock)
1149  如果非链表为空
1179  否则
1194  spin_unlock_irq( & lock)
1197  返回:ret
调用者
名称描述
userfaultfd_read