authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-26 18:01:06 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-26 18:01:06 -07:00
log8cd7493b530b23e91234124f056211a8b38ebbd2
tree817ee9225ba00c3a0ec4cbfa5233540f3b674627
parent5e5d932303e3076e4e64f1a715080b0ba28ab618
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

add execvp


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

mod.zig+9
...@@ -1271,6 +1271,10 @@ pub const libc = struct {...@@ -1271,6 +1271,10 @@ pub const libc = struct {
1271 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/erfl.html1271 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/erfl.html
1272 pub extern fn erfl(x: c_longdouble) c_longdouble;1272 pub extern fn erfl(x: c_longdouble) c_longdouble;
12731273
1274 /// int execvp(const char *file, char *const argv[]);
1275 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/execvp.html
1276 pub extern fn execvp(file: [*:0]const u8, argv: [*:null]const ?[*:0]const u8) c_int;
1277
1274 /// void exit(int status);1278 /// void exit(int status);
1275 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/exit.html1279 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/exit.html
1276 pub extern fn exit(status: c_int) noreturn;1280 pub extern fn exit(status: c_int) noreturn;
...@@ -3605,3 +3609,8 @@ pub fn fchdir(fildes: c_int) !void {...@@ -3605,3 +3609,8 @@ pub fn fchdir(fildes: c_int) !void {
3605 if (rc == -1) return errno.fromInt(errno.fromLibC());3609 if (rc == -1) return errno.fromInt(errno.fromLibC());
3606 std.debug.assert(rc == 0);3610 std.debug.assert(rc == 0);
3607}3611}
3612pub fn execvp(file: [*:0]const u8, argv: [*:null]const ?[*:0]const u8) !noreturn {
3613 const rc = libc.execvp(file, argv);
3614 std.debug.assert(rc == -1);
3615 return errno.fromInt(errno.fromLibC());
3616}
test.zig+1
...@@ -74,4 +74,5 @@ test {...@@ -74,4 +74,5 @@ test {
74 _ = &linux.kill;74 _ = &linux.kill;
75 _ = &linux.fork;75 _ = &linux.fork;
76 _ = &linux.fchdir;76 _ = &linux.fchdir;
77 _ = &linux.execvp;
77}78}