函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:anotify syscalls

函数原型:SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)

返回类型:

参数:

773  pr_debug("%s: flags=%x event_f_flags=%x\n", __func__, flags, event_f_flags)
776  如果非操作权限检查则返回:负EPERM
782  如果flags按位与FANOTIFY_INIT_FLAGS的反则返回:负EINVAL
786  如果event_f_flags按位与All flags that may be specified in parameter event_f_flags of fanotify_init的反则返回:负EINVAL
790  : & == O_RDONLY
791  : & == O_RDWR
792  : & == O_WRONLY
793  退出
794  默认
795  返回:负EINVAL
798  如果flags按位与Report unique file id flags按位与Flags allowed to be passed from/to userspace的值不等于These are NOT bitwise flags. Both bits are used together. 则返回:负EINVAL
802  user等于get_current_user - Get the current task's user_struct* Get the user record of the current task, pinning it so that it can't go* away.()
803  如果atomic_read( & fanotify_listeners)大于FANOTIFY_DEFAULT_MAX_LISTENERS
804  free_uid(user)
805  返回:负EMFILE
808  f_flags等于O_RDWR按位或File was opened by fanotify and shouldn't generate fanotify events
809  如果flags按位与lags used for fanotify_init() f_flags或等于O_CLOEXEC
811  如果flags按位与FAN_NONBLOCKf_flags或等于O_NONBLOCK
815  group等于Create a new fsnotify_group and hold a reference for the group returned.
816  如果是错误
817  free_uid(user)
818  返回:错误
821  user等于user
822  flags等于flags
823  atomic_inc( & fanotify_listeners)
824  memcg to charge allocations 等于get_mem_cgroup_from_mm: Obtain a reference on given mm_struct's memcg.*@mm: mm from which memcg should be extracted. It can be NULL.* Obtain a reference on mm->memcg and returns it if successful. Otherwise* root_mem_cgroup is returned
826  oevent等于fanotify_alloc_event(group, NULL, Event queued overflowed , NULL, when calling fsnotify tell it if the data is a path or inode , NULL)
828  如果此条件成立可能性小(为编译器优化)(!oevent)则
829  fd等于负ENOMEM
830  转到:out_destroy_group
832  Event we queue when the * notification list is too * full 等于fse
834  如果force_o_largefile()则event_f_flags或等于O_LARGEFILE
836  f_flags等于event_f_flags
837  init_waitqueue_head( & access_waitq)
838  初始化链表头
840  : & == These are NOT bitwise flags. Both bits are used together.
841  priority等于rmal notifiers, no permissions
842  退出
843  : & == FAN_CLASS_CONTENT
844  priority等于anotify content based access control
845  退出
846  : & == FAN_CLASS_PRE_CONTENT
847  priority等于anotify pre-content access
848  退出
849  默认
850  fd等于负EINVAL
851  转到:out_destroy_group
854  如果flags按位与FAN_UNLIMITED_QUEUE
855  fd等于负EPERM
856  如果非操作权限检查则转到:out_destroy_group
858  maximum events allowed on the list 等于UINT_MAX
859  否则
860  maximum events allowed on the list 等于FANOTIFY_DEFAULT_MAX_EVENTS
863  如果flags按位与FAN_UNLIMITED_MARKS
864  fd等于负EPERM
865  如果非操作权限检查则转到:out_destroy_group
867  max_marks等于UINT_MAX
868  否则
869  max_marks等于FANOTIFY_DEFAULT_MAX_MARKS
872  如果flags按位与FAN_ENABLE_AUDIT
873  fd等于负EPERM
874  如果非操作权限检查则转到:out_destroy_group
878  fd等于anon_inode_getfd - creates a new file instance by hooking it up to an* anonymous inode, and a dentry that describe the "class"* of the file*@name: [in] name of the "class" of the new file*@fops: [in] file operations for the new file*@priv: [in] private
879  如果fd小于0则转到:out_destroy_group
882  返回:fd
884  out_destroy_group :
885  Trying to get rid of a group. Remove all marks, flush all events and release* the group reference.* Note that another thread calling fsnotify_clear_marks_by_group() may still* hold a ref to the group.
886  返回:fd