函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:fanotify_read

函数原型:static ssize_t fanotify_read(struct file *file, char __user *buf, size_t count, loff_t *pos)

返回类型:ssize_t

参数:

类型参数名称
struct file *file
char __user *buf
size_tcount
loff_t *pos
339  __userstart
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  当1循环
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  如果是错误
352  ret等于错误
353  退出
356  如果非kevent
357  ret等于负EAGAIN
358  如果f_flags按位与O_NONBLOCK退出
365  如果start不等于buf退出
369  继续下一循环
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  如果非fanotify_is_perm_event(mask)则
389  否则
390  如果ret小于等于0则
395  否则
402  如果ret小于0则退出
404  buf加等于ret
405  count减等于ret
407  remove_wait_queue( & read() on the notification file blocks on this waitq , & wait)
409  如果start不等于bufret不等于负EFAULTret等于bufstart
411  返回:ret