authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-30 02:31:36 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-30 02:31:36 -07:00
logce608cf7a06b271f7ada3dd6763199701cf2f555
tree90d62a88a99effd93e119f9d4c832a38f3a166f8
parent44eb2a081f6da179f726f85c393cab7f8690cc1a
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

add mkdtemp


2 files changed, 7 insertions(+), 1 deletions(-)

mod.zig+6-1
...@@ -2056,7 +2056,7 @@ pub const libc = struct {...@@ -2056,7 +2056,7 @@ pub const libc = struct {
20562056
2057 /// char *mkdtemp(char *template);2057 /// char *mkdtemp(char *template);
2058 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mkdtemp.html2058 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mkdtemp.html
2059 pub extern fn mkdtemp(template: [*:0]u8) [*:0]u8;2059 pub extern fn mkdtemp(template: [*:0]u8) ?[*:0]u8;
20602060
2061 /// int mkfifo(const char *path, mode_t mode);2061 /// int mkfifo(const char *path, mode_t mode);
2062 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mkfifo.html2062 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mkfifo.html
...@@ -3481,3 +3481,8 @@ pub fn pthread_cond_broadcast(cond: *pthread_cond_t) !void {...@@ -3481,3 +3481,8 @@ pub fn pthread_cond_broadcast(cond: *pthread_cond_t) !void {
3481 if (rc != 0) return errno.fromInt(rc);3481 if (rc != 0) return errno.fromInt(rc);
3482 std.debug.assert(rc == 0);3482 std.debug.assert(rc == 0);
3483}3483}
3484pub fn mkdtemp(template: [*:0]u8) ![*:0]u8 {
3485 const rc = libc.mkdtemp(template);
3486 if (rc == null) return errno.fromInt(errno.fromLibC());
3487 return rc.?;
3488}
test.zig+1
...@@ -58,4 +58,5 @@ test {...@@ -58,4 +58,5 @@ test {
58 _ = &linux.pthread_cond_timedwait;58 _ = &linux.pthread_cond_timedwait;
59 _ = &linux.pthread_cond_signal;59 _ = &linux.pthread_cond_signal;
60 _ = &linux.pthread_cond_broadcast;60 _ = &linux.pthread_cond_broadcast;
61 _ = &linux.mkdtemp;
61}62}