diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2025-07-10 12:31:23 +0100 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2025-07-10 11:54:03 -0600 |
commit | 6a3e132a1be8c9e649967a4eb341d00731be7f51 (patch) | |
tree | 5bb9e0d089ce344b5ddc473663b498078ce0d01f | |
parent | abbeb42c1762a529cfbae52845c279b648a7acb4 (diff) | |
download | qemu-6a3e132a1be8c9e649967a4eb341d00731be7f51.zip qemu-6a3e132a1be8c9e649967a4eb341d00731be7f51.tar.gz qemu-6a3e132a1be8c9e649967a4eb341d00731be7f51.tar.bz2 |
linux-user: Implement fchmodat2 syscall
The fchmodat2 syscall is new from Linux 6.6; it is like the
existing fchmodat syscall except that it takes a flags parameter.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3019
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250710113123.1109461-1-peter.maydell@linaro.org>
-rw-r--r-- | linux-user/syscall.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index fc37028..e1b1476 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -790,6 +790,10 @@ safe_syscall6(ssize_t, copy_file_range, int, infd, loff_t *, pinoff, int, outfd, loff_t *, poutoff, size_t, length, unsigned int, flags) #endif +#if defined(TARGET_NR_fchmodat2) && defined(__NR_fchmodat2) +safe_syscall4(int, fchmodat2, int, dfd, const char *, filename, + unsigned short, mode, unsigned int, flags) +#endif /* We do ioctl like this rather than via safe_syscall3 to preserve the * "third argument might be integer or pointer or not present" behaviour of @@ -10714,6 +10718,15 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, unlock_user(p, arg2, 0); return ret; #endif +#if defined(TARGET_NR_fchmodat2) && defined(__NR_fchmodat2) + case TARGET_NR_fchmodat2: + if (!(p = lock_user_string(arg2))) { + return -TARGET_EFAULT; + } + ret = get_errno(safe_fchmodat2(arg1, p, arg3, arg4)); + unlock_user(p, arg2, 0); + return ret; +#endif case TARGET_NR_getpriority: /* Note that negative values are valid for getpriority, so we must differentiate based on errno settings. */ |