File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,27 @@ func main() {
3434 os.Exit(1)
3535 }
3636 fmt.Println("Listening to events for:", listenPath)
37+ var actions Action
38+ actions =
39+ fanotify.FileAccessed |
40+ fanotify.FileOrDirectoryAccessed |
41+ fanotify.FileModified |
42+ fanotify.FileOpenedForExec |
43+ fanotify.FileAttribChanged |
44+ fanotify.FileOrDirAttribChanged |
45+ fanotify.FileCreated |
46+ fanotify.FileOrDirCreated |
47+ fanotify.FileDeleted |
48+ fanotify.FileOrDirDeleted |
49+ fanotify.WatchedFileDeleted |
50+ fanotify.WatchedFileOrDirDeleted |
51+ fanotify.FileMovedFrom |
52+ fanotify.FileOrDirMovedFrom |
53+ fanotify.FileMovedTo |
54+ fanotify.FileOrDirMovedTo |
55+ fanotify.WatchedFileMoved |
56+ fanotify.WatchedFileOrDirMoved
57+
3758 listener.AddWatch(listenPath, fanotify.FileOrDirectoryAccessed)
3859 go listener.Start()
3960 i := 1
Original file line number Diff line number Diff line change @@ -103,10 +103,6 @@ func fanotifyMarkMaskValid(mask uint64) error {
103103 return nil
104104}
105105
106- func markFlagsValid (flags uint64 ) bool {
107- return false
108- }
109-
110106// Check if specified fanotify_init flags are supported for the given
111107// kernel version. If none of the defined flags are specified
112108// then the basic option works on any kernel version.
Original file line number Diff line number Diff line change @@ -22,9 +22,15 @@ const (
2222 FileClosed Action = unix .FAN_CLOSE_WRITE | unix .FAN_CLOSE_NOWRITE
2323
2424 // FileOpened event when a file is opened
25+ // BUG Using FileOpened flag with any OnDir or OnDirectory actions
26+ // causes an event flood and complete stoppage of events. The flag
27+ // can be used with other file only flags or by itself
28+ // without any errors/issues.
2529 FileOpened Action = unix .FAN_OPEN
2630
2731 // FileOrDirectoryOpened event when a file or directory is opened
32+ // BUG Using FileOrDirectoryOpened causes an event flood and complete
33+ // stoppage of events. The flag by itself without any errors/issues.
2834 FileOrDirectoryOpened Action = unix .FAN_OPEN | unix .FAN_ONDIR
2935
3036 // FileOpenedForExec event when a file is opened with the intent to be executed.
@@ -41,6 +47,7 @@ const (
4147
4248 // FileCreated event when file a has been created
4349 // Requires Linux kernel 5.1 or later (requires FID)
50+ // BUG FileCreated does not work with FileClosed, FileClosedAfterWrite or FileClosedWithNoWrite
4451 FileCreated Action = unix .FAN_CREATE
4552
4653 // FileOrDirCreated event when a file or directory has been created
You can’t perform that action at this time.
0 commit comments