Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\userfaultfd.c Create Date:2022-07-28 20:20:34
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:userfaultfd_ctx_read

Proto:static ssize_t userfaultfd_ctx_read(struct userfaultfd_ctx *ctx, int no_wait, struct uffd_msg *msg)

Type:ssize_t

Parameter:

TypeParameterName
struct userfaultfd_ctx *ctx
intno_wait
struct uffd_msg *msg
1039  DECLARE_WAITQUEUE(wait, current process)
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  cycle
1055  set_current_state(TASK_INTERRUPTIBLE)
1056  spin_lock( & lock)
1057  uwq = find_userfault(ctx)
1058  If uwq Then
1095  msg = msg
1096  spin_unlock( & lock)
1097  ret = 0
1098  Break
1100  spin_unlock( & lock)
1102  spin_lock( & lock)
1103  uwq = find_userfault_evt(ctx)
1104  If uwq Then
1105  msg = msg
1107  If event == UFFD_EVENT_FORK Then
1124  spin_unlock( & lock)
1125  ret = 0
1126  Break
1128  spin_unlock( & lock)
1132  Break
1134  If no_wait Then
1135  ret = -EAGAIN
1136  Break
1138  spin_unlock_irq( & lock)
1139  schedule()
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;* (Used in tsk->state: )
1144  spin_unlock_irq( & lock)
1146  If Not ret && event == UFFD_EVENT_FORK Then
1147  ret = resolve_userfault_fork(ctx, fork_nctx, msg)
1148  spin_lock_irq( & lock)
1179  Else
1194  spin_unlock_irq( & lock)
1197  Return ret
Caller
NameDescribe
userfaultfd_read