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");...@@ -637,7 +637,13 @@ pub const setpgid = @compileError("TODO: setpgid");
637// getppid637// getppid
638// pid_t getppid(void);638// pid_t getppid(void);
639// asmlinkage long sys_getppid(void);639// 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
642// getpgrp648// getpgrp
643// pid_t getpgrp(void);649// pid_t getpgrp(void);
test.zig+1
...@@ -16,4 +16,5 @@ test {...@@ -16,4 +16,5 @@ test {
16 _ = &linux.getgid;16 _ = &linux.getgid;
17 _ = &linux.geteuid;17 _ = &linux.geteuid;
18 _ = &linux.getegid;18 _ = &linux.getegid;
19 _ = &linux.getppid;
19}20}