diff --git a/mod.zig b/mod.zig index 7ab7f3a4cdbc8ecf552657241f86a45df60492a6..241090d30dee9afd64b221011f88077e2fcef204 100644 --- a/mod.zig +++ b/mod.zig @@ -637,7 +637,13 @@ pub const setpgid = @compileError("TODO: setpgid"); // getppid // pid_t getppid(void); // asmlinkage long sys_getppid(void); -pub const getppid = @compileError("TODO: getppid"); +pub fn getppid() errno.Error!pid_t { + const r = syscall0(.getppid); + return switch (_errno(r)) { + .ok => @intCast(r), + _ => |c| errno.errorFromInt(@intFromEnum(c)), + }; +} // getpgrp // pid_t getpgrp(void); diff --git a/test.zig b/test.zig index 7b67e5300f55490bf047fcc5c94820a2c887728f..0c369600affca40c7e8ba09b5e7fb082c425ba1c 100644 --- a/test.zig +++ b/test.zig @@ -16,4 +16,5 @@ test { _ = &linux.getgid; _ = &linux.geteuid; _ = &linux.getegid; + _ = &linux.getppid; }