From d4ce0fe7fea14bae889e03464980e5eca7a2ed1f Mon Sep 17 00:00:00 2001 From: Stephen Gregoratto Date: Sun, 5 Feb 2023 10:40:24 +1100 Subject: [PATCH] Update Linux syscall list for 6.1, support Mips64 Follow up for #14541. --- lib/std/os/linux/syscalls.zig | 16 ++++++++++------ tools/generate_linux_syscalls.zig | 25 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/lib/std/os/linux/syscalls.zig b/lib/std/os/linux/syscalls.zig index 36a8bae04c..f176a434b4 100644 --- a/lib/std/os/linux/syscalls.zig +++ b/lib/std/os/linux/syscalls.zig @@ -2057,7 +2057,7 @@ pub const Mips64 = enum(usize) { writev = Linux + 19, access = Linux + 20, pipe = Linux + 21, - select = Linux + 22, + _newselect = Linux + 22, sched_yield = Linux + 23, mremap = Linux + 24, msync = Linux + 25, @@ -2071,8 +2071,8 @@ pub const Mips64 = enum(usize) { pause = Linux + 33, nanosleep = Linux + 34, getitimer = Linux + 35, - alarm = Linux + 36, - setitimer = Linux + 37, + setitimer = Linux + 36, + alarm = Linux + 37, getpid = Linux + 38, sendfile = Linux + 39, socket = Linux + 40, @@ -2286,7 +2286,7 @@ pub const Mips64 = enum(usize) { mknodat = Linux + 249, fchownat = Linux + 250, futimesat = Linux + 251, - newfstatat = Linux + 252, + fstatat64 = Linux + 252, unlinkat = Linux + 253, renameat = Linux + 254, linkat = Linux + 255, @@ -2315,8 +2315,8 @@ pub const Mips64 = enum(usize) { eventfd = Linux + 278, fallocate = Linux + 279, timerfd_create = Linux + 280, - timerfd_settime = Linux + 281, - timerfd_gettime = Linux + 282, + timerfd_gettime = Linux + 281, + timerfd_settime = Linux + 282, signalfd4 = Linux + 283, eventfd2 = Linux + 284, epoll_create1 = Linux + 285, @@ -2382,9 +2382,13 @@ pub const Mips64 = enum(usize) { process_madvise = Linux + 440, epoll_pwait2 = Linux + 441, mount_setattr = Linux + 442, + quotactl_fd = Linux + 443, landlock_create_ruleset = Linux + 444, landlock_add_rule = Linux + 445, landlock_restrict_self = Linux + 446, + process_mrelease = Linux + 448, + futex_waitv = Linux + 449, + set_mempolicy_home_node = Linux + 450, }; pub const PowerPC = enum(usize) { diff --git a/tools/generate_linux_syscalls.zig b/tools/generate_linux_syscalls.zig index 67f098ac4f..11b18ae3bf 100644 --- a/tools/generate_linux_syscalls.zig +++ b/tools/generate_linux_syscalls.zig @@ -167,6 +167,31 @@ pub fn main() !void { try writer.writeAll("};\n\n"); } + { + try writer.writeAll( + \\pub const Mips64 = enum(usize) { + \\ pub const Linux = 5000; + \\ + \\ + ); + + const table = try linux_dir.readFile("arch/mips/kernel/syscalls/syscall_n64.tbl", buf); + var lines = mem.tokenize(u8, table, "\n"); + while (lines.next()) |line| { + if (line[0] == '#') continue; + + var fields = mem.tokenize(u8, line, " \t"); + const number = fields.next() orelse return error.Incomplete; + // abi is always n64 + _ = fields.next() orelse return error.Incomplete; + const name = fields.next() orelse return error.Incomplete; + const fixed_name = if (stdlib_renames.get(name)) |fixed| fixed else name; + + try writer.print(" {s} = Linux + {s},\n", .{ zig.fmtId(fixed_name), number }); + } + + try writer.writeAll("};\n\n"); + } { try writer.writeAll("pub const PowerPC = enum(usize) {\n");