authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-04-20 16:44:20 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-04-20 16:44:20 -07:00
loge7318c3cc9668ed44aa97500a1888164b0020423
treeb904e8e882c540914b426b3297006ec1a9c0b5df
parent3a24744fa7060550e61526bdd3eab451558010c0

add getppid


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

mod.zig+7-1
......@@ -637,7 +637,13 @@ pub const setpgid = @compileError("TODO: setpgid");
637637// getppid
638638// pid_t getppid(void);
639639// asmlinkage long sys_getppid(void);
640pub const getppid = @compileError("TODO: getppid");
640pub fn getppid() errno.Error!pid_t {
641 const r = syscall0(.getppid);
642 return switch (_errno(r)) {
643 .ok => @intCast(r),
644 _ => |c| errno.errorFromInt(@intFromEnum(c)),
645 };
646}
641647
642648// getpgrp
643649// pid_t getpgrp(void);
test.zig+1
......@@ -16,4 +16,5 @@ test {
1616 _ = &linux.getgid;
1717 _ = &linux.geteuid;
1818 _ = &linux.getegid;
19 _ = &linux.getppid;
1920}