authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-30 01:50:31 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-30 01:50:31 -07:00
log93bead17d88d0f5258de2af01fda51a3efbb687b
tree9db3a4d396c8489b127815eb709374b343ee8d00
parent9edefde5fcf96894b6aa4ab60241940bba65debf
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

add unlinkat


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

mod.zig+9
......@@ -2751,6 +2751,10 @@ pub const libc = struct {
27512751 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/umask.html
27522752 pub extern fn umask(cmask: mode_t) mode_t;
27532753
2754 /// int unlinkat(int fd, const char *path, int flag);
2755 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/unlinkat.html
2756 pub extern fn unlinkat(fd: c_int, name: [*:0]const u8, flag: c_int) c_int;
2757
27542758 /// int unlockpt(int fildes);
27552759 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/unlockpt.html
27562760 pub extern fn unlockpt(fd: c_int) c_int;
......@@ -3691,3 +3695,8 @@ pub fn waitpid(pid: pid_t, options: c_int) !struct { pid_t, c_int } {
36913695 std.debug.assert(rc >= 0);
36923696 return .{ rc, status };
36933697}
3698pub fn unlinkat(fd: c_int, name: [*:0]const u8, flag: c_int) !void {
3699 const rc = libc.unlinkat(fd, name, flag);
3700 if (rc == -1) return errno.fromInt(errno.fromLibC());
3701 std.debug.assert(rc == 0);
3702}
test.zig+1
......@@ -78,4 +78,5 @@ test {
7878 _ = &linux.dup2;
7979 _ = &linux.poll;
8080 _ = &linux.waitpid;
81 _ = &linux.unlinkat;
8182}