diff options
| author | Stephen Gregoratto <dev@sgregoratto.me> | 2023-11-04 17:05:57 +1100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-01-13 23:52:01 -0700 |
| commit | cf6751ae5510964f0d349e6ea044d8f618ba6e33 (patch) | |
| tree | e137c9b92bca5095b6b2dbbebe217b277c416ebc /lib/std/os/linux.zig | |
| parent | 26db31f6f6a5e034333ff81f2352901201572cba (diff) | |
| download | zig-cf6751ae5510964f0d349e6ea044d8f618ba6e33.tar.gz zig-cf6751ae5510964f0d349e6ea044d8f618ba6e33.zip | |
Add fchmodat2 bits to os/linux.zig
Diffstat (limited to 'lib/std/os/linux.zig')
| -rw-r--r-- | lib/std/os/linux.zig | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index 8928e1fdf2..d6e539e98c 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -796,13 +796,7 @@ pub fn chmod(path: [*:0]const u8, mode: mode_t) usize { if (@hasField(SYS, "chmod")) { return syscall2(.chmod, @intFromPtr(path), mode); } else { - return syscall4( - .fchmodat, - @as(usize, @bitCast(@as(isize, AT.FDCWD))), - @intFromPtr(path), - mode, - 0, - ); + return fchmodat(AT.FDCWD, path, mode, 0); } } @@ -814,8 +808,12 @@ pub fn fchown(fd: i32, owner: uid_t, group: gid_t) usize { } } -pub fn fchmodat(fd: i32, path: [*:0]const u8, mode: mode_t, flags: u32) usize { - return syscall4(.fchmodat, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(path), mode, flags); +pub fn fchmodat(fd: i32, path: [*:0]const u8, mode: mode_t, _: u32) usize { + return syscall3(.fchmodat, @bitCast(@as(isize, fd)), @intFromPtr(path), mode); +} + +pub fn fchmodat2(fd: i32, path: [*:0]const u8, mode: mode_t, flags: u32) usize { + return syscall4(.fchmodat2, @bitCast(@as(isize, fd)), @intFromPtr(path), mode, flags); } /// Can only be called on 32 bit systems. For 64 bit see `lseek`. |
