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 {
12711271 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/erfl.html
12721272 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
12741278 /// void exit(int status);
12751279 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/exit.html
12761280 pub extern fn exit(status: c_int) noreturn;
......@@ -3605,3 +3609,8 @@ pub fn fchdir(fildes: c_int) !void {
36053609 if (rc == -1) return errno.fromInt(errno.fromLibC());
36063610 std.debug.assert(rc == 0);
36073611}
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 {
7474 _ = &linux.kill;
7575 _ = &linux.fork;
7676 _ = &linux.fchdir;
77 _ = &linux.execvp;
7778}