@@ -74,9 +74,11 @@ type Listener struct {
74
74
// multiple listener instances need to be used.
75
75
//
76
76
// mountPoint can be any file/directory under the mount point being watched.
77
- // Passing "true" to the entireMount parameter monitors the entire mount point for marked
78
- // events. Passing "false" allows specifying multiple paths (files/directories)
79
- // under this mount point for monitoring filesystem events.
77
+ // entireMount when "true" monitors the entire mount point for marked
78
+ // events which includes all directories, subdirectories, and the
79
+ // contained files of the mount point. Passing "false" allows specifying
80
+ // multiple paths (files/directories)
81
+ // under this mount point for monitoring filesystem events using AddWatch.
80
82
//
81
83
// The function returns a new instance of the listener. The fanotify flags are set
82
84
// based on the running kernel version. [ErrCapSysAdmin] is returned if the process does not
@@ -150,17 +152,26 @@ func (l *Listener) Stop() {
150
152
// mount point. Passing true to remove, removes the mark from the mount point.
151
153
// This method returns an [ErrWatchPath] if the listener was not initialized to monitor
152
154
// the entire mount point. To mark specific files or directories use [AddWatch] method.
153
- // The entire mount cannot be monitored for the following events:
154
- // [FileCreated], [FileAttribChanged], [FileMovedFrom], [FileMovedTo], [WatchedFileDeleted]
155
- // Passing any of these flags in eventTypes will return [ErrInvalidFlagCombination] error
155
+ // The entire mount cannot be monitored for any events for which new directory modification
156
+ // events are provided. Passing any of these directory modification flags in eventTypes
157
+ // will return [ErrInvalidFlagCombination] error. Valid eventTypes are
158
+ // [FileAccessed], [FileOrDirectoryAccessed], [FileModified], [FileOpenedForExec]
159
+ // [FileOpened], [FileOrDirectoryOpened].
156
160
func (l * Listener ) MarkMount (eventTypes EventType , remove bool ) error {
157
161
if l .entireMount == false {
158
162
return ErrWatchPath
159
163
}
160
- if eventTypes .Has (FileCreated ) ||
161
- eventTypes .Has (FileAttribChanged ) ||
162
- eventTypes .Has (FileMovedFrom ) ||
164
+ if eventTypes .Has (FileAttribChanged ) ||
165
+ eventTypes .Has (FileOrDirectoryAttribChanged ) ||
166
+ eventTypes .Has (FileCreated ) ||
167
+ eventTypes .Has (FileOrDirectoryCreated ) ||
168
+ eventTypes .Has (FileDeleted ) ||
169
+ eventTypes .Has (FileOrDirectoryDeleted ) ||
170
+ eventTypes .Has (WatchedFileDeleted ) ||
171
+ eventTypes .Has (WatchedFileOrDirectoryDeleted ) ||
163
172
eventTypes .Has (FileMovedTo ) ||
173
+ eventTypes .Has (FileMovedFrom ) ||
174
+ eventTypes .Has (WatchedFileMoved ) ||
164
175
eventTypes .Has (WatchedFileDeleted ) {
165
176
return ErrInvalidFlagCombination
166
177
}
0 commit comments