github.com/nicocha30/gvisor-ligolo@v0.0.0-20230726075806-989fa2c0a413/pkg/abi/linux/inotify.go (about) 1 // Copyright 2018 The gVisor Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package linux 16 17 // Inotify events observable by userspace. These directly correspond to 18 // filesystem operations and there may only be a single of them per inotify 19 // event read from an inotify fd. 20 const ( 21 // IN_ACCESS indicates a file was accessed. 22 IN_ACCESS = 0x00000001 23 // IN_MODIFY indicates a file was modified. 24 IN_MODIFY = 0x00000002 25 // IN_ATTRIB indicates a watch target's metadata changed. 26 IN_ATTRIB = 0x00000004 27 // IN_CLOSE_WRITE indicates a writable file was closed. 28 IN_CLOSE_WRITE = 0x00000008 29 // IN_CLOSE_NOWRITE indicates a non-writable file was closed. 30 IN_CLOSE_NOWRITE = 0x00000010 31 // IN_OPEN indicates a file was opened. 32 IN_OPEN = 0x00000020 33 // IN_MOVED_FROM indicates a file was moved from X. 34 IN_MOVED_FROM = 0x00000040 35 // IN_MOVED_TO indicates a file was moved to Y. 36 IN_MOVED_TO = 0x00000080 37 // IN_CREATE indicates a file was created in a watched directory. 38 IN_CREATE = 0x00000100 39 // IN_DELETE indicates a file was deleted in a watched directory. 40 IN_DELETE = 0x00000200 41 // IN_DELETE_SELF indicates a watch target itself was deleted. 42 IN_DELETE_SELF = 0x00000400 43 // IN_MOVE_SELF indicates a watch target itself was moved. 44 IN_MOVE_SELF = 0x00000800 45 // IN_ALL_EVENTS is a mask for all observable userspace events. 46 IN_ALL_EVENTS = 0x00000fff 47 ) 48 49 // Inotify control events. These may be present in their own events, or ORed 50 // with other observable events. 51 const ( 52 // IN_UNMOUNT indicates the backing filesystem was unmounted. 53 IN_UNMOUNT = 0x00002000 54 // IN_Q_OVERFLOW indicates the event queued overflowed. 55 IN_Q_OVERFLOW = 0x00004000 56 // IN_IGNORED indicates a watch was removed, either implicitly or through 57 // inotify_rm_watch(2). 58 IN_IGNORED = 0x00008000 59 // IN_ISDIR indicates the subject of an event was a directory. 60 IN_ISDIR = 0x40000000 61 ) 62 63 // Feature flags for inotify_add_watch(2). 64 const ( 65 // IN_ONLYDIR indicates that a path should be watched only if it's a 66 // directory. 67 IN_ONLYDIR = 0x01000000 68 // IN_DONT_FOLLOW indicates that the watch path shouldn't be resolved if 69 // it's a symlink. 70 IN_DONT_FOLLOW = 0x02000000 71 // IN_EXCL_UNLINK indicates events to this watch from unlinked objects 72 // should be filtered out. 73 IN_EXCL_UNLINK = 0x04000000 74 // IN_MASK_ADD indicates the provided mask should be ORed into any existing 75 // watch on the provided path. 76 IN_MASK_ADD = 0x20000000 77 // IN_ONESHOT indicates the watch should be removed after one event. 78 IN_ONESHOT = 0x80000000 79 ) 80 81 // Feature flags for inotify_init1(2). 82 const ( 83 // IN_CLOEXEC is an alias for O_CLOEXEC. It indicates that the inotify 84 // fd should be closed on exec(2) and friends. 85 IN_CLOEXEC = 0x00080000 86 // IN_NONBLOCK is an alias for O_NONBLOCK. It indicates I/O syscall on the 87 // inotify fd should not block. 88 IN_NONBLOCK = 0x00000800 89 ) 90 91 // ALL_INOTIFY_BITS contains all the bits for all possible inotify events. It's 92 // defined in the Linux source at "include/linux/inotify.h". 93 const ALL_INOTIFY_BITS = IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | 94 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | IN_MOVED_TO | IN_CREATE | 95 IN_DELETE | IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | IN_Q_OVERFLOW | 96 IN_IGNORED | IN_ONLYDIR | IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_MASK_ADD | 97 IN_ISDIR | IN_ONESHOT