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 {
22342234 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/remainderl.html
22352235 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
22372241 /// double rint(double x);
22382242 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/rint.html
22392243 pub extern fn rint(x: f64) f64;
......@@ -3208,3 +3212,8 @@ pub fn getdents(dirfd: c_int, buf: []u8) errno.Error!usize {
32083212 std.debug.assert(rc >= 0);
32093213 return @intCast(rc);
32103214}
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 {
3535 _ = &linux.getsockname;
3636 _ = &linux.sendfile;
3737 _ = &linux.getdents;
38 _ = &linux.renameat;
3839}