authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-05 21:08:12 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-05 21:08:12 -07:00
logeca4d5fd5a69e269da7d3dc883bc6a7618c0c380
treef49a85f7783950ec46bb0d615c20d3067d14b1ab
parent506c6f458b9fabc1dd60cf58cee6f15637957b55
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

add renameat


2 files changed, 10 insertions(+), 0 deletions(-)

mod.zig+9
...@@ -2234,6 +2234,10 @@ pub const libc = struct {...@@ -2234,6 +2234,10 @@ pub const libc = struct {
2234 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/remainderl.html2234 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/remainderl.html
2235 pub extern fn remainderl(x: c_longdouble, y: c_longdouble) c_longdouble;2235 pub extern fn remainderl(x: c_longdouble, y: c_longdouble) c_longdouble;
22362236
2237 /// int renameat(int oldfd, const char *old, int newfd, const char *new);
2238 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/renameat.html
2239 pub extern fn renameat(oldfd: c_int, old: [*:0]const u8, newfd: c_int, new: [*:0]const u8) c_int;
2240
2237 /// double rint(double x);2241 /// double rint(double x);
2238 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/rint.html2242 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/rint.html
2239 pub extern fn rint(x: f64) f64;2243 pub extern fn rint(x: f64) f64;
...@@ -3208,3 +3212,8 @@ pub fn getdents(dirfd: c_int, buf: []u8) errno.Error!usize {...@@ -3208,3 +3212,8 @@ pub fn getdents(dirfd: c_int, buf: []u8) errno.Error!usize {
3208 std.debug.assert(rc >= 0);3212 std.debug.assert(rc >= 0);
3209 return @intCast(rc);3213 return @intCast(rc);
3210}3214}
3215pub fn renameat(oldfd: c_int, old: [*:0]const u8, newfd: c_int, new: [*:0]const u8) !void {
3216 const rc = libc.renameat(oldfd, old, newfd, new);
3217 if (rc == -1) return errno.fromInt(errno.fromLibC());
3218 std.debug.assert(rc == 0);
3219}
test.zig+1
...@@ -35,4 +35,5 @@ test {...@@ -35,4 +35,5 @@ test {
35 _ = &linux.getsockname;35 _ = &linux.getsockname;
36 _ = &linux.sendfile;36 _ = &linux.sendfile;
37 _ = &linux.getdents;37 _ = &linux.getdents;
38 _ = &linux.renameat;
38}39}