Skip to content

fix(fs): Set proper inotify WatchFlags values on libc backend - #1714

Open
AlexTMjugador wants to merge 1 commit into
bytecodealliance:mainfrom
AlexTMjugador:fix/inotify-libc-backend
Open

AlexTMjugador wants to merge 1 commit into
bytecodealliance:mainfrom
AlexTMjugador:fix/inotify-libc-backend

Conversation

@AlexTMjugador

@AlexTMjugador AlexTMjugador commented Oct 19, 2026 •

Copy link
Copy Markdown

#479 added inotify API support to rustix, and hardcoded the values of the EXCL_UNLINK, MASK_ADD, and MASK_CREATE WatchFlags to 1 for the libc backend. This is incorrect and causes the API to silently misbehave when using that backend, because 1 corresponds to the IN_ACCESS flag instead, as the corresponding kernel UAPI definitions show.

However, the libc crate has had all the required inotify flags since version 0.2.139, which was released a few weeks after PR #479 was submitted: rust-lang/libc@ec6d846. rustix currently depends on libc 0.2.182, which is well above libc 0.2.139, so let's take the correct flag definitions from there instead.

bytecodealliance#479 added `inotify` API
support to `rustix`, and hardcoded the values of the `EXCL_UNLINK`,
`MASK_ADD`, and `MASK_CREATE` `WatchFlags` to 1 for the `libc` backend.
This is incorrect and causes the API to silently misbehave when using
that backend, because 1 corresponds to the `IN_ACCESS` flag instead, as
[the corresponding kernel UAPI definitions
show](https://elixir.bootlin.com/linux/v7.2.11/source/include/uapi/linux/inotify.h#L53-L59).

However, the `libc` crate has had all the required `inotify` flags since version
0.2.139, which was released a few weeks after PR bytecodealliance#479 was submitted:
rust-lang/libc@ec6d846.
`rustix` currently depends on `libc` 0.2.182, which is well above `libc`
0.2.139, so let's take the correct flag definitions from there instead.
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.

1 participant