authorgravatar for dev@sgregoratto.meStephen Gregoratto <dev@sgregoratto.me> 2023-02-05 10:40:24+11:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-02-05 03:25:21-05:00
logd4ce0fe7fea14bae889e03464980e5eca7a2ed1f
treefb2de9ffca1fc869123b28d2521e89ffd846e7ea
parent289e8fab7949bebfc39209b86a69317a53e747f8

Update Linux syscall list for 6.1, support Mips64

Follow up for #14541.

2 files changed, 35 insertions(+), 6 deletions(-)

lib/std/os/linux/syscalls.zig+10-6
...@@ -2057,7 +2057,7 @@ pub const Mips64 = enum(usize) {...@@ -2057,7 +2057,7 @@ pub const Mips64 = enum(usize) {
2057 writev = Linux + 19,2057 writev = Linux + 19,
2058 access = Linux + 20,2058 access = Linux + 20,
2059 pipe = Linux + 21,2059 pipe = Linux + 21,
2060 select = Linux + 22,2060 _newselect = Linux + 22,
2061 sched_yield = Linux + 23,2061 sched_yield = Linux + 23,
2062 mremap = Linux + 24,2062 mremap = Linux + 24,
2063 msync = Linux + 25,2063 msync = Linux + 25,
...@@ -2071,8 +2071,8 @@ pub const Mips64 = enum(usize) {...@@ -2071,8 +2071,8 @@ pub const Mips64 = enum(usize) {
2071 pause = Linux + 33,2071 pause = Linux + 33,
2072 nanosleep = Linux + 34,2072 nanosleep = Linux + 34,
2073 getitimer = Linux + 35,2073 getitimer = Linux + 35,
2074 alarm = Linux + 36,2074 setitimer = Linux + 36,
2075 setitimer = Linux + 37,2075 alarm = Linux + 37,
2076 getpid = Linux + 38,2076 getpid = Linux + 38,
2077 sendfile = Linux + 39,2077 sendfile = Linux + 39,
2078 socket = Linux + 40,2078 socket = Linux + 40,
...@@ -2286,7 +2286,7 @@ pub const Mips64 = enum(usize) {...@@ -2286,7 +2286,7 @@ pub const Mips64 = enum(usize) {
2286 mknodat = Linux + 249,2286 mknodat = Linux + 249,
2287 fchownat = Linux + 250,2287 fchownat = Linux + 250,
2288 futimesat = Linux + 251,2288 futimesat = Linux + 251,
2289 newfstatat = Linux + 252,2289 fstatat64 = Linux + 252,
2290 unlinkat = Linux + 253,2290 unlinkat = Linux + 253,
2291 renameat = Linux + 254,2291 renameat = Linux + 254,
2292 linkat = Linux + 255,2292 linkat = Linux + 255,
...@@ -2315,8 +2315,8 @@ pub const Mips64 = enum(usize) {...@@ -2315,8 +2315,8 @@ pub const Mips64 = enum(usize) {
2315 eventfd = Linux + 278,2315 eventfd = Linux + 278,
2316 fallocate = Linux + 279,2316 fallocate = Linux + 279,
2317 timerfd_create = Linux + 280,2317 timerfd_create = Linux + 280,
2318 timerfd_settime = Linux + 281,2318 timerfd_gettime = Linux + 281,
2319 timerfd_gettime = Linux + 282,2319 timerfd_settime = Linux + 282,
2320 signalfd4 = Linux + 283,2320 signalfd4 = Linux + 283,
2321 eventfd2 = Linux + 284,2321 eventfd2 = Linux + 284,
2322 epoll_create1 = Linux + 285,2322 epoll_create1 = Linux + 285,
...@@ -2382,9 +2382,13 @@ pub const Mips64 = enum(usize) {...@@ -2382,9 +2382,13 @@ pub const Mips64 = enum(usize) {
2382 process_madvise = Linux + 440,2382 process_madvise = Linux + 440,
2383 epoll_pwait2 = Linux + 441,2383 epoll_pwait2 = Linux + 441,
2384 mount_setattr = Linux + 442,2384 mount_setattr = Linux + 442,
2385 quotactl_fd = Linux + 443,
2385 landlock_create_ruleset = Linux + 444,2386 landlock_create_ruleset = Linux + 444,
2386 landlock_add_rule = Linux + 445,2387 landlock_add_rule = Linux + 445,
2387 landlock_restrict_self = Linux + 446,2388 landlock_restrict_self = Linux + 446,
2389 process_mrelease = Linux + 448,
2390 futex_waitv = Linux + 449,
2391 set_mempolicy_home_node = Linux + 450,
2388};2392};
23892393
2390pub const PowerPC = enum(usize) {2394pub const PowerPC = enum(usize) {
tools/generate_linux_syscalls.zig+25
...@@ -167,6 +167,31 @@ pub fn main() !void {...@@ -167,6 +167,31 @@ pub fn main() !void {
167167
168 try writer.writeAll("};\n\n");168 try writer.writeAll("};\n\n");
169 }169 }
170 {
171 try writer.writeAll(
172 \\pub const Mips64 = enum(usize) {
173 \\ pub const Linux = 5000;
174 \\
175 \\
176 );
177
178 const table = try linux_dir.readFile("arch/mips/kernel/syscalls/syscall_n64.tbl", buf);
179 var lines = mem.tokenize(u8, table, "\n");
180 while (lines.next()) |line| {
181 if (line[0] == '#') continue;
182
183 var fields = mem.tokenize(u8, line, " \t");
184 const number = fields.next() orelse return error.Incomplete;
185 // abi is always n64
186 _ = fields.next() orelse return error.Incomplete;
187 const name = fields.next() orelse return error.Incomplete;
188 const fixed_name = if (stdlib_renames.get(name)) |fixed| fixed else name;
189
190 try writer.print(" {s} = Linux + {s},\n", .{ zig.fmtId(fixed_name), number });
191 }
192
193 try writer.writeAll("};\n\n");
194 }
170 {195 {
171 try writer.writeAll("pub const PowerPC = enum(usize) {\n");196 try writer.writeAll("pub const PowerPC = enum(usize) {\n");
172197