fanotify.h
001: #ifndef _LINUX_FANOTIFY_H
002: #define _LINUX_FANOTIFY_H
003: 
004: #include <linux/types.h>
005: 
006: 
007: #define FAN_ACCESS              0x00000001      
008: #define FAN_MODIFY              0x00000002      
009: #define FAN_CLOSE_WRITE         0x00000008      
010: #define FAN_CLOSE_NOWRITE       0x00000010      
011: #define FAN_OPEN                0x00000020      
012: 
013: #define FAN_Q_OVERFLOW          0x00004000      
014: 
015: #define FAN_OPEN_PERM           0x00010000      
016: #define FAN_ACCESS_PERM         0x00020000      
017: 
018: #define FAN_ONDIR               0x40000000      
019: 
020: #define FAN_EVENT_ON_CHILD      0x08000000      
021: 
022: 
023: #define FAN_CLOSE               (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) 
024: 
025: 
026: #define FAN_CLOEXEC             0x00000001
027: #define FAN_NONBLOCK            0x00000002
028: 
029: 
030: #define FAN_CLASS_NOTIF         0x00000000
031: #define FAN_CLASS_CONTENT       0x00000004
032: #define FAN_CLASS_PRE_CONTENT   0x00000008
033: #define FAN_ALL_CLASS_BITS      (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \
034:                                  FAN_CLASS_PRE_CONTENT)
035: 
036: #define FAN_UNLIMITED_QUEUE     0x00000010
037: #define FAN_UNLIMITED_MARKS     0x00000020
038: 
039: #define FAN_ALL_INIT_FLAGS      (FAN_CLOEXEC | FAN_NONBLOCK | \
040:                                  FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\
041:                                  FAN_UNLIMITED_MARKS)
042: 
043: 
044: #define FAN_MARK_ADD            0x00000001
045: #define FAN_MARK_REMOVE         0x00000002
046: #define FAN_MARK_DONT_FOLLOW    0x00000004
047: #define FAN_MARK_ONLYDIR        0x00000008
048: #define FAN_MARK_MOUNT          0x00000010
049: #define FAN_MARK_IGNORED_MASK   0x00000020
050: #define FAN_MARK_IGNORED_SURV_MODIFY    0x00000040
051: #define FAN_MARK_FLUSH          0x00000080
052: 
053: #define FAN_ALL_MARK_FLAGS      (FAN_MARK_ADD |\
054:                                  FAN_MARK_REMOVE |\
055:                                  FAN_MARK_DONT_FOLLOW |\
056:                                  FAN_MARK_ONLYDIR |\
057:                                  FAN_MARK_MOUNT |\
058:                                  FAN_MARK_IGNORED_MASK |\
059:                                  FAN_MARK_IGNORED_SURV_MODIFY |\
060:                                  FAN_MARK_FLUSH)
061: 
062: 
063: 
064: 
065: 
066: 
067: #define FAN_ALL_EVENTS (FAN_ACCESS |\
068:                         FAN_MODIFY |\
069:                         FAN_CLOSE |\
070:                         FAN_OPEN)
071: 
072: 
073: 
074: 
075: #define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM |\
076:                              FAN_ACCESS_PERM)
077: 
078: #define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS |\
079:                                  FAN_ALL_PERM_EVENTS |\
080:                                  FAN_Q_OVERFLOW)
081: 
082: #define FANOTIFY_METADATA_VERSION       3
083: 
084: struct fanotify_event_metadata {
085:         __u32 event_len;
086:         __u8 vers;
087:         __u8 reserved;
088:         __u16 metadata_len;
089:         __aligned_u64 mask;
090:         __s32 fd;
091:         __s32 pid;
092: };
093: 
094: struct fanotify_response {
095:         __s32 fd;
096:         __u32 response;
097: };
098: 
099: 
100: #define FAN_ALLOW       0x01
101: #define FAN_DENY        0x02
102: 
103: #define FAN_NOFD        -1
104: 
105: 
106: #define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
107: 
108: #define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, \
109:                                    (struct fanotify_event_metadata*)(((char *)(meta)) + \
110:                                    (meta)->event_len))
111: 
112: #define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && \
113:                                 (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \
114:                                 (long)(meta)->event_len <= (long)(len))
115: 
116: #endif 
117: 
      
      
      
      
   
      
      
         
            
            © Andrew Scott 2006 -
            2025, 
            All Rights Reserved