Skip to content

Conversation

@LHHL7
Copy link
Contributor

@LHHL7 LHHL7 commented Dec 6, 2025

Description

  • add inotify datastructure
  • add inotify syscalls ( sys_inotify_init1(), sys_inotify_add_watch(),sys_inotify_rm_watch() )

Implementation

Additional Context

  • Basic functionality tested with a C test program
  • The complete event notification chain (e.g., event propagation mechanism in filesystem operations) is not yet implemented

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds inotify support to StarryOS, implementing the core inotify data structure and three syscalls (inotify_init1, inotify_add_watch, inotify_rm_watch). The implementation provides the basic infrastructure for filesystem monitoring, though the complete event notification chain from filesystem operations is not yet implemented.

Key Changes

  • Introduced InotifyInstance struct with watch management, event queue, and poll support
  • Implemented three inotify syscalls with proper integration into the syscall handler
  • Added event serialization with Linux-compatible binary format

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
api/src/syscall/mod.rs Added inotify syscall handlers and removed inotify_init1 from dummy fd list
api/src/syscall/fs/mod.rs Added inotify module to fs syscall exports
api/src/syscall/fs/inotify.rs Implemented three inotify syscalls with file descriptor management and validation
api/src/file/mod.rs Exported InotifyInstance and added inotify module
api/src/file/inotify.rs Core inotify implementation with data structures, watch management, and FileLike/Pollable trait support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@LHHL7 LHHL7 force-pushed the feat/add-inotify-syscall branch from 756267e to 63cc59c Compare December 9, 2025 03:53
event_queue: Mutex<VecDeque<Vec<u8>>>,

// watches: wd -> (path, event mask)
watches: Mutex<BTreeMap<i32, (String, u32)>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the subjects of inotify are inodes (not pathnames), related data should be stored in Location::user_data instead. You should base your implementation on that API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I have modified my implementation.

@LHHL7 LHHL7 force-pushed the feat/add-inotify-syscall branch 2 times, most recently from 666867e to f87df06 Compare December 10, 2025 12:15
let location = self.resolve_path(path)?;
// Generate a new watch descriptor
let wd = {
let mut next = self.next_wd.lock();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AtomicI32 would be sufficient for this usage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed next_wd from Mutex<i32> to AtomicI32 per your suggestion.

@LHHL7 LHHL7 force-pushed the feat/add-inotify-syscall branch from f87df06 to c9aedf9 Compare December 15, 2025 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants