diff --git a/book/src/kernel/linux-compatibility/syscall-flag-coverage/file-systems-and-mount-control/inotify_add_watch.scml b/book/src/kernel/linux-compatibility/syscall-flag-coverage/file-systems-and-mount-control/inotify_add_watch.scml index de4e381e4..ebad68a25 100644 --- a/book/src/kernel/linux-compatibility/syscall-flag-coverage/file-systems-and-mount-control/inotify_add_watch.scml +++ b/book/src/kernel/linux-compatibility/syscall-flag-coverage/file-systems-and-mount-control/inotify_add_watch.scml @@ -3,7 +3,7 @@ inotify_events = IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | IN_DELETE_SELF | IN_CLOSE; inotify_controls = IN_ONLYDIR | IN_DONT_FOLLOW | IN_MASK_CREATE | - IN_MASK_ADD | IN_ISDIR | IN_ONESHOT; + IN_MASK_ADD | IN_ONESHOT; // Add a watch to an initialized inotify instance inotify_add_watch(fd, pathname, mask = | ); diff --git a/kernel/src/fs/notify/inotify.rs b/kernel/src/fs/notify/inotify.rs index 3fabc0304..8729306df 100644 --- a/kernel/src/fs/notify/inotify.rs +++ b/kernel/src/fs/notify/inotify.rs @@ -239,8 +239,12 @@ impl InotifyFile { } // If the queue is full, drop the event. - // We do not return an error to the caller. - if event_queue.len() >= self.queue_capacity { + // Try to queue an overflow event in advance to alert the user. + if event_queue.len() == self.queue_capacity - 1 { + let overflow_event = InotifyEvent::new(u32::MAX, FsEvents::Q_OVERFLOW, 0, None); + event_queue.push_back(overflow_event); + return; + } else if event_queue.len() >= self.queue_capacity { return; } @@ -672,7 +676,6 @@ bitflags! { const EXCL_UNLINK = 1 << 26; // Exclude events on unlinked objects const MASK_CREATE = 1 << 28; // Only create watches const MASK_ADD = 1 << 29; // Add to existing watch mask - const ISDIR = 1 << 30; // Event occurred on a directory const ONESHOT = 1 << 31; // Send event once } }