/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_LINUX_FANOTIFY_H #define _UAPI_LINUX_FANOTIFY_H #include <linux/types.h> /* the following events that user-space can register for */ #define FAN_ACCESS … #define FAN_MODIFY … #define FAN_ATTRIB … #define FAN_CLOSE_WRITE … #define FAN_CLOSE_NOWRITE … #define FAN_OPEN … #define FAN_MOVED_FROM … #define FAN_MOVED_TO … #define FAN_CREATE … #define FAN_DELETE … #define FAN_DELETE_SELF … #define FAN_MOVE_SELF … #define FAN_OPEN_EXEC … #define FAN_Q_OVERFLOW … #define FAN_FS_ERROR … #define FAN_OPEN_PERM … #define FAN_ACCESS_PERM … #define FAN_OPEN_EXEC_PERM … #define FAN_EVENT_ON_CHILD … #define FAN_RENAME … #define FAN_ONDIR … /* helper events */ #define FAN_CLOSE … #define FAN_MOVE … /* flags used for fanotify_init() */ #define FAN_CLOEXEC … #define FAN_NONBLOCK … /* These are NOT bitwise flags. Both bits are used together. */ #define FAN_CLASS_NOTIF … #define FAN_CLASS_CONTENT … #define FAN_CLASS_PRE_CONTENT … /* Deprecated - do not use this in programs and do not add new flags here! */ #define FAN_ALL_CLASS_BITS … #define FAN_UNLIMITED_QUEUE … #define FAN_UNLIMITED_MARKS … #define FAN_ENABLE_AUDIT … /* Flags to determine fanotify event format */ #define FAN_REPORT_PIDFD … #define FAN_REPORT_TID … #define FAN_REPORT_FID … #define FAN_REPORT_DIR_FID … #define FAN_REPORT_NAME … #define FAN_REPORT_TARGET_FID … /* Convenience macro - FAN_REPORT_NAME requires FAN_REPORT_DIR_FID */ #define FAN_REPORT_DFID_NAME … /* Convenience macro - FAN_REPORT_TARGET_FID requires all other FID flags */ #define FAN_REPORT_DFID_NAME_TARGET … /* Deprecated - do not use this in programs and do not add new flags here! */ #define FAN_ALL_INIT_FLAGS … /* flags used for fanotify_modify_mark() */ #define FAN_MARK_ADD … #define FAN_MARK_REMOVE … #define FAN_MARK_DONT_FOLLOW … #define FAN_MARK_ONLYDIR … /* FAN_MARK_MOUNT is 0x00000010 */ #define FAN_MARK_IGNORED_MASK … #define FAN_MARK_IGNORED_SURV_MODIFY … #define FAN_MARK_FLUSH … /* FAN_MARK_FILESYSTEM is 0x00000100 */ #define FAN_MARK_EVICTABLE … /* This bit is mutually exclusive with FAN_MARK_IGNORED_MASK bit */ #define FAN_MARK_IGNORE … /* These are NOT bitwise flags. Both bits can be used togther. */ #define FAN_MARK_INODE … #define FAN_MARK_MOUNT … #define FAN_MARK_FILESYSTEM … /* * Convenience macro - FAN_MARK_IGNORE requires FAN_MARK_IGNORED_SURV_MODIFY * for non-inode mark types. */ #define FAN_MARK_IGNORE_SURV … /* Deprecated - do not use this in programs and do not add new flags here! */ #define FAN_ALL_MARK_FLAGS … /* Deprecated - do not use this in programs and do not add new flags here! */ #define FAN_ALL_EVENTS … /* * All events which require a permission response from userspace */ /* Deprecated - do not use this in programs and do not add new flags here! */ #define FAN_ALL_PERM_EVENTS … /* Deprecated - do not use this in programs and do not add new flags here! */ #define FAN_ALL_OUTGOING_EVENTS … #define FANOTIFY_METADATA_VERSION … struct fanotify_event_metadata { … }; #define FAN_EVENT_INFO_TYPE_FID … #define FAN_EVENT_INFO_TYPE_DFID_NAME … #define FAN_EVENT_INFO_TYPE_DFID … #define FAN_EVENT_INFO_TYPE_PIDFD … #define FAN_EVENT_INFO_TYPE_ERROR … /* Special info types for FAN_RENAME */ #define FAN_EVENT_INFO_TYPE_OLD_DFID_NAME … /* Reserved for FAN_EVENT_INFO_TYPE_OLD_DFID 11 */ #define FAN_EVENT_INFO_TYPE_NEW_DFID_NAME … /* Reserved for FAN_EVENT_INFO_TYPE_NEW_DFID 13 */ /* Variable length info record following event metadata */ struct fanotify_event_info_header { … }; /* * Unique file identifier info record. * This structure is used for records of types FAN_EVENT_INFO_TYPE_FID, * FAN_EVENT_INFO_TYPE_DFID and FAN_EVENT_INFO_TYPE_DFID_NAME. * For FAN_EVENT_INFO_TYPE_DFID_NAME there is additionally a null terminated * name immediately after the file handle. */ struct fanotify_event_info_fid { … }; /* * This structure is used for info records of type FAN_EVENT_INFO_TYPE_PIDFD. * It holds a pidfd for the pid that was responsible for generating an event. */ struct fanotify_event_info_pidfd { … }; struct fanotify_event_info_error { … }; /* * User space may need to record additional information about its decision. * The extra information type records what kind of information is included. * The default is none. We also define an extra information buffer whose * size is determined by the extra information type. * * If the information type is Audit Rule, then the information following * is the rule number that triggered the user space decision that * requires auditing. */ #define FAN_RESPONSE_INFO_NONE … #define FAN_RESPONSE_INFO_AUDIT_RULE … struct fanotify_response { … }; struct fanotify_response_info_header { … }; struct fanotify_response_info_audit_rule { … }; /* Legit userspace responses to a _PERM event */ #define FAN_ALLOW … #define FAN_DENY … #define FAN_AUDIT … #define FAN_INFO … /* No fd set in event */ #define FAN_NOFD … #define FAN_NOPIDFD … #define FAN_EPIDFD … /* Helper functions to deal with fanotify_event_metadata buffers */ #define FAN_EVENT_METADATA_LEN … #define FAN_EVENT_NEXT(meta, len) … #define FAN_EVENT_OK(meta, len) … #endif /* _UAPI_LINUX_FANOTIFY_H */