Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:fanotify_read

Proto:static ssize_t fanotify_read(struct file *file, char __user *buf, size_t count, loff_t *pos)

Type:ssize_t

Parameter:

TypeParameterName
struct file *file
char __user *buf
size_tcount
loff_t *pos
339  __user * start
343  start = buf
344  group = needed for tty driver, and maybe others
346  pr_debug("%s: group=%p\n", __func__, group)
348  add_wait_queue( & read() on the notification file blocks on this waitq , & wait)
349  When 1 cycle
350  kevent = Get an fsnotify notification event if one exists and is small* enough to fit in "count". Return an error pointer if the count* is not large enough. When permission event is dequeued, its state is* updated accordingly.
351  If IS_ERR(kevent) Then
352  ret = PTR_ERR(kevent)
353  Break
356  If Not kevent Then
357  ret = -EAGAIN
358  If f_flags & O_NONBLOCK Then Break
362  If signal_pending(current process) Then Break
365  If start != buf Then Break
369  Continue
372  ret = Copy an event to user space, returning how much we copied.* We already checked that the event size is smaller than the* buffer we had in "get_one_event()" above.
380  ret = 0
387  If Not fanotify_is_perm_event(mask) Then
389  Else
390  If ret <= 0 Then
395  Else
402  If ret < 0 Then Break
404  buf += ret
405  count -= ret
407  remove_wait_queue( & read() on the notification file blocks on this waitq , & wait)
409  If start != buf && ret != -EFAULT Then ret = buf - start
411  Return ret