| author | |
| committer | |
| log | 669dae140c63b1bf4dbae6634145529333cd8371 |
| tree | 9ea258107e97dbe378daa8e79c2e0e9b0723fc1b |
| parent | 0870f17501aa7d2eaaf2d774ccbc5d72291664ca |
28 files changed, 181 insertions(+), 169 deletions(-)
lib/fuzzer.zig+39-45| ... | ... | @@ -1,18 +1,22 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const native_endian = builtin.cpu.arch.endian(); | |
| 3 | ||
| 2 | 4 | const std = @import("std"); |
| 5 | const Io = std.Io; | |
| 3 | 6 | const fatal = std.process.fatal; |
| 4 | 7 | const mem = std.mem; |
| 5 | 8 | const math = std.math; |
| 6 | const Allocator = mem.Allocator; | |
| 9 | const Allocator = std.mem.Allocator; | |
| 7 | 10 | const assert = std.debug.assert; |
| 8 | 11 | const panic = std.debug.panic; |
| 9 | 12 | const abi = std.Build.abi.fuzz; |
| 10 | const native_endian = builtin.cpu.arch.endian(); | |
| 11 | 13 | |
| 12 | 14 | pub const std_options = std.Options{ |
| 13 | 15 | .logFn = logOverride, |
| 14 | 16 | }; |
| 15 | 17 | |
| 18 | const io = std.Io.Threaded.global_single_threaded.ioBasic(); | |
| 19 | ||
| 16 | 20 | fn logOverride( |
| 17 | 21 | comptime level: std.log.Level, |
| 18 | 22 | comptime scope: @EnumLiteral(), |
| ... | ... | @@ -21,12 +25,12 @@ fn logOverride( |
| 21 | 25 | ) void { |
| 22 | 26 | const f = log_f orelse |
| 23 | 27 | panic("attempt to use log before initialization, message:\n" ++ format, args); |
| 24 | f.lock(.exclusive) catch |e| panic("failed to lock logging file: {t}", .{e}); | |
| 25 | defer f.unlock(); | |
| 28 | f.lock(io, .exclusive) catch |e| panic("failed to lock logging file: {t}", .{e}); | |
| 29 | defer f.unlock(io); | |
| 26 | 30 | |
| 27 | 31 | var buf: [256]u8 = undefined; |
| 28 | var fw = f.writer(&buf); | |
| 29 | const end = f.getEndPos() catch |e| panic("failed to get fuzzer log file end: {t}", .{e}); | |
| 32 | var fw = f.writer(io, &buf); | |
| 33 | const end = f.length(io) catch |e| panic("failed to get fuzzer log file end: {t}", .{e}); | |
| 30 | 34 | fw.seekTo(end) catch |e| panic("failed to seek to fuzzer log file end: {t}", .{e}); |
| 31 | 35 | |
| 32 | 36 | const prefix1 = comptime level.asText(); |
| ... | ... | @@ -45,7 +49,7 @@ const gpa = switch (builtin.mode) { |
| 45 | 49 | }; |
| 46 | 50 | |
| 47 | 51 | /// Part of `exec`, however seperate to allow it to be set before `exec` is. |
| 48 | var log_f: ?std.fs.File = null; | |
| 52 | var log_f: ?Io.File = null; | |
| 49 | 53 | var exec: Executable = .preinit; |
| 50 | 54 | var inst: Instrumentation = .preinit; |
| 51 | 55 | var fuzzer: Fuzzer = undefined; |
| ... | ... | @@ -59,7 +63,7 @@ const Executable = struct { |
| 59 | 63 | /// Tracks the hit count for each pc as updated by the process's instrumentation. |
| 60 | 64 | pc_counters: []u8, |
| 61 | 65 | |
| 62 | cache_f: std.fs.Dir, | |
| 66 | cache_f: Io.Dir, | |
| 63 | 67 | /// Shared copy of all pcs that have been hit stored in a memory-mapped file that can viewed |
| 64 | 68 | /// while the fuzzer is running. |
| 65 | 69 | shared_seen_pcs: MemoryMappedList, |
| ... | ... | @@ -76,16 +80,16 @@ const Executable = struct { |
| 76 | 80 | .pc_digest = undefined, |
| 77 | 81 | }; |
| 78 | 82 | |
| 79 | fn getCoverageFile(cache_dir: std.fs.Dir, pcs: []const usize, pc_digest: u64) MemoryMappedList { | |
| 83 | fn getCoverageFile(cache_dir: Io.Dir, pcs: []const usize, pc_digest: u64) MemoryMappedList { | |
| 80 | 84 | const pc_bitset_usizes = bitsetUsizes(pcs.len); |
| 81 | 85 | const coverage_file_name = std.fmt.hex(pc_digest); |
| 82 | 86 | comptime assert(abi.SeenPcsHeader.trailing[0] == .pc_bits_usize); |
| 83 | 87 | comptime assert(abi.SeenPcsHeader.trailing[1] == .pc_addr); |
| 84 | 88 | |
| 85 | var v = cache_dir.makeOpenPath("v", .{}) catch |e| | |
| 89 | var v = cache_dir.createDirPathOpen(io, "v", .{}) catch |e| | |
| 86 | 90 | panic("failed to create directory 'v': {t}", .{e}); |
| 87 | defer v.close(); | |
| 88 | const coverage_file, const populate = if (v.createFile(&coverage_file_name, .{ | |
| 91 | defer v.close(io); | |
| 92 | const coverage_file, const populate = if (v.createFile(io, &coverage_file_name, .{ | |
| 89 | 93 | .read = true, |
| 90 | 94 | // If we create the file, we want to block other processes while we populate it |
| 91 | 95 | .lock = .exclusive, |
| ... | ... | @@ -93,7 +97,7 @@ const Executable = struct { |
| 93 | 97 | })) |f| |
| 94 | 98 | .{ f, true } |
| 95 | 99 | else |e| switch (e) { |
| 96 | error.PathAlreadyExists => .{ v.openFile(&coverage_file_name, .{ | |
| 100 | error.PathAlreadyExists => .{ v.openFile(io, &coverage_file_name, .{ | |
| 97 | 101 | .mode = .read_write, |
| 98 | 102 | .lock = .shared, |
| 99 | 103 | }) catch |e2| panic( |
| ... | ... | @@ -108,7 +112,7 @@ const Executable = struct { |
| 108 | 112 | pcs.len * @sizeOf(usize); |
| 109 | 113 | |
| 110 | 114 | if (populate) { |
| 111 | defer coverage_file.lock(.shared) catch |e| panic( | |
| 115 | defer coverage_file.lock(io, .shared) catch |e| panic( | |
| 112 | 116 | "failed to demote lock for coverage file '{s}': {t}", |
| 113 | 117 | .{ &coverage_file_name, e }, |
| 114 | 118 | ); |
| ... | ... | @@ -130,10 +134,8 @@ const Executable = struct { |
| 130 | 134 | } |
| 131 | 135 | return map; |
| 132 | 136 | } else { |
| 133 | const size = coverage_file.getEndPos() catch |e| panic( | |
| 134 | "failed to stat coverage file '{s}': {t}", | |
| 135 | .{ &coverage_file_name, e }, | |
| 136 | ); | |
| 137 | const size = coverage_file.length(io) catch |e| | |
| 138 | panic("failed to stat coverage file '{s}': {t}", .{ &coverage_file_name, e }); | |
| 137 | 139 | if (size != coverage_file_len) panic( |
| 138 | 140 | "incompatible existing coverage file '{s}' (differing lengths: {} != {})", |
| 139 | 141 | .{ &coverage_file_name, size, coverage_file_len }, |
| ... | ... | @@ -165,13 +167,11 @@ const Executable = struct { |
| 165 | 167 | pub fn init(cache_dir_path: []const u8) Executable { |
| 166 | 168 | var self: Executable = undefined; |
| 167 | 169 | |
| 168 | const cache_dir = std.fs.cwd().makeOpenPath(cache_dir_path, .{}) catch |e| panic( | |
| 169 | "failed to open directory '{s}': {t}", | |
| 170 | .{ cache_dir_path, e }, | |
| 171 | ); | |
| 172 | log_f = cache_dir.createFile("tmp/libfuzzer.log", .{ .truncate = false }) catch |e| | |
| 170 | const cache_dir = Io.Dir.cwd().createDirPathOpen(io, cache_dir_path, .{}) catch |e| | |
| 171 | panic("failed to open directory '{s}': {t}", .{ cache_dir_path, e }); | |
| 172 | log_f = cache_dir.createFile(io, "tmp/libfuzzer.log", .{ .truncate = false }) catch |e| | |
| 173 | 173 | panic("failed to create file 'tmp/libfuzzer.log': {t}", .{e}); |
| 174 | self.cache_f = cache_dir.makeOpenPath("f", .{}) catch |e| | |
| 174 | self.cache_f = cache_dir.createDirPathOpen(io, "f", .{}) catch |e| | |
| 175 | 175 | panic("failed to open directory 'f': {t}", .{e}); |
| 176 | 176 | |
| 177 | 177 | // Linkers are expected to automatically add symbols prefixed with these for the start and |
| ... | ... | @@ -391,7 +391,7 @@ const Fuzzer = struct { |
| 391 | 391 | mutations: std.ArrayList(Mutation) = .empty, |
| 392 | 392 | |
| 393 | 393 | /// Filesystem directory containing found inputs for future runs |
| 394 | corpus_dir: std.fs.Dir, | |
| 394 | corpus_dir: Io.Dir, | |
| 395 | 395 | corpus_dir_idx: usize = 0, |
| 396 | 396 | |
| 397 | 397 | pub fn init(test_one: abi.TestOne, unit_test_name: []const u8) Fuzzer { |
| ... | ... | @@ -405,10 +405,10 @@ const Fuzzer = struct { |
| 405 | 405 | }; |
| 406 | 406 | const arena = self.arena_ctx.allocator(); |
| 407 | 407 | |
| 408 | self.corpus_dir = exec.cache_f.makeOpenPath(unit_test_name, .{}) catch |e| | |
| 408 | self.corpus_dir = exec.cache_f.createDirPathOpen(io, unit_test_name, .{}) catch |e| | |
| 409 | 409 | panic("failed to open directory '{s}': {t}", .{ unit_test_name, e }); |
| 410 | 410 | self.input = in: { |
| 411 | const f = self.corpus_dir.createFile("in", .{ | |
| 411 | const f = self.corpus_dir.createFile(io, "in", .{ | |
| 412 | 412 | .read = true, |
| 413 | 413 | .truncate = false, |
| 414 | 414 | // In case any other fuzz tests are running under the same test name, |
| ... | ... | @@ -419,7 +419,7 @@ const Fuzzer = struct { |
| 419 | 419 | error.WouldBlock => @panic("input file 'in' is in use by another fuzzing process"), |
| 420 | 420 | else => panic("failed to create input file 'in': {t}", .{e}), |
| 421 | 421 | }; |
| 422 | const size = f.getEndPos() catch |e| panic("failed to stat input file 'in': {t}", .{e}); | |
| 422 | const size = f.length(io) catch |e| panic("failed to stat input file 'in': {t}", .{e}); | |
| 423 | 423 | const map = (if (size < std.heap.page_size_max) |
| 424 | 424 | MemoryMappedList.create(f, 8, std.heap.page_size_max) |
| 425 | 425 | else |
| ... | ... | @@ -445,6 +445,7 @@ const Fuzzer = struct { |
| 445 | 445 | while (true) { |
| 446 | 446 | var name_buf: [@sizeOf(usize) * 2]u8 = undefined; |
| 447 | 447 | const bytes = self.corpus_dir.readFileAlloc( |
| 448 | io, | |
| 448 | 449 | std.fmt.bufPrint(&name_buf, "{x}", .{self.corpus_dir_idx}) catch unreachable, |
| 449 | 450 | arena, |
| 450 | 451 | .unlimited, |
| ... | ... | @@ -466,7 +467,7 @@ const Fuzzer = struct { |
| 466 | 467 | self.input.deinit(); |
| 467 | 468 | self.corpus.deinit(gpa); |
| 468 | 469 | self.mutations.deinit(gpa); |
| 469 | self.corpus_dir.close(); | |
| 470 | self.corpus_dir.close(io); | |
| 470 | 471 | self.arena_ctx.deinit(); |
| 471 | 472 | self.* = undefined; |
| 472 | 473 | } |
| ... | ... | @@ -573,17 +574,10 @@ const Fuzzer = struct { |
| 573 | 574 | |
| 574 | 575 | // Write new corpus to cache |
| 575 | 576 | var name_buf: [@sizeOf(usize) * 2]u8 = undefined; |
| 576 | self.corpus_dir.writeFile(.{ | |
| 577 | .sub_path = std.fmt.bufPrint( | |
| 578 | &name_buf, | |
| 579 | "{x}", | |
| 580 | .{self.corpus_dir_idx}, | |
| 581 | ) catch unreachable, | |
| 577 | self.corpus_dir.writeFile(io, .{ | |
| 578 | .sub_path = std.fmt.bufPrint(&name_buf, "{x}", .{self.corpus_dir_idx}) catch unreachable, | |
| 582 | 579 | .data = bytes, |
| 583 | }) catch |e| panic( | |
| 584 | "failed to write corpus file '{x}': {t}", | |
| 585 | .{ self.corpus_dir_idx, e }, | |
| 586 | ); | |
| 580 | }) catch |e| panic("failed to write corpus file '{x}': {t}", .{ self.corpus_dir_idx, e }); | |
| 587 | 581 | self.corpus_dir_idx += 1; |
| 588 | 582 | } |
| 589 | 583 | } |
| ... | ... | @@ -1320,9 +1314,9 @@ pub const MemoryMappedList = struct { |
| 1320 | 1314 | /// How many bytes this list can hold without allocating additional memory. |
| 1321 | 1315 | capacity: usize, |
| 1322 | 1316 | /// The file is kept open so that it can be resized. |
| 1323 | file: std.fs.File, | |
| 1317 | file: Io.File, | |
| 1324 | 1318 | |
| 1325 | pub fn init(file: std.fs.File, length: usize, capacity: usize) !MemoryMappedList { | |
| 1319 | pub fn init(file: Io.File, length: usize, capacity: usize) !MemoryMappedList { | |
| 1326 | 1320 | const ptr = try std.posix.mmap( |
| 1327 | 1321 | null, |
| 1328 | 1322 | capacity, |
| ... | ... | @@ -1338,13 +1332,13 @@ pub const MemoryMappedList = struct { |
| 1338 | 1332 | }; |
| 1339 | 1333 | } |
| 1340 | 1334 | |
| 1341 | pub fn create(file: std.fs.File, length: usize, capacity: usize) !MemoryMappedList { | |
| 1342 | try file.setEndPos(capacity); | |
| 1335 | pub fn create(file: Io.File, length: usize, capacity: usize) !MemoryMappedList { | |
| 1336 | try file.setLength(io, capacity); | |
| 1343 | 1337 | return init(file, length, capacity); |
| 1344 | 1338 | } |
| 1345 | 1339 | |
| 1346 | 1340 | pub fn deinit(l: *MemoryMappedList) void { |
| 1347 | l.file.close(); | |
| 1341 | l.file.close(io); | |
| 1348 | 1342 | std.posix.munmap(@volatileCast(l.items.ptr[0..l.capacity])); |
| 1349 | 1343 | l.* = undefined; |
| 1350 | 1344 | } |
| ... | ... | @@ -1369,7 +1363,7 @@ pub const MemoryMappedList = struct { |
| 1369 | 1363 | if (l.capacity >= new_capacity) return; |
| 1370 | 1364 | |
| 1371 | 1365 | std.posix.munmap(@volatileCast(l.items.ptr[0..l.capacity])); |
| 1372 | try l.file.setEndPos(new_capacity); | |
| 1366 | try l.file.setLength(io, new_capacity); | |
| 1373 | 1367 | l.* = try init(l.file, l.items.len, new_capacity); |
| 1374 | 1368 | } |
| 1375 | 1369 |
test/standalone/child_process/child.zig+6-6| ... | ... | @@ -26,14 +26,14 @@ fn run(allocator: std.mem.Allocator, io: Io) !void { |
| 26 | 26 | const hello_arg = "hello arg"; |
| 27 | 27 | const a1 = args.next() orelse unreachable; |
| 28 | 28 | if (!std.mem.eql(u8, a1, hello_arg)) { |
| 29 | testError("first arg: '{s}'; want '{s}'", .{ a1, hello_arg }); | |
| 29 | testError(io, "first arg: '{s}'; want '{s}'", .{ a1, hello_arg }); | |
| 30 | 30 | } |
| 31 | 31 | if (args.next()) |a2| { |
| 32 | testError("expected only one arg; got more: {s}", .{a2}); | |
| 32 | testError(io, "expected only one arg; got more: {s}", .{a2}); | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // test stdout pipe; parent verifies |
| 36 | try std.Io.File.stdout().writeAll("hello from stdout"); | |
| 36 | try std.Io.File.stdout().writeStreamingAll(io, "hello from stdout"); | |
| 37 | 37 | |
| 38 | 38 | // test stdin pipe from parent |
| 39 | 39 | const hello_stdin = "hello from stdin"; |
| ... | ... | @@ -42,12 +42,12 @@ fn run(allocator: std.mem.Allocator, io: Io) !void { |
| 42 | 42 | var reader = stdin.reader(io, &.{}); |
| 43 | 43 | const n = try reader.interface.readSliceShort(&buf); |
| 44 | 44 | if (!std.mem.eql(u8, buf[0..n], hello_stdin)) { |
| 45 | testError("stdin: '{s}'; want '{s}'", .{ buf[0..n], hello_stdin }); | |
| 45 | testError(io, "stdin: '{s}'; want '{s}'", .{ buf[0..n], hello_stdin }); | |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | fn testError(comptime fmt: []const u8, args: anytype) void { | |
| 50 | var stderr_writer = std.Io.File.stderr().writer(&.{}); | |
| 49 | fn testError(io: Io, comptime fmt: []const u8, args: anytype) void { | |
| 50 | var stderr_writer = std.Io.File.stderr().writer(io, &.{}); | |
| 51 | 51 | const stderr = &stderr_writer.interface; |
| 52 | 52 | stderr.print("CHILD TEST ERROR: ", .{}) catch {}; |
| 53 | 53 | stderr.print(fmt, args) catch {}; |
test/standalone/child_process/main.zig+2-2| ... | ... | @@ -31,7 +31,7 @@ pub fn main() !void { |
| 31 | 31 | child.stderr_behavior = .Inherit; |
| 32 | 32 | try child.spawn(io); |
| 33 | 33 | const child_stdin = child.stdin.?; |
| 34 | try child_stdin.writeAll("hello from stdin"); // verified in child | |
| 34 | try child_stdin.writeStreamingAll(io, "hello from stdin"); // verified in child | |
| 35 | 35 | child_stdin.close(io); |
| 36 | 36 | child.stdin = null; |
| 37 | 37 | |
| ... | ... | @@ -43,7 +43,7 @@ pub fn main() !void { |
| 43 | 43 | testError(io, "child stdout: '{s}'; want '{s}'", .{ buf[0..n], hello_stdout }); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | switch (try child.wait()) { | |
| 46 | switch (try child.wait(io)) { | |
| 47 | 47 | .Exited => |code| { |
| 48 | 48 | const child_ok_code = 42; // set by child if no test errors |
| 49 | 49 | if (code != child_ok_code) { |
test/standalone/dirname/exists_in.zig+1-1| ... | ... | @@ -39,5 +39,5 @@ fn run(allocator: std.mem.Allocator) !void { |
| 39 | 39 | var dir = try std.Io.Dir.cwd().openDir(io, dir_path, .{}); |
| 40 | 40 | defer dir.close(io); |
| 41 | 41 | |
| 42 | _ = try dir.statFile(io, relpath); | |
| 42 | _ = try dir.statFile(io, relpath, .{}); | |
| 43 | 43 | } |
test/standalone/dirname/touch.zig+1-1| ... | ... | @@ -34,7 +34,7 @@ fn run(allocator: std.mem.Allocator) !void { |
| 34 | 34 | var dir = try std.Io.Dir.cwd().openDir(io, dir_path, .{}); |
| 35 | 35 | defer dir.close(io); |
| 36 | 36 | |
| 37 | _ = dir.statFile(io, basename) catch { | |
| 37 | _ = dir.statFile(io, basename, .{}) catch { | |
| 38 | 38 | var file = try dir.createFile(io, basename, .{}); |
| 39 | 39 | file.close(io); |
| 40 | 40 | }; |
test/standalone/install_headers/check_exists.zig+3-3| ... | ... | @@ -14,7 +14,7 @@ pub fn main() !void { |
| 14 | 14 | const io = std.Io.Threaded.global_single_threaded.ioBasic(); |
| 15 | 15 | |
| 16 | 16 | const cwd = std.Io.Dir.cwd(); |
| 17 | const cwd_realpath = try cwd.realPathAlloc(io, arena, "."); | |
| 17 | const cwd_realpath = try cwd.realPathFileAlloc(io, ".", arena); | |
| 18 | 18 | |
| 19 | 19 | while (arg_it.next()) |file_path| { |
| 20 | 20 | if (file_path.len > 0 and file_path[0] == '!') { |
| ... | ... | @@ -22,7 +22,7 @@ pub fn main() !void { |
| 22 | 22 | "exclusive file check '{s}{c}{s}' failed", |
| 23 | 23 | .{ cwd_realpath, std.fs.path.sep, file_path[1..] }, |
| 24 | 24 | ); |
| 25 | if (cwd.statFile(io, file_path[1..])) |_| { | |
| 25 | if (cwd.statFile(io, file_path[1..], .{})) |_| { | |
| 26 | 26 | return error.FileFound; |
| 27 | 27 | } else |err| switch (err) { |
| 28 | 28 | error.FileNotFound => {}, |
| ... | ... | @@ -33,7 +33,7 @@ pub fn main() !void { |
| 33 | 33 | "inclusive file check '{s}{c}{s}' failed", |
| 34 | 34 | .{ cwd_realpath, std.fs.path.sep, file_path }, |
| 35 | 35 | ); |
| 36 | _ = try cwd.statFile(io, file_path); | |
| 36 | _ = try cwd.statFile(io, file_path, .{}); | |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | } |
test/standalone/run_output_caching/main.zig+1-1| ... | ... | @@ -7,5 +7,5 @@ pub fn main() !void { |
| 7 | 7 | const filename = args.next().?; |
| 8 | 8 | const file = try std.Io.Dir.cwd().createFile(io, filename, .{}); |
| 9 | 9 | defer file.close(io); |
| 10 | try file.writeAll(io, filename); | |
| 10 | try file.writeStreamingAll(io, filename); | |
| 11 | 11 | } |
test/standalone/run_output_paths/create_file.zig+2-2| ... | ... | @@ -10,8 +10,8 @@ pub fn main() !void { |
| 10 | 10 | else |
| 11 | 11 | dir_name, .{}); |
| 12 | 12 | const file_name = args.next().?; |
| 13 | const file = try dir.createFile(file_name, .{}); | |
| 14 | var file_writer = file.writer(&.{}); | |
| 13 | const file = try dir.createFile(io, file_name, .{}); | |
| 14 | var file_writer = file.writer(io, &.{}); | |
| 15 | 15 | try file_writer.interface.print( |
| 16 | 16 | \\{s} |
| 17 | 17 | \\{s} |
test/standalone/self_exe_symlink/main.zig+3-2| ... | ... | @@ -12,10 +12,11 @@ pub fn main() !void { |
| 12 | 12 | const self_path = try std.process.executablePathAlloc(io, gpa); |
| 13 | 13 | defer gpa.free(self_path); |
| 14 | 14 | |
| 15 | var self_exe = try std.fs.openSelfExe(.{}); | |
| 15 | var self_exe = try std.process.openExecutable(io, .{}); | |
| 16 | 16 | defer self_exe.close(io); |
| 17 | ||
| 17 | 18 | var buf: [std.fs.max_path_bytes]u8 = undefined; |
| 18 | const self_exe_path = try std.os.getFdPath(self_exe.handle, &buf); | |
| 19 | const self_exe_path = buf[0..try self_exe.realPath(io, &buf)]; | |
| 19 | 20 | |
| 20 | 21 | try std.testing.expectEqualStrings(self_exe_path, self_path); |
| 21 | 22 | } |
tools/dump-cov.zig+5-3| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | //! including file:line:column information for each PC. |
| 3 | 3 | |
| 4 | 4 | const std = @import("std"); |
| 5 | const Io = std.Io; | |
| 5 | 6 | const fatal = std.process.fatal; |
| 6 | 7 | const Path = std.Build.Cache.Path; |
| 7 | 8 | const assert = std.debug.assert; |
| ... | ... | @@ -16,7 +17,7 @@ pub fn main() !void { |
| 16 | 17 | defer arena_instance.deinit(); |
| 17 | 18 | const arena = arena_instance.allocator(); |
| 18 | 19 | |
| 19 | var threaded: std.Io.Threaded = .init(gpa, .{}); | |
| 20 | var threaded: Io.Threaded = .init(gpa, .{}); | |
| 20 | 21 | defer threaded.deinit(); |
| 21 | 22 | const io = threaded.io(); |
| 22 | 23 | |
| ... | ... | @@ -57,6 +58,7 @@ pub fn main() !void { |
| 57 | 58 | defer debug_info.deinit(gpa); |
| 58 | 59 | |
| 59 | 60 | const cov_bytes = cov_path.root_dir.handle.readFileAllocOptions( |
| 61 | io, | |
| 60 | 62 | cov_path.sub_path, |
| 61 | 63 | arena, |
| 62 | 64 | .limited(1 << 30), |
| ... | ... | @@ -67,7 +69,7 @@ pub fn main() !void { |
| 67 | 69 | }; |
| 68 | 70 | |
| 69 | 71 | var stdout_buffer: [4000]u8 = undefined; |
| 70 | var stdout_writer = std.fs.File.stdout().writerStreaming(&stdout_buffer); | |
| 72 | var stdout_writer = Io.File.stdout().writerStreaming(io, &stdout_buffer); | |
| 71 | 73 | const stdout = &stdout_writer.interface; |
| 72 | 74 | |
| 73 | 75 | const header: *SeenPcsHeader = @ptrCast(cov_bytes); |
| ... | ... | @@ -83,7 +85,7 @@ pub fn main() !void { |
| 83 | 85 | std.mem.sortUnstable(usize, sorted_pcs, {}, std.sort.asc(usize)); |
| 84 | 86 | |
| 85 | 87 | const source_locations = try arena.alloc(std.debug.Coverage.SourceLocation, sorted_pcs.len); |
| 86 | try debug_info.resolveAddresses(gpa, sorted_pcs, source_locations); | |
| 88 | try debug_info.resolveAddresses(gpa, io, sorted_pcs, source_locations); | |
| 87 | 89 | |
| 88 | 90 | const seen_pcs = header.seenBits(); |
| 89 | 91 |
tools/fetch_them_macos_headers.zig+6-9| ... | ... | @@ -92,7 +92,7 @@ pub fn main() anyerror!void { |
| 92 | 92 | |
| 93 | 93 | const sysroot_path = sysroot orelse blk: { |
| 94 | 94 | const target = try std.zig.system.resolveTargetQuery(io, .{}); |
| 95 | break :blk std.zig.system.darwin.getSdk(allocator, &target) orelse | |
| 95 | break :blk std.zig.system.darwin.getSdk(allocator, io, &target) orelse | |
| 96 | 96 | fatal("no SDK found; you can provide one explicitly with '--sysroot' flag", .{}); |
| 97 | 97 | }; |
| 98 | 98 | |
| ... | ... | @@ -166,10 +166,7 @@ fn fetchTarget( |
| 166 | 166 | }); |
| 167 | 167 | try cc_argv.appendSlice(args); |
| 168 | 168 | |
| 169 | const res = try std.process.Child.run(.{ | |
| 170 | .allocator = arena, | |
| 171 | .argv = cc_argv.items, | |
| 172 | }); | |
| 169 | const res = try std.process.Child.run(arena, io, .{ .argv = cc_argv.items }); | |
| 173 | 170 | |
| 174 | 171 | if (res.stderr.len != 0) { |
| 175 | 172 | std.log.err("{s}", .{res.stderr}); |
| ... | ... | @@ -179,7 +176,7 @@ fn fetchTarget( |
| 179 | 176 | const headers_list_file = try tmp.dir.openFile(io, headers_list_filename, .{}); |
| 180 | 177 | defer headers_list_file.close(io); |
| 181 | 178 | |
| 182 | var headers_dir = Dir.cwd().openDir(headers_source_prefix, .{}) catch |err| switch (err) { | |
| 179 | var headers_dir = Dir.cwd().openDir(io, headers_source_prefix, .{}) catch |err| switch (err) { | |
| 183 | 180 | error.FileNotFound, |
| 184 | 181 | error.NotDir, |
| 185 | 182 | => fatal("path '{s}' not found or not a directory. Did you accidentally delete it?", .{ |
| ... | ... | @@ -215,15 +212,15 @@ fn fetchTarget( |
| 215 | 212 | |
| 216 | 213 | const line_stripped = mem.trim(u8, line, " \\"); |
| 217 | 214 | const abs_dirname = Dir.path.dirname(line_stripped).?; |
| 218 | var orig_subdir = try Dir.cwd().openDir(abs_dirname, .{}); | |
| 215 | var orig_subdir = try Dir.cwd().openDir(io, abs_dirname, .{}); | |
| 219 | 216 | defer orig_subdir.close(io); |
| 220 | 217 | |
| 221 | try orig_subdir.copyFile(basename, maybe_dir.value_ptr.*, basename, .{}); | |
| 218 | try orig_subdir.copyFile(basename, maybe_dir.value_ptr.*, basename, io, .{}); | |
| 222 | 219 | } |
| 223 | 220 | } |
| 224 | 221 | |
| 225 | 222 | var dir_it = dirs.iterator(); |
| 226 | while (dir_it.next(io)) |entry| { | |
| 223 | while (dir_it.next()) |entry| { | |
| 227 | 224 | entry.value_ptr.close(io); |
| 228 | 225 | } |
| 229 | 226 | } |
tools/gen_macos_headers_c.zig+6-6| ... | ... | @@ -38,7 +38,7 @@ pub fn main() anyerror!void { |
| 38 | 38 | |
| 39 | 39 | if (positionals.items.len != 1) fatal("expected one positional argument: [dir]", .{}); |
| 40 | 40 | |
| 41 | var dir = try std.fs.cwd().openDir(io, positionals.items[0], .{ .follow_symlinks = false }); | |
| 41 | var dir = try Io.Dir.cwd().openDir(io, positionals.items[0], .{ .follow_symlinks = false }); | |
| 42 | 42 | defer dir.close(io); |
| 43 | 43 | var paths = std.array_list.Managed([]const u8).init(arena); |
| 44 | 44 | try findHeaders(arena, io, dir, "", &paths); |
| ... | ... | @@ -53,7 +53,7 @@ pub fn main() anyerror!void { |
| 53 | 53 | std.mem.sort([]const u8, paths.items, {}, SortFn.lessThan); |
| 54 | 54 | |
| 55 | 55 | var buffer: [2000]u8 = undefined; |
| 56 | var stdout_writer = std.fs.File.stdout().writerStreaming(&buffer); | |
| 56 | var stdout_writer = Io.File.stdout().writerStreaming(io, &buffer); | |
| 57 | 57 | const w = &stdout_writer.interface; |
| 58 | 58 | try w.writeAll("#define _XOPEN_SOURCE\n"); |
| 59 | 59 | for (paths.items) |path| { |
| ... | ... | @@ -75,18 +75,18 @@ fn findHeaders( |
| 75 | 75 | paths: *std.array_list.Managed([]const u8), |
| 76 | 76 | ) anyerror!void { |
| 77 | 77 | var it = dir.iterate(); |
| 78 | while (try it.next()) |entry| { | |
| 78 | while (try it.next(io)) |entry| { | |
| 79 | 79 | switch (entry.kind) { |
| 80 | 80 | .directory => { |
| 81 | const path = try std.fs.path.join(arena, &.{ prefix, entry.name }); | |
| 81 | const path = try Io.Dir.path.join(arena, &.{ prefix, entry.name }); | |
| 82 | 82 | var subdir = try dir.openDir(io, entry.name, .{ .follow_symlinks = false }); |
| 83 | 83 | defer subdir.close(io); |
| 84 | 84 | try findHeaders(arena, io, subdir, path, paths); |
| 85 | 85 | }, |
| 86 | 86 | .file, .sym_link => { |
| 87 | const ext = std.fs.path.extension(entry.name); | |
| 87 | const ext = Io.Dir.path.extension(entry.name); | |
| 88 | 88 | if (!std.mem.eql(u8, ext, ".h")) continue; |
| 89 | const path = try std.fs.path.join(arena, &.{ prefix, entry.name }); | |
| 89 | const path = try Io.Dir.path.join(arena, &.{ prefix, entry.name }); | |
| 90 | 90 | try paths.append(path); |
| 91 | 91 | }, |
| 92 | 92 | else => {}, |
tools/gen_outline_atomics.zig+6-1| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const Io = std.Io; | |
| 2 | 3 | const Allocator = std.mem.Allocator; |
| 3 | 4 | |
| 4 | 5 | const AtomicOp = enum { |
| ... | ... | @@ -15,10 +16,14 @@ pub fn main() !void { |
| 15 | 16 | defer arena_instance.deinit(); |
| 16 | 17 | const arena = arena_instance.allocator(); |
| 17 | 18 | |
| 19 | var threaded: std.Io.Threaded = .init(arena, .{}); | |
| 20 | defer threaded.deinit(); | |
| 21 | const io = threaded.io(); | |
| 22 | ||
| 18 | 23 | //const args = try std.process.argsAlloc(arena); |
| 19 | 24 | |
| 20 | 25 | var stdout_buffer: [2000]u8 = undefined; |
| 21 | var stdout_writer = std.fs.File.stdout().writerStreaming(&stdout_buffer); | |
| 26 | var stdout_writer = Io.File.stdout().writerStreaming(io, &stdout_buffer); | |
| 22 | 27 | const w = &stdout_writer.interface; |
| 23 | 28 | |
| 24 | 29 | try w.writeAll( |
tools/gen_spirv_spec.zig+20-14| ... | ... | @@ -1,5 +1,7 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const Io = std.Io; | |
| 2 | 3 | const Allocator = std.mem.Allocator; |
| 4 | ||
| 3 | 5 | const g = @import("spirv/grammar.zig"); |
| 4 | 6 | const CoreRegistry = g.CoreRegistry; |
| 5 | 7 | const ExtensionRegistry = g.ExtensionRegistry; |
| ... | ... | @@ -63,24 +65,28 @@ pub fn main() !void { |
| 63 | 65 | usageAndExit(args[0], 1); |
| 64 | 66 | } |
| 65 | 67 | |
| 66 | const json_path = try std.fs.path.join(allocator, &.{ args[1], "include/spirv/unified1/" }); | |
| 67 | const dir = try std.fs.cwd().openDir(json_path, .{ .iterate = true }); | |
| 68 | var threaded: std.Io.Threaded = .init(allocator, .{}); | |
| 69 | defer threaded.deinit(); | |
| 70 | const io = threaded.io(); | |
| 71 | ||
| 72 | const json_path = try Io.Dir.path.join(allocator, &.{ args[1], "include/spirv/unified1/" }); | |
| 73 | const dir = try Io.Dir.cwd().openDir(io, json_path, .{ .iterate = true }); | |
| 68 | 74 | |
| 69 | const core_spec = try readRegistry(CoreRegistry, dir, "spirv.core.grammar.json"); | |
| 75 | const core_spec = try readRegistry(io, CoreRegistry, dir, "spirv.core.grammar.json"); | |
| 70 | 76 | std.mem.sortUnstable(Instruction, core_spec.instructions, CmpInst{}, CmpInst.lt); |
| 71 | 77 | |
| 72 | 78 | var exts = std.array_list.Managed(Extension).init(allocator); |
| 73 | 79 | |
| 74 | 80 | var it = dir.iterate(); |
| 75 | while (try it.next()) |entry| { | |
| 81 | while (try it.next(io)) |entry| { | |
| 76 | 82 | if (entry.kind != .file) { |
| 77 | 83 | continue; |
| 78 | 84 | } |
| 79 | 85 | |
| 80 | try readExtRegistry(&exts, dir, entry.name); | |
| 86 | try readExtRegistry(io, &exts, dir, entry.name); | |
| 81 | 87 | } |
| 82 | 88 | |
| 83 | try readExtRegistry(&exts, std.fs.cwd(), args[2]); | |
| 89 | try readExtRegistry(io, &exts, Io.Dir.cwd(), args[2]); | |
| 84 | 90 | |
| 85 | 91 | var allocating: std.Io.Writer.Allocating = .init(allocator); |
| 86 | 92 | defer allocating.deinit(); |
| ... | ... | @@ -91,7 +97,7 @@ pub fn main() !void { |
| 91 | 97 | var tree = try std.zig.Ast.parse(allocator, output, .zig); |
| 92 | 98 | |
| 93 | 99 | if (tree.errors.len != 0) { |
| 94 | try std.zig.printAstErrorsToStderr(allocator, tree, "", .auto); | |
| 100 | try std.zig.printAstErrorsToStderr(allocator, io, tree, "", .auto); | |
| 95 | 101 | return; |
| 96 | 102 | } |
| 97 | 103 | |
| ... | ... | @@ -103,22 +109,22 @@ pub fn main() !void { |
| 103 | 109 | try wip_errors.addZirErrorMessages(zir, tree, output, ""); |
| 104 | 110 | var error_bundle = try wip_errors.toOwnedBundle(""); |
| 105 | 111 | defer error_bundle.deinit(allocator); |
| 106 | error_bundle.renderToStdErr(.{}, .auto); | |
| 112 | try error_bundle.renderToStderr(io, .{}, .auto); | |
| 107 | 113 | } |
| 108 | 114 | |
| 109 | 115 | const formatted_output = try tree.renderAlloc(allocator); |
| 110 | _ = try std.fs.File.stdout().write(formatted_output); | |
| 116 | try Io.File.stdout().writeStreamingAll(io, formatted_output); | |
| 111 | 117 | } |
| 112 | 118 | |
| 113 | fn readExtRegistry(exts: *std.array_list.Managed(Extension), dir: std.fs.Dir, sub_path: []const u8) !void { | |
| 114 | const filename = std.fs.path.basename(sub_path); | |
| 119 | fn readExtRegistry(io: Io, exts: *std.array_list.Managed(Extension), dir: Io.Dir, sub_path: []const u8) !void { | |
| 120 | const filename = Io.Dir.path.basename(sub_path); | |
| 115 | 121 | if (!std.mem.startsWith(u8, filename, "extinst.")) { |
| 116 | 122 | return; |
| 117 | 123 | } |
| 118 | 124 | |
| 119 | 125 | std.debug.assert(std.mem.endsWith(u8, filename, ".grammar.json")); |
| 120 | 126 | const name = filename["extinst.".len .. filename.len - ".grammar.json".len]; |
| 121 | const spec = try readRegistry(ExtensionRegistry, dir, sub_path); | |
| 127 | const spec = try readRegistry(io, ExtensionRegistry, dir, sub_path); | |
| 122 | 128 | |
| 123 | 129 | const set_name = set_names.get(name) orelse { |
| 124 | 130 | std.log.info("ignored instruction set '{s}'", .{name}); |
| ... | ... | @@ -134,8 +140,8 @@ fn readExtRegistry(exts: *std.array_list.Managed(Extension), dir: std.fs.Dir, su |
| 134 | 140 | }); |
| 135 | 141 | } |
| 136 | 142 | |
| 137 | fn readRegistry(comptime RegistryType: type, dir: std.fs.Dir, path: []const u8) !RegistryType { | |
| 138 | const spec = try dir.readFileAlloc(path, allocator, .unlimited); | |
| 143 | fn readRegistry(io: Io, comptime RegistryType: type, dir: Io.Dir, path: []const u8) !RegistryType { | |
| 144 | const spec = try dir.readFileAlloc(io, path, allocator, .unlimited); | |
| 139 | 145 | // Required for json parsing. |
| 140 | 146 | // TODO: ALI |
| 141 | 147 | @setEvalBranchQuota(10000); |
tools/gen_stubs.zig+12-5| ... | ... | @@ -55,12 +55,14 @@ |
| 55 | 55 | // - e.g. find a common previous symbol and put it after that one |
| 56 | 56 | // - they definitely need to go into the correct section |
| 57 | 57 | |
| 58 | const builtin = @import("builtin"); | |
| 59 | const native_endian = builtin.cpu.arch.endian(); | |
| 60 | ||
| 58 | 61 | const std = @import("std"); |
| 59 | const builtin = std.builtin; | |
| 62 | const Io = std.Io; | |
| 60 | 63 | const mem = std.mem; |
| 61 | 64 | const log = std.log; |
| 62 | 65 | const elf = std.elf; |
| 63 | const native_endian = @import("builtin").cpu.arch.endian(); | |
| 64 | 66 | |
| 65 | 67 | const Arch = enum { |
| 66 | 68 | aarch64, |
| ... | ... | @@ -284,10 +286,14 @@ pub fn main() !void { |
| 284 | 286 | defer arena_instance.deinit(); |
| 285 | 287 | const arena = arena_instance.allocator(); |
| 286 | 288 | |
| 289 | var threaded: std.Io.Threaded = .init(arena, .{}); | |
| 290 | defer threaded.deinit(); | |
| 291 | const io = threaded.io(); | |
| 292 | ||
| 287 | 293 | const args = try std.process.argsAlloc(arena); |
| 288 | 294 | const build_all_path = args[1]; |
| 289 | 295 | |
| 290 | var build_all_dir = try std.fs.cwd().openDir(build_all_path, .{}); | |
| 296 | var build_all_dir = try Io.Dir.cwd().openDir(io, build_all_path, .{}); | |
| 291 | 297 | |
| 292 | 298 | var sym_table = std.StringArrayHashMap(MultiSym).init(arena); |
| 293 | 299 | var sections = std.StringArrayHashMap(void).init(arena); |
| ... | ... | @@ -299,6 +305,7 @@ pub fn main() !void { |
| 299 | 305 | |
| 300 | 306 | // Read the ELF header. |
| 301 | 307 | const elf_bytes = build_all_dir.readFileAllocOptions( |
| 308 | io, | |
| 302 | 309 | libc_so_path, |
| 303 | 310 | arena, |
| 304 | 311 | .limited(100 * 1024 * 1024), |
| ... | ... | @@ -334,7 +341,7 @@ pub fn main() !void { |
| 334 | 341 | } |
| 335 | 342 | |
| 336 | 343 | var stdout_buffer: [2000]u8 = undefined; |
| 337 | var stdout_writer = std.fs.File.stdout().writerStreaming(&stdout_buffer); | |
| 344 | var stdout_writer = Io.File.stdout().writerStreaming(io, &stdout_buffer); | |
| 338 | 345 | const stdout = &stdout_writer.interface; |
| 339 | 346 | try stdout.writeAll( |
| 340 | 347 | \\#ifdef PTR64 |
| ... | ... | @@ -539,7 +546,7 @@ pub fn main() !void { |
| 539 | 546 | try stdout.flush(); |
| 540 | 547 | } |
| 541 | 548 | |
| 542 | fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian) !void { | |
| 549 | fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: std.builtin.Endian) !void { | |
| 543 | 550 | const arena = parse.arena; |
| 544 | 551 | const elf_bytes = parse.elf_bytes; |
| 545 | 552 | const header = parse.header; |
tools/generate_JSONTestSuite.zig+9-4| ... | ... | @@ -1,13 +1,18 @@ |
| 1 | 1 | // zig run this file inside the test_parsing/ directory of this repo: https://github.com/nst/JSONTestSuite |
| 2 | 2 | |
| 3 | 3 | const std = @import("std"); |
| 4 | const Io = std.Io; | |
| 4 | 5 | |
| 5 | 6 | pub fn main() !void { |
| 6 | 7 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 7 | 8 | var allocator = gpa.allocator(); |
| 8 | 9 | |
| 10 | var threaded: std.Io.Threaded = .init(allocator, .{}); | |
| 11 | defer threaded.deinit(); | |
| 12 | const io = threaded.io(); | |
| 13 | ||
| 9 | 14 | var stdout_buffer: [2000]u8 = undefined; |
| 10 | var stdout_writer = std.fs.File.stdout().writerStreaming(&stdout_buffer); | |
| 15 | var stdout_writer = Io.File.stdout().writerStreaming(io, &stdout_buffer); | |
| 11 | 16 | const output = &stdout_writer.interface; |
| 12 | 17 | try output.writeAll( |
| 13 | 18 | \\// This file was generated by _generate_JSONTestSuite.zig |
| ... | ... | @@ -20,9 +25,9 @@ pub fn main() !void { |
| 20 | 25 | ); |
| 21 | 26 | |
| 22 | 27 | var names = std.array_list.Managed([]const u8).init(allocator); |
| 23 | var cwd = try std.fs.cwd().openDir(".", .{ .iterate = true }); | |
| 28 | var cwd = try Io.Dir.cwd().openDir(io, ".", .{ .iterate = true }); | |
| 24 | 29 | var it = cwd.iterate(); |
| 25 | while (try it.next()) |entry| { | |
| 30 | while (try it.next(io)) |entry| { | |
| 26 | 31 | try names.append(try allocator.dupe(u8, entry.name)); |
| 27 | 32 | } |
| 28 | 33 | std.mem.sort([]const u8, names.items, {}, (struct { |
| ... | ... | @@ -32,7 +37,7 @@ pub fn main() !void { |
| 32 | 37 | }).lessThan); |
| 33 | 38 | |
| 34 | 39 | for (names.items) |name| { |
| 35 | const contents = try std.fs.cwd().readFileAlloc(name, allocator, .limited(250001)); | |
| 40 | const contents = try Io.Dir.cwd().readFileAlloc(io, name, allocator, .limited(250001)); | |
| 36 | 41 | try output.writeAll("test "); |
| 37 | 42 | try writeString(output, name); |
| 38 | 43 | try output.writeAll(" {\n try "); |
tools/generate_c_size_and_align_checks.zig+2-1| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | //! target. |
| 8 | 8 | |
| 9 | 9 | const std = @import("std"); |
| 10 | const Io = std.Io; | |
| 10 | 11 | |
| 11 | 12 | fn cName(ty: std.Target.CType) []const u8 { |
| 12 | 13 | return switch (ty) { |
| ... | ... | @@ -47,7 +48,7 @@ pub fn main() !void { |
| 47 | 48 | const target = try std.zig.system.resolveTargetQuery(io, query); |
| 48 | 49 | |
| 49 | 50 | var buffer: [2000]u8 = undefined; |
| 50 | var stdout_writer = std.fs.File.stdout().writerStreaming(&buffer); | |
| 51 | var stdout_writer = Io.File.stdout().writerStreaming(io, &buffer); | |
| 51 | 52 | const w = &stdout_writer.interface; |
| 52 | 53 | inline for (@typeInfo(std.Target.CType).@"enum".fields) |field| { |
| 53 | 54 | const c_type: std.Target.CType = @enumFromInt(field.value); |
tools/generate_linux_syscalls.zig+3-3| ... | ... | @@ -189,10 +189,10 @@ pub fn main() !void { |
| 189 | 189 | const linux_path = args[1]; |
| 190 | 190 | |
| 191 | 191 | var stdout_buffer: [2048]u8 = undefined; |
| 192 | var stdout_writer = std.fs.File.stdout().writerStreaming(&stdout_buffer); | |
| 192 | var stdout_writer = Io.File.stdout().writerStreaming(io, &stdout_buffer); | |
| 193 | 193 | const stdout = &stdout_writer.interface; |
| 194 | 194 | |
| 195 | var linux_dir = try std.fs.cwd().openDir(io, linux_path, .{}); | |
| 195 | var linux_dir = try Io.Dir.cwd().openDir(io, linux_path, .{}); | |
| 196 | 196 | defer linux_dir.close(io); |
| 197 | 197 | |
| 198 | 198 | // As of 6.11, the largest table is 24195 bytes. |
| ... | ... | @@ -225,7 +225,7 @@ pub fn main() !void { |
| 225 | 225 | , .{version}); |
| 226 | 226 | |
| 227 | 227 | for (architectures, 0..) |arch, i| { |
| 228 | const table = try linux_dir.readFile(switch (arch.table) { | |
| 228 | const table = try linux_dir.readFile(io, switch (arch.table) { | |
| 229 | 229 | .generic => "scripts/syscall.tbl", |
| 230 | 230 | .specific => |f| f, |
| 231 | 231 | }, buf); |
tools/migrate_langref.zig+7-7| ... | ... | @@ -26,15 +26,15 @@ pub fn main() !void { |
| 26 | 26 | defer threaded.deinit(); |
| 27 | 27 | const io = threaded.io(); |
| 28 | 28 | |
| 29 | var in_file = try Dir.cwd().openFile(input_file, .{ .mode = .read_only }); | |
| 29 | var in_file = try Dir.cwd().openFile(io, input_file, .{ .mode = .read_only }); | |
| 30 | 30 | defer in_file.close(io); |
| 31 | 31 | |
| 32 | var out_file = try Dir.cwd().createFile(output_file, .{}); | |
| 32 | var out_file = try Dir.cwd().createFile(io, output_file, .{}); | |
| 33 | 33 | defer out_file.close(io); |
| 34 | 34 | var out_file_buffer: [4096]u8 = undefined; |
| 35 | var out_file_writer = out_file.writer(&out_file_buffer); | |
| 35 | var out_file_writer = out_file.writer(io, &out_file_buffer); | |
| 36 | 36 | |
| 37 | var out_dir = try Dir.cwd().openDir(Dir.path.dirname(output_file).?, .{}); | |
| 37 | var out_dir = try Dir.cwd().openDir(io, Dir.path.dirname(output_file).?, .{}); | |
| 38 | 38 | defer out_dir.close(io); |
| 39 | 39 | |
| 40 | 40 | var in_file_reader = in_file.reader(io, &.{}); |
| ... | ... | @@ -42,7 +42,7 @@ pub fn main() !void { |
| 42 | 42 | |
| 43 | 43 | var tokenizer = Tokenizer.init(input_file, input_file_bytes); |
| 44 | 44 | |
| 45 | try walk(arena, &tokenizer, out_dir, &out_file_writer.interface); | |
| 45 | try walk(arena, io, &tokenizer, out_dir, &out_file_writer.interface); | |
| 46 | 46 | |
| 47 | 47 | try out_file_writer.end(); |
| 48 | 48 | } |
| ... | ... | @@ -387,12 +387,12 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp |
| 387 | 387 | |
| 388 | 388 | const basename = try std.fmt.allocPrint(arena, "{s}.zig", .{name}); |
| 389 | 389 | |
| 390 | var file = out_dir.createFile(basename, .{ .exclusive = true }) catch |err| { | |
| 390 | var file = out_dir.createFile(io, basename, .{ .exclusive = true }) catch |err| { | |
| 391 | 391 | fatal("unable to create file '{s}': {s}", .{ name, @errorName(err) }); |
| 392 | 392 | }; |
| 393 | 393 | defer file.close(io); |
| 394 | 394 | var file_buffer: [1024]u8 = undefined; |
| 395 | var file_writer = file.writer(&file_buffer); | |
| 395 | var file_writer = file.writer(io, &file_buffer); | |
| 396 | 396 | const code = &file_writer.interface; |
| 397 | 397 | |
| 398 | 398 | const source = tokenizer.buffer[source_token.start..source_token.end]; |
tools/process_headers.zig+4-6| ... | ... | @@ -131,7 +131,7 @@ pub fn main() !void { |
| 131 | 131 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 132 | 132 | const allocator = arena.allocator(); |
| 133 | 133 | |
| 134 | var threaded: Io.Threaded = .init(allocator); | |
| 134 | var threaded: Io.Threaded = .init(allocator, .{}); | |
| 135 | 135 | defer threaded.deinit(); |
| 136 | 136 | const io = threaded.io(); |
| 137 | 137 | |
| ... | ... | @@ -253,14 +253,14 @@ pub fn main() !void { |
| 253 | 253 | |
| 254 | 254 | var dir_it = dir.iterate(); |
| 255 | 255 | |
| 256 | while (try dir_it.next()) |entry| { | |
| 256 | while (try dir_it.next(io)) |entry| { | |
| 257 | 257 | const full_path = try Dir.path.join(allocator, &[_][]const u8{ full_dir_name, entry.name }); |
| 258 | 258 | switch (entry.kind) { |
| 259 | 259 | .directory => try dir_stack.append(full_path), |
| 260 | 260 | .file, .sym_link => { |
| 261 | 261 | const rel_path = try Dir.path.relative(allocator, target_include_dir, full_path); |
| 262 | 262 | const max_size = 2 * 1024 * 1024 * 1024; |
| 263 | const raw_bytes = try Dir.cwd().readFileAlloc(full_path, allocator, .limited(max_size)); | |
| 263 | const raw_bytes = try Dir.cwd().readFileAlloc(io, full_path, allocator, .limited(max_size)); | |
| 264 | 264 | const trimmed = std.mem.trim(u8, raw_bytes, " \r\n\t"); |
| 265 | 265 | total_bytes += raw_bytes.len; |
| 266 | 266 | const hash = try allocator.alloc(u8, 32); |
| ... | ... | @@ -273,9 +273,7 @@ pub fn main() !void { |
| 273 | 273 | max_bytes_saved += raw_bytes.len; |
| 274 | 274 | gop.value_ptr.hit_count += 1; |
| 275 | 275 | std.debug.print("duplicate: {s} {s} ({B})\n", .{ |
| 276 | libc_dir, | |
| 277 | rel_path, | |
| 278 | raw_bytes.len, | |
| 276 | libc_dir, rel_path, raw_bytes.len, | |
| 279 | 277 | }); |
| 280 | 278 | } else { |
| 281 | 279 | gop.value_ptr.* = Contents{ |
tools/update-linux-headers.zig+1-1| ... | ... | @@ -206,7 +206,7 @@ pub fn main() !void { |
| 206 | 206 | |
| 207 | 207 | var dir_it = dir.iterate(); |
| 208 | 208 | |
| 209 | while (try dir_it.next()) |entry| { | |
| 209 | while (try dir_it.next(io)) |entry| { | |
| 210 | 210 | const full_path = try Dir.path.join(arena, &[_][]const u8{ full_dir_name, entry.name }); |
| 211 | 211 | switch (entry.kind) { |
| 212 | 212 | .directory => try dir_stack.append(full_path), |
tools/update_clang_options.zig+7-4| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | //! would mean that the next parameter specifies the target. |
| 11 | 11 | |
| 12 | 12 | const std = @import("std"); |
| 13 | const fs = std.fs; | |
| 13 | const Io = std.Io; | |
| 14 | 14 | const assert = std.debug.assert; |
| 15 | 15 | const json = std.json; |
| 16 | 16 | |
| ... | ... | @@ -634,8 +634,12 @@ pub fn main() anyerror!void { |
| 634 | 634 | const allocator = arena.allocator(); |
| 635 | 635 | const args = try std.process.argsAlloc(allocator); |
| 636 | 636 | |
| 637 | var threaded: std.Io.Threaded = .init(allocator, .{}); | |
| 638 | defer threaded.deinit(); | |
| 639 | const io = threaded.io(); | |
| 640 | ||
| 637 | 641 | var stdout_buffer: [4000]u8 = undefined; |
| 638 | var stdout_writer = fs.File.stdout().writerStreaming(&stdout_buffer); | |
| 642 | var stdout_writer = Io.File.stdout().writerStreaming(io, &stdout_buffer); | |
| 639 | 643 | const stdout = &stdout_writer.interface; |
| 640 | 644 | |
| 641 | 645 | if (args.len <= 1) printUsageAndExit(args[0]); |
| ... | ... | @@ -676,8 +680,7 @@ pub fn main() anyerror!void { |
| 676 | 680 | try std.fmt.allocPrint(allocator, "-I={s}/clang/include/clang/Driver", .{llvm_src_root}), |
| 677 | 681 | }; |
| 678 | 682 | |
| 679 | const child_result = try std.process.Child.run(.{ | |
| 680 | .allocator = allocator, | |
| 683 | const child_result = try std.process.Child.run(allocator, io, .{ | |
| 681 | 684 | .argv = &child_args, |
| 682 | 685 | .max_output_bytes = 100 * 1024 * 1024, |
| 683 | 686 | }); |
tools/update_cpu_features.zig+2-3| ... | ... | @@ -1994,8 +1994,7 @@ fn processOneTarget(io: Io, job: Job) void { |
| 1994 | 1994 | }), |
| 1995 | 1995 | }; |
| 1996 | 1996 | |
| 1997 | const child_result = try std.process.Child.run(.{ | |
| 1998 | .allocator = arena, | |
| 1997 | const child_result = try std.process.Child.run(arena, io, .{ | |
| 1999 | 1998 | .argv = &child_args, |
| 2000 | 1999 | .max_output_bytes = 500 * 1024 * 1024, |
| 2001 | 2000 | }); |
| ... | ... | @@ -2250,7 +2249,7 @@ fn processOneTarget(io: Io, job: Job) void { |
| 2250 | 2249 | defer zig_code_file.close(io); |
| 2251 | 2250 | |
| 2252 | 2251 | var zig_code_file_buffer: [4096]u8 = undefined; |
| 2253 | var zig_code_file_writer = zig_code_file.writer(&zig_code_file_buffer); | |
| 2252 | var zig_code_file_writer = zig_code_file.writer(io, &zig_code_file_buffer); | |
| 2254 | 2253 | const w = &zig_code_file_writer.interface; |
| 2255 | 2254 | |
| 2256 | 2255 | try w.writeAll( |
tools/update_crc_catalog.zig+2-2| ... | ... | @@ -35,7 +35,7 @@ pub fn main() anyerror!void { |
| 35 | 35 | var zig_code_file = try hash_target_dir.createFile(io, "crc.zig", .{}); |
| 36 | 36 | defer zig_code_file.close(io); |
| 37 | 37 | var zig_code_file_buffer: [4096]u8 = undefined; |
| 38 | var zig_code_file_writer = zig_code_file.writer(&zig_code_file_buffer); | |
| 38 | var zig_code_file_writer = zig_code_file.writer(io, &zig_code_file_buffer); | |
| 39 | 39 | const code_writer = &zig_code_file_writer.interface; |
| 40 | 40 | |
| 41 | 41 | try code_writer.writeAll( |
| ... | ... | @@ -59,7 +59,7 @@ pub fn main() anyerror!void { |
| 59 | 59 | var zig_test_file = try crc_target_dir.createFile(io, "test.zig", .{}); |
| 60 | 60 | defer zig_test_file.close(io); |
| 61 | 61 | var zig_test_file_buffer: [4096]u8 = undefined; |
| 62 | var zig_test_file_writer = zig_test_file.writer(&zig_test_file_buffer); | |
| 62 | var zig_test_file_writer = zig_test_file.writer(io, &zig_test_file_buffer); | |
| 63 | 63 | const test_writer = &zig_test_file_writer.interface; |
| 64 | 64 | |
| 65 | 65 | try test_writer.writeAll( |
tools/update_freebsd_libc.zig+7-10| ... | ... | @@ -27,13 +27,13 @@ pub fn main() !void { |
| 27 | 27 | |
| 28 | 28 | const dest_dir_path = try std.fmt.allocPrint(arena, "{s}/lib/libc/freebsd", .{zig_src_path}); |
| 29 | 29 | |
| 30 | var dest_dir = std.fs.cwd().openDir(io, dest_dir_path, .{ .iterate = true }) catch |err| { | |
| 30 | var dest_dir = Io.Dir.cwd().openDir(io, dest_dir_path, .{ .iterate = true }) catch |err| { | |
| 31 | 31 | std.log.err("unable to open destination directory '{s}': {t}", .{ dest_dir_path, err }); |
| 32 | 32 | std.process.exit(1); |
| 33 | 33 | }; |
| 34 | 34 | defer dest_dir.close(io); |
| 35 | 35 | |
| 36 | var freebsd_src_dir = try std.fs.cwd().openDir(freebsd_src_path, .{}); | |
| 36 | var freebsd_src_dir = try Io.Dir.cwd().openDir(io, freebsd_src_path, .{}); | |
| 37 | 37 | defer freebsd_src_dir.close(io); |
| 38 | 38 | |
| 39 | 39 | // Copy updated files from upstream. |
| ... | ... | @@ -41,7 +41,7 @@ pub fn main() !void { |
| 41 | 41 | var walker = try dest_dir.walk(arena); |
| 42 | 42 | defer walker.deinit(); |
| 43 | 43 | |
| 44 | walk: while (try walker.next()) |entry| { | |
| 44 | walk: while (try walker.next(io)) |entry| { | |
| 45 | 45 | if (entry.kind != .file) continue; |
| 46 | 46 | if (std.mem.startsWith(u8, entry.basename, ".")) continue; |
| 47 | 47 | for (exempt_files) |p| { |
| ... | ... | @@ -49,15 +49,12 @@ pub fn main() !void { |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | std.log.info("updating '{s}/{s}' from '{s}/{s}'", .{ |
| 52 | dest_dir_path, entry.path, | |
| 53 | freebsd_src_path, entry.path, | |
| 52 | dest_dir_path, entry.path, freebsd_src_path, entry.path, | |
| 54 | 53 | }); |
| 55 | 54 | |
| 56 | freebsd_src_dir.copyFile(entry.path, dest_dir, entry.path, .{}) catch |err| { | |
| 57 | std.log.warn("unable to copy '{s}/{s}' to '{s}/{s}': {s}", .{ | |
| 58 | freebsd_src_path, entry.path, | |
| 59 | dest_dir_path, entry.path, | |
| 60 | @errorName(err), | |
| 55 | freebsd_src_dir.copyFile(entry.path, dest_dir, entry.path, io, .{}) catch |err| { | |
| 56 | std.log.warn("unable to copy '{s}/{s}' to '{s}/{s}': {t}", .{ | |
| 57 | freebsd_src_path, entry.path, dest_dir_path, entry.path, err, | |
| 61 | 58 | }); |
| 62 | 59 | if (err == error.FileNotFound) { |
| 63 | 60 | try dest_dir.deleteFile(io, entry.path); |
tools/update_glibc.zig+8-11| ... | ... | @@ -66,7 +66,7 @@ pub fn main() !void { |
| 66 | 66 | var walker = try dest_dir.walk(arena); |
| 67 | 67 | defer walker.deinit(); |
| 68 | 68 | |
| 69 | walk: while (try walker.next()) |entry| { | |
| 69 | walk: while (try walker.next(io)) |entry| { | |
| 70 | 70 | if (entry.kind != .file) continue; |
| 71 | 71 | if (mem.startsWith(u8, entry.basename, ".")) continue; |
| 72 | 72 | for (exempt_files) |p| { |
| ... | ... | @@ -76,7 +76,7 @@ pub fn main() !void { |
| 76 | 76 | if (mem.endsWith(u8, entry.path, ext)) continue :walk; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | glibc_src_dir.copyFile(entry.path, dest_dir, entry.path, .{}) catch |err| { | |
| 79 | glibc_src_dir.copyFile(entry.path, dest_dir, entry.path, io, .{}) catch |err| { | |
| 80 | 80 | log.warn("unable to copy '{s}/{s}' to '{s}/{s}': {t}", .{ |
| 81 | 81 | glibc_src_path, entry.path, dest_dir_path, entry.path, err, |
| 82 | 82 | }); |
| ... | ... | @@ -106,7 +106,7 @@ pub fn main() !void { |
| 106 | 106 | var walker = try include_dir.walk(arena); |
| 107 | 107 | defer walker.deinit(); |
| 108 | 108 | |
| 109 | walk: while (try walker.next()) |entry| { | |
| 109 | walk: while (try walker.next(io)) |entry| { | |
| 110 | 110 | if (entry.kind != .file) continue; |
| 111 | 111 | if (mem.startsWith(u8, entry.basename, ".")) continue; |
| 112 | 112 | for (exempt_files) |p| { |
| ... | ... | @@ -116,23 +116,21 @@ pub fn main() !void { |
| 116 | 116 | const max_file_size = 10 * 1024 * 1024; |
| 117 | 117 | |
| 118 | 118 | const generic_glibc_contents = generic_glibc_dir.readFileAlloc( |
| 119 | io, | |
| 119 | 120 | entry.path, |
| 120 | 121 | arena, |
| 121 | 122 | .limited(max_file_size), |
| 122 | 123 | ) catch |err| switch (err) { |
| 123 | 124 | error.FileNotFound => continue, |
| 124 | else => |e| fatal("unable to load '{s}/include/{s}': {s}", .{ | |
| 125 | generic_glibc_path, entry.path, @errorName(e), | |
| 126 | }), | |
| 125 | else => |e| fatal("unable to load '{s}/include/{s}': {t}", .{ generic_glibc_path, entry.path, e }), | |
| 127 | 126 | }; |
| 128 | 127 | const glibc_include_contents = include_dir.readFileAlloc( |
| 128 | io, | |
| 129 | 129 | entry.path, |
| 130 | 130 | arena, |
| 131 | 131 | .limited(max_file_size), |
| 132 | 132 | ) catch |err| { |
| 133 | fatal("unable to load '{s}/include/{s}': {s}", .{ | |
| 134 | dest_dir_path, entry.path, @errorName(err), | |
| 135 | }); | |
| 133 | fatal("unable to load '{s}/include/{s}': {t}", .{ dest_dir_path, entry.path, err }); | |
| 136 | 134 | }; |
| 137 | 135 | |
| 138 | 136 | const whitespace = " \r\n\t"; |
| ... | ... | @@ -140,8 +138,7 @@ pub fn main() !void { |
| 140 | 138 | const glibc_include_trimmed = mem.trim(u8, glibc_include_contents, whitespace); |
| 141 | 139 | if (mem.eql(u8, generic_glibc_trimmed, glibc_include_trimmed)) { |
| 142 | 140 | log.warn("same contents: '{s}/include/{s}' and '{s}/include/{s}'", .{ |
| 143 | generic_glibc_path, entry.path, | |
| 144 | dest_dir_path, entry.path, | |
| 141 | generic_glibc_path, entry.path, dest_dir_path, entry.path, | |
| 145 | 142 | }); |
| 146 | 143 | } |
| 147 | 144 | } |
tools/update_mingw.zig+12-12| ... | ... | @@ -26,13 +26,13 @@ pub fn main() !void { |
| 26 | 26 | // in zig's installation. |
| 27 | 27 | |
| 28 | 28 | var dest_crt_dir = Dir.cwd().openDir(io, dest_mingw_crt_path, .{ .iterate = true }) catch |err| { |
| 29 | std.log.err("unable to open directory '{s}': {s}", .{ dest_mingw_crt_path, @errorName(err) }); | |
| 29 | std.log.err("unable to open directory '{s}': {t}", .{ dest_mingw_crt_path, err }); | |
| 30 | 30 | std.process.exit(1); |
| 31 | 31 | }; |
| 32 | 32 | defer dest_crt_dir.close(io); |
| 33 | 33 | |
| 34 | 34 | var src_crt_dir = Dir.cwd().openDir(io, src_mingw_crt_path, .{ .iterate = true }) catch |err| { |
| 35 | std.log.err("unable to open directory '{s}': {s}", .{ src_mingw_crt_path, @errorName(err) }); | |
| 35 | std.log.err("unable to open directory '{s}': {t}", .{ src_mingw_crt_path, err }); | |
| 36 | 36 | std.process.exit(1); |
| 37 | 37 | }; |
| 38 | 38 | defer src_crt_dir.close(io); |
| ... | ... | @@ -43,10 +43,10 @@ pub fn main() !void { |
| 43 | 43 | |
| 44 | 44 | var fail = false; |
| 45 | 45 | |
| 46 | while (try walker.next()) |entry| { | |
| 46 | while (try walker.next(io)) |entry| { | |
| 47 | 47 | if (entry.kind != .file) continue; |
| 48 | 48 | |
| 49 | src_crt_dir.copyFile(entry.path, dest_crt_dir, entry.path, .{}) catch |err| switch (err) { | |
| 49 | src_crt_dir.copyFile(entry.path, dest_crt_dir, entry.path, io, .{}) catch |err| switch (err) { | |
| 50 | 50 | error.FileNotFound => { |
| 51 | 51 | const keep = for (kept_crt_files) |item| { |
| 52 | 52 | if (std.mem.eql(u8, entry.path, item)) break true; |
| ... | ... | @@ -94,10 +94,10 @@ pub fn main() !void { |
| 94 | 94 | |
| 95 | 95 | var fail = false; |
| 96 | 96 | |
| 97 | while (try walker.next()) |entry| { | |
| 97 | while (try walker.next(io)) |entry| { | |
| 98 | 98 | if (entry.kind != .file) continue; |
| 99 | 99 | |
| 100 | src_winpthreads_dir.copyFile(entry.path, dest_winpthreads_dir, entry.path, .{}) catch |err| switch (err) { | |
| 100 | src_winpthreads_dir.copyFile(entry.path, dest_winpthreads_dir, entry.path, io, .{}) catch |err| switch (err) { | |
| 101 | 101 | error.FileNotFound => { |
| 102 | 102 | std.log.warn("deleting {s}", .{entry.path}); |
| 103 | 103 | try dest_winpthreads_dir.deleteFile(io, entry.path); |
| ... | ... | @@ -120,17 +120,17 @@ pub fn main() !void { |
| 120 | 120 | |
| 121 | 121 | var fail = false; |
| 122 | 122 | |
| 123 | while (try walker.next()) |entry| { | |
| 123 | while (try walker.next(io)) |entry| { | |
| 124 | 124 | switch (entry.kind) { |
| 125 | 125 | .directory => { |
| 126 | 126 | switch (entry.depth()) { |
| 127 | 127 | 1 => if (def_dirs.has(entry.basename)) { |
| 128 | try walker.enter(entry); | |
| 128 | try walker.enter(io, entry); | |
| 129 | 129 | continue; |
| 130 | 130 | }, |
| 131 | 131 | else => { |
| 132 | 132 | // The top-level directory was already validated |
| 133 | try walker.enter(entry); | |
| 133 | try walker.enter(io, entry); | |
| 134 | 134 | continue; |
| 135 | 135 | }, |
| 136 | 136 | } |
| ... | ... | @@ -157,15 +157,15 @@ pub fn main() !void { |
| 157 | 157 | if (std.mem.endsWith(u8, entry.basename, "_onecore.def")) |
| 158 | 158 | continue; |
| 159 | 159 | |
| 160 | src_crt_dir.copyFile(entry.path, dest_crt_dir, entry.path, .{}) catch |err| { | |
| 161 | std.log.err("unable to copy {s}: {s}", .{ entry.path, @errorName(err) }); | |
| 160 | src_crt_dir.copyFile(entry.path, dest_crt_dir, entry.path, io, .{}) catch |err| { | |
| 161 | std.log.err("unable to copy {s}: {t}", .{ entry.path, err }); | |
| 162 | 162 | fail = true; |
| 163 | 163 | }; |
| 164 | 164 | } |
| 165 | 165 | if (fail) std.process.exit(1); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | return std.process.cleanExit(); | |
| 168 | return std.process.cleanExit(io); | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | const kept_crt_files = [_][]const u8{ |
tools/update_netbsd_libc.zig+4-4| ... | ... | @@ -27,13 +27,13 @@ pub fn main() !void { |
| 27 | 27 | |
| 28 | 28 | const dest_dir_path = try std.fmt.allocPrint(arena, "{s}/lib/libc/netbsd", .{zig_src_path}); |
| 29 | 29 | |
| 30 | var dest_dir = std.fs.cwd().openDir(io, dest_dir_path, .{ .iterate = true }) catch |err| { | |
| 30 | var dest_dir = Io.Dir.cwd().openDir(io, dest_dir_path, .{ .iterate = true }) catch |err| { | |
| 31 | 31 | std.log.err("unable to open destination directory '{s}': {t}", .{ dest_dir_path, err }); |
| 32 | 32 | std.process.exit(1); |
| 33 | 33 | }; |
| 34 | 34 | defer dest_dir.close(io); |
| 35 | 35 | |
| 36 | var netbsd_src_dir = try std.fs.cwd().openDir(io, netbsd_src_path, .{}); | |
| 36 | var netbsd_src_dir = try Io.Dir.cwd().openDir(io, netbsd_src_path, .{}); | |
| 37 | 37 | defer netbsd_src_dir.close(io); |
| 38 | 38 | |
| 39 | 39 | // Copy updated files from upstream. |
| ... | ... | @@ -41,7 +41,7 @@ pub fn main() !void { |
| 41 | 41 | var walker = try dest_dir.walk(arena); |
| 42 | 42 | defer walker.deinit(); |
| 43 | 43 | |
| 44 | walk: while (try walker.next()) |entry| { | |
| 44 | walk: while (try walker.next(io)) |entry| { | |
| 45 | 45 | if (entry.kind != .file) continue; |
| 46 | 46 | if (std.mem.startsWith(u8, entry.basename, ".")) continue; |
| 47 | 47 | for (exempt_files) |p| { |
| ... | ... | @@ -53,7 +53,7 @@ pub fn main() !void { |
| 53 | 53 | netbsd_src_path, entry.path, |
| 54 | 54 | }); |
| 55 | 55 | |
| 56 | netbsd_src_dir.copyFile(entry.path, dest_dir, entry.path, .{}) catch |err| { | |
| 56 | netbsd_src_dir.copyFile(entry.path, dest_dir, entry.path, io, .{}) catch |err| { | |
| 57 | 57 | std.log.warn("unable to copy '{s}/{s}' to '{s}/{s}': {t}", .{ |
| 58 | 58 | netbsd_src_path, entry.path, dest_dir_path, entry.path, err, |
| 59 | 59 | }); |