authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-04-20 16:43:07 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-04-20 16:43:07 -07:00
log868f414152de3f73b7e6ba5b4b627b95252f2afc
treea5f3d9bdc5b8b466613347c828884fe37f3ec157
parente4a20839eb7acf88901557e0aa4561add16e17b7

add vfork


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

mod.zig+7-1
...@@ -345,7 +345,13 @@ pub fn fork() errno.Error!pid_t {...@@ -345,7 +345,13 @@ pub fn fork() errno.Error!pid_t {
345// vfork345// vfork
346// pid_t vfork(void);346// pid_t vfork(void);
347// asmlinkage long sys_vfork(void);347// asmlinkage long sys_vfork(void);
348pub const vfork = @compileError("TODO: vfork");348pub fn vfork() errno.Error!pid_t {
349 const r = syscall0(.vfork);
350 return switch (_errno(r)) {
351 .ok => @intCast(r),
352 _ => |c| errno.errorFromInt(@intFromEnum(c)),
353 };
354}
349355
350// execve356// execve
351// int execve(const char *pathname, char *const _Nullable argv[], char *const _Nullable envp[]);357// int execve(const char *pathname, char *const _Nullable argv[], char *const _Nullable envp[]);
test.zig+1
...@@ -11,4 +11,5 @@ test {...@@ -11,4 +11,5 @@ test {
11 _ = &linux.pause;11 _ = &linux.pause;
12 _ = &linux.getpid;12 _ = &linux.getpid;
13 _ = &linux.fork;13 _ = &linux.fork;
14 _ = &linux.vfork;
14}15}