From a2b50f4945fb10598d6829e10f192c983359b5b6 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Sat, 29 Jun 2024 12:53:42 +1200 Subject: [PATCH] Support fchmodat2 Resolves #3772 --- src/syscalls.py | 2 +- src/test/chmod.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/syscalls.py b/src/syscalls.py index 4b13178630f..2c123a9a3d0 100644 --- a/src/syscalls.py +++ b/src/syscalls.py @@ -1744,7 +1744,7 @@ def __init__(self, **kwargs): futex_waitv = UnsupportedSyscall(all=449) set_mempolicy_home_node = UnsupportedSyscall(all=450) cachestat = UnsupportedSyscall(all=451) -fchmodat2 = UnsupportedSyscall(all=452) +fchmodat2 = EmulatedSyscall(all=452) map_shadow_stack = UnsupportedSyscall(all=453) futex_wake = UnsupportedSyscall(all=454) futex_wait = UnsupportedSyscall(all=455) diff --git a/src/test/chmod.c b/src/test/chmod.c index 4332c6f2847..f42b8676a05 100644 --- a/src/test/chmod.c +++ b/src/test/chmod.c @@ -11,12 +11,11 @@ int main(void) { test_assert(0 == access(file_path, R_OK)); test_assert(0 == fchmod(fd, 0200)); test_assert(0 == access(file_path, W_OK)); - test_assert(0 == fchmodat(AT_FDCWD, file_path, 0400, 0)); + test_assert(0 == syscall(RR_fchmodat, AT_FDCWD, file_path, 0400)); + test_assert(0 == syscall(RR_fchmodat2, AT_FDCWD, file_path, 0400, 0 || errno == ENOSYS)); test_assert(0 == access(file_path, R_OK)); test_assert(0 == faccessat(AT_FDCWD, file_path, R_OK, AT_SYMLINK_NOFOLLOW) || errno == ENOSYS); -#ifdef SYS_faccessat2 - test_assert(0 == syscall(SYS_faccessat2, AT_FDCWD, file_path, R_OK, AT_SYMLINK_NOFOLLOW) || errno == ENOSYS); -#endif + test_assert(0 == syscall(RR_faccessat2, AT_FDCWD, file_path, R_OK, AT_SYMLINK_NOFOLLOW) || errno == ENOSYS); atomic_puts("EXIT-SUCCESS"); return 0;