Report queue overflows instead of dropping them

`IN_Q_OVERFLOW` arrives with watch descriptor -1, so the path lookup
failed and the event was silently discarded. It is now delivered
with an empty path so consumers can rescan after the kernel dropped
events.
This commit is contained in:
T. R. Bernstein
2026-09-13 23:06:28 +02:00
parent 68f49e254c
commit 6375a23328
4 changed files with 43 additions and 0 deletions
+3
View File
@@ -93,6 +93,9 @@ public actor Inotify {
}
private func transform(_ rawEvent: RawInotifyEvent) async -> InotifyEvent? {
if rawEvent.mask.contains(.queueOverflow) {
return InotifyEvent(from: rawEvent, inDirectory: "")
}
guard let path = self.watches.path(forId: rawEvent.watchDescriptor) else { return nil }
guard !self.excludedItemNames.contains(rawEvent.name) else { return nil }
let event = InotifyEvent.init(from: rawEvent, inDirectory: path)