| ... | ... | @@ -9,6 +9,7 @@ const syscall4 = sys.syscall4; |
| 9 | 9 | const syscall5 = sys.syscall5; |
| 10 | 10 | const syscall6 = sys.syscall6; |
| 11 | 11 | const pid_t = sys.pid_t; |
| 12 | const uid_t = sys.uid_t; |
| 12 | 13 | |
| 13 | 14 | fn _errno(rc: usize) enum(c_ushort) { ok, _ } { |
| 14 | 15 | const signed: isize = @bitCast(rc); |
| ... | ... | @@ -571,7 +572,13 @@ pub const ptrace = @compileError("TODO: ptrace"); |
| 571 | 572 | // getuid |
| 572 | 573 | // uid_t getuid(void); |
| 573 | 574 | // asmlinkage long sys_getuid(void); |
| 574 | | pub const getuid = @compileError("TODO: getuid"); |
| 575 | pub fn getuid() errno.Error!uid_t { |
| 576 | const r = syscall0(.getuid); |
| 577 | return switch (_errno(r)) { |
| 578 | .ok => @intCast(r), |
| 579 | _ => |c| errno.errorFromInt(@intFromEnum(c)), |
| 580 | }; |
| 581 | } |
| 575 | 582 | |
| 576 | 583 | // syslog |
| 577 | 584 | // int syscall(SYS_syslog, int type, char *bufp, int len); |