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 {...@@ -2751,6 +2751,10 @@ pub const libc = struct {
2751 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/umask.html2751 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/umask.html
2752 pub extern fn umask(cmask: mode_t) mode_t;2752 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
2754 /// int unlockpt(int fildes);2758 /// int unlockpt(int fildes);
2755 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/unlockpt.html2759 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/unlockpt.html
2756 pub extern fn unlockpt(fd: c_int) c_int;2760 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 } {...@@ -3691,3 +3695,8 @@ pub fn waitpid(pid: pid_t, options: c_int) !struct { pid_t, c_int } {
3691 std.debug.assert(rc >= 0);3695 std.debug.assert(rc >= 0);
3692 return .{ rc, status };3696 return .{ rc, status };
3693}3697}
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 {...@@ -78,4 +78,5 @@ test {
78 _ = &linux.dup2;78 _ = &linux.dup2;
79 _ = &linux.poll;79 _ = &linux.poll;
80 _ = &linux.waitpid;80 _ = &linux.waitpid;
81 _ = &linux.unlinkat;
81}82}