aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2026-06-01 18:22:09 +0000
committerEd Maste <emaste@FreeBSD.org>2026-06-01 18:42:38 +0000
commitf77d37cffdf3951b7f28b97005467241aa27c183 (patch)
tree3e70301725869f0f38d1066976f8c2b5025d5576
parent68004e56fdc22c11b4ec680e83309b4ea2bfe13a (diff)
linuxulator: Return EINVAL for invalid inotify flags
We implement all of the currently-defined Linux inotify mask bits and flags, with the same values as Linux. Return EINVAL for unknown bits, as Linux does. This also moves the translation inline into linux_inotify_add_watch. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57387
-rw-r--r--sys/compat/linux/linux_file.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 30e79a53ad2a..9a1f21d5feb7 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -2034,23 +2034,17 @@ _Static_assert(LINUX_IN_ONESHOT == IN_ONESHOT,
_Static_assert(LINUX_IN_EXCL_UNLINK == IN_EXCL_UNLINK,
"IN_EXCL_UNLINK mismatch");
-static int
-linux_inotify_watch_flags(int l_flags)
-{
- if ((l_flags & ~(LINUX_IN_ALL_EVENTS | LINUX_IN_ALL_FLAGS)) != 0) {
- linux_msg(NULL, "inotify_add_watch unsupported flags 0x%x",
- l_flags);
- }
-
- return (l_flags);
-}
-
int
linux_inotify_add_watch(struct thread *td,
struct linux_inotify_add_watch_args *args)
{
+ if ((args->mask & ~(LINUX_IN_ALL_EVENTS | LINUX_IN_ALL_FLAGS)) != 0) {
+ linux_msg(NULL, "inotify_add_watch unsupported flags 0x%x",
+ args->mask);
+ return (EINVAL);
+ }
return (kern_inotify_add_watch(args->fd, AT_FDCWD, args->pathname,
- linux_inotify_watch_flags(args->mask), td));
+ args->mask, td));
}
int