Implement watching a path

Each inotify instance produces events for paths in its watch list. Each
item in the watch list is identified by its watch descriptor. Different
paths can be watched for different events.
This commit is contained in:
T. R. Bernstein
2026-03-11 17:58:06 +01:00
parent 098339f9d1
commit 564c409c15
5 changed files with 92 additions and 0 deletions

View File

@@ -2,11 +2,14 @@ import CInotify
public enum InotifyError: Error, Sendable, CustomStringConvertible {
case initFailed(errno: Int32)
case addWatchFailed(path: String, errno: Int32)
public var description: String {
switch self {
case .initFailed(let code):
"inotify_init1 failed: \(readableErrno(code))"
case .addWatchFailed(let path, let code):
"inotify_add_watch failed for '\(path)': \(readableErrno(code))"
}
}