commit a9b7df4ca238bbf773a08c4c2c29ec15a4bc79bb (tree)
parent 7534ac736727c69c7314fdf194ef6a0ec30216a7
Author: Stephen Gregoratto <dev@sgregoratto.me>
Date: Fri, 20 Feb 2026 12:34:29 +1100
Linux: Map Alpha `getx*id` to their regularly named versions
These syscalls also store the value of `euid/egid/ppid` in `r20`, but
are otherwise the same.
Diffstat:
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig
@@ -2266,10 +2266,7 @@ pub fn getsid(pid: pid_t) usize {
pub fn getpid() pid_t {
// Casts result to a pid_t, safety-checking >= 0, because getpid() cannot fail
- return @intCast(@as(u32, @truncate(syscall0(comptime switch (native_arch) {
- .alpha => .getxpid,
- else => .getpid,
- }))));
+ return @intCast(@as(u32, @truncate(syscall0(.getpid))));
}
pub fn getppid() pid_t {
diff --git a/lib/std/os/linux/syscalls.zig b/lib/std/os/linux/syscalls.zig
@@ -5872,11 +5872,11 @@ pub const Alpha = enum(usize) {
brk = 17,
osf_getfsstat = 18,
lseek = 19,
- getxpid = 20,
+ getpid = 20,
osf_mount = 21,
umount2 = 22,
setuid = 23,
- getxuid = 24,
+ getuid = 24,
exec_with_loader = 25,
ptrace = 26,
osf_nrecvmsg = 27,
@@ -5899,7 +5899,7 @@ pub const Alpha = enum(usize) {
osf_profil = 44,
open = 45,
osf_old_sigaction = 46,
- getxgid = 47,
+ getgid = 47,
osf_sigprocmask = 48,
osf_getlogin = 49,
osf_setlogin = 50,
diff --git a/tools/generate_linux_syscalls.zig b/tools/generate_linux_syscalls.zig
@@ -28,6 +28,11 @@ const stdlib_renames = std.StaticStringMap([]const u8).initComptime(.{
// ARM EABI/Thumb.
.{ "arm_sync_file_range", "sync_file_range" },
.{ "arm_fadvise64_64", "fadvise64_64" },
+ // Alpha
+ // See https://github.com/torvalds/linux/blob/8bf22c33e7a172fbc72464f4cc484d23a6b412ba/arch/alpha/include/uapi/asm/unistd.h#L10
+ .{ "getxpid", "getpid" },
+ .{ "getxuid", "getuid" },
+ .{ "getxgid", "getgid" },
});
/// Filter syscalls that aren't actually syscalls.