Print this page
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/inotify.h
+++ new/usr/src/uts/common/sys/inotify.h
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 13 * Copyright (c) 2014 Joyent, Inc. All rights reserved.
14 14 */
15 15
16 16 /*
17 17 * Header file to support for the inotify facility. Note that this facility
18 18 * is designed to be binary compatible with the Linux inotify facility; values
19 19 * for constants here should therefore exactly match those found in Linux, and
20 20 * this facility shouldn't be extended independently of Linux.
21 21 */
22 22
23 23 #ifndef _SYS_INOTIFY_H
24 24 #define _SYS_INOTIFY_H
25 25
26 26 #include <sys/types.h>
27 27
28 28 #ifdef __cplusplus
29 29 extern "C" {
30 30 #endif
31 31
32 32 /*
33 33 * Events that can be explicitly requested on any inotify watch.
34 34 */
35 35 #define IN_ACCESS 0x00000001
36 36 #define IN_MODIFY 0x00000002
37 37 #define IN_ATTRIB 0x00000004
38 38 #define IN_CLOSE_WRITE 0x00000008
39 39 #define IN_CLOSE_NOWRITE 0x00000010
40 40 #define IN_OPEN 0x00000020
41 41 #define IN_MOVED_FROM 0x00000040
42 42 #define IN_MOVED_TO 0x00000080
43 43 #define IN_CREATE 0x00000100
44 44 #define IN_DELETE 0x00000200
45 45 #define IN_DELETE_SELF 0x00000400
46 46 #define IN_MOVE_SELF 0x00000800
47 47
48 48 /*
49 49 * Events that can be sent to an inotify watch -- requested or not.
50 50 */
51 51 #define IN_UNMOUNT 0x00002000
52 52 #define IN_Q_OVERFLOW 0x00004000
53 53 #define IN_IGNORED 0x00008000
54 54
55 55 /*
56 56 * Flags that can modify an inotify event.
57 57 */
58 58 #define IN_ONLYDIR 0x01000000
59 59 #define IN_DONT_FOLLOW 0x02000000
60 60 #define IN_EXCL_UNLINK 0x04000000
61 61 #define IN_MASK_ADD 0x20000000
62 62 #define IN_ISDIR 0x40000000
63 63 #define IN_ONESHOT 0x80000000
64 64
65 65 /*
66 66 * Helpful constants.
67 67 */
68 68 #define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)
69 69 #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO)
70 70 #define IN_ALL_EVENTS \
71 71 (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
72 72 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | IN_MOVED_TO | \
73 73 IN_DELETE | IN_CREATE | IN_DELETE_SELF | IN_MOVE_SELF)
74 74
75 75 #define IN_CHILD_EVENTS \
76 76 (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
77 77 IN_CLOSE_NOWRITE | IN_MODIFY | IN_OPEN)
78 78
79 79 /*
80 80 * To assure binary compatibility with Linux, these values are fixed at their
81 81 * Linux equivalents, not their native ones.
82 82 */
83 83 #define IN_CLOEXEC 02000000 /* LX_O_CLOEXEC */
84 84 #define IN_NONBLOCK 04000 /* LX_O_NONBLOCK */
85 85
86 86 struct inotify_event {
87 87 int32_t wd; /* watch descriptor */
88 88 uint32_t mask; /* mask of events */
89 89 uint32_t cookie; /* event association cookie, if any */
90 90 uint32_t len; /* size of name field */
91 91 char name[]; /* optional NUL-terminated name */
92 92 };
93 93
94 94 /*
95 95 * These ioctl values are specific to the native implementation; applications
96 96 * shouldn't be using them directly, and they should therefore be safe to
97 97 * change without breaking apps.
98 98 */
99 99 #define INOTIFYIOC (('i' << 24) | ('n' << 16) | ('y' << 8))
100 100 #define INOTIFYIOC_ADD_WATCH (INOTIFYIOC | 1) /* add watch */
101 101 #define INOTIFYIOC_RM_WATCH (INOTIFYIOC | 2) /* remove watch */
102 102 #define INOTIFYIOC_ADD_CHILD (INOTIFYIOC | 3) /* add child watch */
103 103 #define INOTIFYIOC_ACTIVATE (INOTIFYIOC | 4) /* activate watch */
104 104
105 105 #ifndef _LP64
106 106 #ifndef _LITTLE_ENDIAN
107 107 #define INOTIFY_PTR(type, name) uint32_t name##pad; type *name
108 108 #else
109 109 #define INOTIFY_PTR(type, name) type *name; uint32_t name##pad
110 110 #endif
111 111 #else
112 112 #define INOTIFY_PTR(type, name) type *name
113 113 #endif
114 114
115 115 typedef struct inotify_addwatch {
116 116 int inaw_fd; /* open fd for object */
117 117 uint32_t inaw_mask; /* desired mask */
118 118 } inotify_addwatch_t;
119 119
120 120 typedef struct inotify_addchild {
121 121 INOTIFY_PTR(char, inac_name); /* pointer to name */
122 122 int inac_fd; /* open fd for parent */
123 123 } inotify_addchild_t;
124 124
125 125 #ifndef _KERNEL
126 126
127 127 extern int inotify_init(void);
128 128 extern int inotify_init1(int);
129 129 extern int inotify_add_watch(int, const char *, uint32_t);
130 130 extern int inotify_rm_watch(int, int);
131 131
132 132 #else
133 133
134 134 #define IN_UNMASKABLE \
135 135 (IN_UNMOUNT | IN_Q_OVERFLOW | IN_IGNORED | IN_ISDIR)
136 136
137 137 #define IN_MODIFIERS \
138 138 (IN_EXCL_UNLINK | IN_ONESHOT)
139 139
140 140 #define IN_FLAGS \
141 141 (IN_ONLYDIR | IN_DONT_FOLLOW | IN_MASK_ADD)
142 142
143 143 #define IN_REMOVAL (1ULL << 32)
144 144 #define INOTIFYMNRN_INOTIFY 0
145 145 #define INOTIFYMNRN_CLONE 1
146 146
147 147 #endif /* _KERNEL */
148 148
149 149 #ifdef __cplusplus
150 150 }
151 151 #endif
152 152
153 153 #endif /* _SYS_INOTIFY_H */
|
↓ open down ↓ |
153 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX