| ... | ... | @@ -10,6 +10,7 @@ const syscall5 = sys.syscall5; |
| 10 | 10 | const syscall6 = sys.syscall6; |
| 11 | 11 | const pid_t = sys.pid_t; |
| 12 | 12 | const uid_t = sys.uid_t; |
| 13 | const gid_t = sys.gid_t; |
| 13 | 14 | |
| 14 | 15 | fn _errno(rc: usize) enum(c_ushort) { ok, _ } { |
| 15 | 16 | const signed: isize = @bitCast(rc); |
| ... | ... | @@ -588,7 +589,13 @@ pub const syslog = @compileError("TODO: syslog"); |
| 588 | 589 | // getgid |
| 589 | 590 | // gid_t getgid(void); |
| 590 | 591 | // asmlinkage long sys_getgid(void); |
| 591 | | pub const getgid = @compileError("TODO: getgid"); |
| 592 | pub fn getgid() errno.Error!gid_t { |
| 593 | const r = syscall0(.getgid); |
| 594 | return switch (_errno(r)) { |
| 595 | .ok => @intCast(r), |
| 596 | _ => |c| errno.errorFromInt(@intFromEnum(c)), |
| 597 | }; |
| 598 | } |
| 592 | 599 | |
| 593 | 600 | // setuid |
| 594 | 601 | // int setuid(uid_t uid); |