From 3265d1f06418eb0360d753c12116310a14b97bde Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sat, 30 May 2026 02:05:35 -0700 Subject: [PATCH] add fchmod --- sys_darwin.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys_darwin.zig b/sys_darwin.zig index 318666ea4271e20eae6f42d6ec2588ccf9719a3f..a1f2973163395999c059c44851aeb9a407acb5a7 100644 --- a/sys_darwin.zig +++ b/sys_darwin.zig @@ -279,6 +279,7 @@ pub const libc = struct { pub extern fn isatty(fd: c_int) c_int; pub extern fn lseek(fd: c_int, offset: off_t, whence: c_int) off_t; pub extern fn getcwd(buf: [*]u8, size: usize) ?[*:0]u8; + pub extern fn fchmod(fildes: c_int, mode: mode_t) c_int; }; pub const natural_t = c_uint; @@ -563,3 +564,8 @@ pub fn getcwd(buf: []u8) ![*:0]u8 { if (rc == null) return errno.fromInt(errno.fromLibC()); return rc.?; } +pub fn fchmod(fd: c_int, mode: mode_t) !void { + const rc = libc.fchmod(fd, mode); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc == 0); +} -- 2.54.0