| ... | @@ -279,6 +279,7 @@ pub const libc = struct { | ... | @@ -279,6 +279,7 @@ pub const libc = struct { |
| 279 | pub extern fn isatty(fd: c_int) c_int; | 279 | pub extern fn isatty(fd: c_int) c_int; |
| 280 | pub extern fn lseek(fd: c_int, offset: off_t, whence: c_int) off_t; | 280 | pub extern fn lseek(fd: c_int, offset: off_t, whence: c_int) off_t; |
| 281 | pub extern fn getcwd(buf: [*]u8, size: usize) ?[*:0]u8; | 281 | pub extern fn getcwd(buf: [*]u8, size: usize) ?[*:0]u8; |
| | 282 | pub extern fn fchmod(fildes: c_int, mode: mode_t) c_int; |
| 282 | }; | 283 | }; |
| 283 | | 284 | |
| 284 | pub const natural_t = c_uint; | 285 | pub const natural_t = c_uint; |
| ... | @@ -563,3 +564,8 @@ pub fn getcwd(buf: []u8) ![*:0]u8 { | ... | @@ -563,3 +564,8 @@ pub fn getcwd(buf: []u8) ![*:0]u8 { |
| 563 | if (rc == null) return errno.fromInt(errno.fromLibC()); | 564 | if (rc == null) return errno.fromInt(errno.fromLibC()); |
| 564 | return rc.?; | 565 | return rc.?; |
| 565 | } | 566 | } |
| | 567 | pub fn fchmod(fd: c_int, mode: mode_t) !void { |
| | 568 | const rc = libc.fchmod(fd, mode); |
| | 569 | if (rc == -1) return errno.fromInt(errno.fromLibC()); |
| | 570 | std.debug.assert(rc == 0); |
| | 571 | } |