Skip to content

Commit eaa29ad

Browse files
committed
[libc] adding linux SYS_fchmodat2 syscall.
1 parent 0c032fd commit eaa29ad

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

libc/config/linux/syscall_numbers.h.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@
338338
#define SYS_fchmodat __NR_fchmodat
339339
#endif
340340

341+
#ifdef __NR_fchmodat2
342+
#define SYS_fchmodat2 __NR_fchmodat2
343+
#endif
344+
341345
#ifdef __NR_fchown
342346
#define SYS_fchown __NR_fchown
343347
#endif

libc/src/sys/stat/linux/chmod.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ namespace LIBC_NAMESPACE {
2121
LLVM_LIBC_FUNCTION(int, chmod, (const char *path, mode_t mode)) {
2222
#ifdef SYS_chmod
2323
int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_chmod, path, mode);
24+
#elif defined(SYS_fchmodat2)
25+
int ret =
26+
LIBC_NAMESPACE::syscall_impl<int>(SYS_fchmodat2, AT_FDCWD, path, mode, 0, AT_SYMLINK_NOFOLLOW);
2427
#elif defined(SYS_fchmodat)
2528
int ret =
26-
LIBC_NAMESPACE::syscall_impl<int>(SYS_fchmodat, AT_FDCWD, path, mode);
29+
LIBC_NAMESPACE::syscall_impl<int>(SYS_fchmodat, AT_FDCWD, path, mode, 0);
2730
#else
2831
#error "chmod and fchmodat syscalls not available."
2932
#endif

0 commit comments

Comments
 (0)