1
0
mirror of https://git.FreeBSD.org/src.git synced 2026-06-02 11:24:32 +00:00

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
This commit is contained in:
Ed Maste
2026-06-01 14:22:09 -04:00
parent 68004e56fd
commit f77d37cffd
+6 -12
View File
@@ -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