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 {
20562056
20572057 /// char *mkdtemp(char *template);
20582058 /// 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
20612061 /// int mkfifo(const char *path, mode_t mode);
20622062 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/mkfifo.html
......@@ -3481,3 +3481,8 @@ pub fn pthread_cond_broadcast(cond: *pthread_cond_t) !void {
34813481 if (rc != 0) return errno.fromInt(rc);
34823482 std.debug.assert(rc == 0);
34833483}
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 {
5858 _ = &linux.pthread_cond_timedwait;
5959 _ = &linux.pthread_cond_signal;
6060 _ = &linux.pthread_cond_broadcast;
61 _ = &linux.mkdtemp;
6162}