improve iswdigit macro to diagnose errors
[oweals/musl.git] / include / sys / fanotify.h
1 #ifndef _FANOTIFY_H
2 #define _FANOTIFY_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 struct fanotify_event_metadata {
9         unsigned event_len;
10         unsigned char vers;
11         unsigned char reserved;
12         unsigned short metadata_len;
13         unsigned long long mask
14 #ifdef __GNUC__
15         __attribute__((__aligned__(8)))
16 #endif
17         ;
18         int fd;
19         int pid;
20 };
21
22 struct fanotify_response {
23         int fd;
24         unsigned response;
25 };
26
27 #define FAN_ACCESS 0x01
28 #define FAN_MODIFY 0x02
29 #define FAN_CLOSE_WRITE 0x08
30 #define FAN_CLOSE_NOWRITE 0x10
31 #define FAN_OPEN 0x20
32 #define FAN_Q_OVERFLOW 0x4000
33 #define FAN_OPEN_PERM 0x10000
34 #define FAN_ACCESS_PERM 0x20000
35 #define FAN_ONDIR 0x40000000
36 #define FAN_EVENT_ON_CHILD 0x08000000
37 #define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE)
38 #define FAN_CLOEXEC 0x01
39 #define FAN_NONBLOCK 0x02
40 #define FAN_CLASS_NOTIF 0
41 #define FAN_CLASS_CONTENT 0x04
42 #define FAN_CLASS_PRE_CONTENT 0x08
43 #define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
44 #define FAN_UNLIMITED_QUEUE 0x10
45 #define FAN_UNLIMITED_MARKS 0x20
46 #define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS)
47 #define FAN_MARK_ADD 0x01
48 #define FAN_MARK_REMOVE 0x02
49 #define FAN_MARK_DONT_FOLLOW 0x04
50 #define FAN_MARK_ONLYDIR 0x08
51 #define FAN_MARK_MOUNT 0x10
52 #define FAN_MARK_IGNORED_MASK 0x20
53 #define FAN_MARK_IGNORED_SURV_MODIFY 0x40
54 #define FAN_MARK_FLUSH 0x80
55 #define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_DONT_FOLLOW | FAN_MARK_ONLYDIR | FAN_MARK_MOUNT | FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY | FAN_MARK_FLUSH)
56 #define FAN_ALL_EVENTS (FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN)
57 #define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM)
58 #define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS | FAN_ALL_PERM_EVENTS | FAN_Q_OVERFLOW)
59 #define FANOTIFY_METADATA_VERSION 3
60 #define FAN_ALLOW 0x01
61 #define FAN_DENY 0x02
62 #define FAN_NOFD -1
63 #define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
64 #define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, (struct fanotify_event_metadata*)(((char *)(meta)) + (meta)->event_len))
65 #define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len <= (long)(len))
66
67 int fanotify_init(unsigned, unsigned);
68 int fanotify_mark(int, unsigned, unsigned long long, int, const char *);
69
70 #ifdef __cplusplus
71 }
72 #endif
73 #endif