| author | |
| committer | |
| log | e4a20839eb7acf88901557e0aa4561add16e17b7 |
| tree | 107969b39f5b26442d2bc10a932eb24a8b08e9c4 |
| parent | 4c2443935160b023dc181890a2a057b06942c67b |
2 files changed, 8 insertions(+), 1 deletions(-)
mod.zig+7-1| ... | ... | @@ -334,7 +334,13 @@ pub const clone = @compileError("TODO: clone"); |
| 334 | 334 | // fork |
| 335 | 335 | // pid_t fork(void); |
| 336 | 336 | // asmlinkage long sys_fork(void); |
| 337 | pub const fork = @compileError("TODO: fork"); | |
| 337 | pub fn fork() errno.Error!pid_t { | |
| 338 | const r = syscall0(.fork); | |
| 339 | return switch (_errno(r)) { | |
| 340 | .ok => @intCast(r), | |
| 341 | _ => |c| errno.errorFromInt(@intFromEnum(c)), | |
| 342 | }; | |
| 343 | } | |
| 338 | 344 | |
| 339 | 345 | // vfork |
| 340 | 346 | // pid_t vfork(void); |
test.zig+1| ... | ... | @@ -10,4 +10,5 @@ test { |
| 10 | 10 | _ = &linux.sched_yield; |
| 11 | 11 | _ = &linux.pause; |
| 12 | 12 | _ = &linux.getpid; |
| 13 | _ = &linux.fork; | |
| 13 | 14 | } |