╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ generate_linux_syscalls.zig ──────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
231 try Io.Writer.writeAll(stdout, h); 232 233 var lines = mem.tokenizeScalar(u8, table, '\n'); 234 while (lines.next()) |line| { 235 if (line[0] == '#') continue; 236 if (arch.get(line)) |res| { 237 const name, const num = res; 238 const final_name = stdlib_renames.get(name) orelse name; 239 try Io.Writer.print(stdout, " {f} = {d},\n", .{ std.zig.fmtId(final_name), num }); 240 } 241 } 242 243 if (arch.footer) |f| 244 try Io.Writer.writeAll(stdout, f); 245 try Io.Writer.writeAll(stdout, "};\n"); 246 if (i != architectures.len - 1) 247 try Io.Writer.writeByte(stdout, '\n'); 248 } 249 250 try Io.Writer.flush(stdout); 251 } 252 253 fn usage(w: *std.Io.Writer, arg0: []const u8) std.Io.Writer.Error!void { 254 try w.print( 255 \\Usage: {s} /path/to/linux 256 \\Alternative Usage: zig run /path/to/git/zig/tools/generate_linux_syscalls.zig -- /path/to/linux 257 \\ 258 \\Generates the list of Linux syscalls for each supported cpu arch, using the Linux development tree. 259 \\Prints to stdout Zig code which you can use to replace the file lib/std/os/linux/syscalls.zig. 260 \\ 261 , .{arg0}); 262 } 263