## Parent Issue / Epic #284 (Epic #265) ## Prerequisite Sub-Issue #287, #290 ## Atomic Deliverable & Implementation Details Add Linux `inotify` filesystem event watching integrated with VFS and `epoll`: - **`kernel/uapi/event.hpp`**: Define `IN_NONBLOCK`, `IN_CLOEXEC`, `IN_ACCESS`/`IN_MODIFY`/`IN_ATTRIB`/`IN_CLOSE_WRITE`/`IN_OPEN`/`IN_MOVED_FROM`/`IN_MOVED_TO`/`IN_CREATE`/`IN_DELETE`/`IN_DELETE_SELF`/`IN_Q_OVERFLOW`/`IN_IGNORED`, and `extern "C"` `linux_inotify_event` (`16`-byte header) with `static_assert` checks. - **`kernel/ipc/` & `kernel/fs/Vfs.cpp`**: Implement `InotifyInstance` (ring queue of watch events + VFS mutation hooks invoked on `create`, `mkdir`, `unlink`, `rmdir`, `rename`, `write`, `close`), pollable via `poll`/`epoll`. - **`kernel/syscalls/EventSyscalls.cpp` & `SyscallDispatcher.cpp`**: Implement and dispatch `sys_inotify_init1` (`26`), `sys_inotify_add_watch` (`27`), and `sys_inotify_rm_watch` (`28`). - **`tests/host/` & `kernel/shell/tests/`**: Add host ASan/UBSan and QEMU tests covering directory watches, `IN_CREATE`/`IN_MODIFY`/`IN_DELETE`/`IN_MOVED_*`, `epoll` wakeups, `IN_Q_OVERFLOW`, and zero inode/heap leaks. Out of scope: `fanotify`, `ptrace` (`[SUBISSUE #2]`). ## Acceptance Criteria & Edge Cases - [ ] `inotify_init1` enforces `IN_CLOEXEC` / `IN_NONBLOCK` and rejects unknown flags with `-EINVAL` - [ ] `inotify_add_watch` returns stable watch descriptors, updates mask on duplicate path, and `inotify_rm_watch` emits `IN_IGNORED` - [ ] `read()` returns `-EINVAL` if buffer is too small for the next `linux_inotify_event` + padded name, and `-EAGAIN` when empty in non-blocking mode - [ ] Closing an `inotify` FD detaches all VFS watch references cleanly with zero inode/dentry/heap leaks - [ ] `make format && make clean-tests && make -j"$(nproc)" all && make -j"$(nproc)" quality` passes with zero warnings
Activity