authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-18 19:57:01-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-23 22:15:10-08:00
log9bbb8e0d8e8ce413ad2a9125b1eb9ddbf32b6c87
tree6a42782bc073303feb1157c705fb129fb1972b24
parentf078c7138f0dfbab95d8963e6c067515c6a54460

std.posix: make nlink_t on unsupported systems u0

instead of void

4 files changed, 12 insertions(+), 16 deletions(-)

lib/std/Io/Threaded.zig+2-2
......@@ -2168,7 +2168,7 @@ fn fileStatWindows(userdata: ?*anyopaque, file: File) File.StatError!File.Stat {
21682168 .atime = windows.fromSysTime(info.BasicInformation.LastAccessTime),
21692169 .mtime = windows.fromSysTime(info.BasicInformation.LastWriteTime),
21702170 .ctime = windows.fromSysTime(info.BasicInformation.ChangeTime),
2171 .nlink = {},
2171 .nlink = 0,
21722172 };
21732173}
21742174
......@@ -3763,7 +3763,7 @@ fn dirReadWindows(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) D
37633763 null,
37643764 &io_status_block,
37653765 unreserved_buffer.ptr,
3766 std.math.cast(w.ULONG, unreserved_buffer.len) orelse std.math.maxInt(w.ULONG),
3766 std.math.lossyCast(w.ULONG, unreserved_buffer.len),
37673767 .BothDirectory,
37683768 w.FALSE,
37693769 null,
lib/std/Io/Writer.zig+3-3
......@@ -2842,7 +2842,7 @@ test "discarding sendFile" {
28422842 try file_writer.interface.writeByte('h');
28432843 try file_writer.interface.flush();
28442844
2845 var file_reader = file_writer.moveToReader(io);
2845 var file_reader = file_writer.moveToReader();
28462846 try file_reader.seekTo(0);
28472847
28482848 var w_buffer: [256]u8 = undefined;
......@@ -2864,7 +2864,7 @@ test "allocating sendFile" {
28642864 try file_writer.interface.writeAll("abcd");
28652865 try file_writer.interface.flush();
28662866
2867 var file_reader = file_writer.moveToReader(io);
2867 var file_reader = file_writer.moveToReader();
28682868 try file_reader.seekTo(0);
28692869 try file_reader.interface.fill(2);
28702870
......@@ -2888,7 +2888,7 @@ test sendFileReading {
28882888 try file_writer.interface.writeAll("abcd");
28892889 try file_writer.interface.flush();
28902890
2891 var file_reader = file_writer.moveToReader(io);
2891 var file_reader = file_writer.moveToReader();
28922892 try file_reader.seekTo(0);
28932893 try file_reader.interface.fill(2);
28942894
lib/std/fs/test.zig+6-11
......@@ -24,7 +24,7 @@ const PathType = enum {
2424 absolute,
2525 unc,
2626
27 pub fn isSupported(self: PathType, target_os: std.Target.Os) bool {
27 fn isSupported(self: PathType, target_os: std.Target.Os) bool {
2828 return switch (self) {
2929 .relative => true,
3030 .absolute => target_os.tag == .windows, // TODO: implement getPathForHandle for other targets
......@@ -32,10 +32,10 @@ const PathType = enum {
3232 };
3333 }
3434
35 pub const TransformError = Dir.RealPathError || error{OutOfMemory};
36 pub const TransformFn = fn (allocator: mem.Allocator, dir: Dir, relative_path: [:0]const u8) TransformError![:0]const u8;
35 const TransformError = Dir.RealPathError || error{OutOfMemory};
36 const TransformFn = fn (allocator: mem.Allocator, dir: Dir, relative_path: [:0]const u8) TransformError![:0]const u8;
3737
38 pub fn getTransformFn(comptime path_type: PathType) TransformFn {
38 fn getTransformFn(comptime path_type: PathType) TransformFn {
3939 switch (path_type) {
4040 .relative => return struct {
4141 fn transform(allocator: mem.Allocator, dir: Dir, relative_path: [:0]const u8) TransformError![:0]const u8 {
......@@ -1623,7 +1623,7 @@ test "copyFile" {
16231623 try ctx.dir.copyFile(src_file, ctx.dir, dest_file, io, .{});
16241624 defer ctx.dir.deleteFile(io, dest_file) catch {};
16251625
1626 try ctx.dir.copyFile(src_file, ctx.dir, dest_file2, io, .{ .permissions = .default_file });
1626 try ctx.dir.copyFile(src_file, ctx.dir, dest_file2, io, .{});
16271627 defer ctx.dir.deleteFile(io, dest_file2) catch {};
16281628
16291629 try expectFileContents(io, ctx.dir, dest_file, data);
......@@ -1740,12 +1740,7 @@ test "open file with exclusive lock twice, make sure second lock waits" {
17401740 var started: std.Thread.ResetEvent = .unset;
17411741 var locked: std.Thread.ResetEvent = .unset;
17421742
1743 const t = try std.Thread.spawn(.{}, S.checkFn, .{
1744 ctx,
1745 filename,
1746 &started,
1747 &locked,
1748 });
1743 const t = try std.Thread.spawn(.{}, S.checkFn, .{ ctx, filename, &started, &locked });
17491744 defer t.join();
17501745
17511746 // Wait for the spawned thread to start trying to acquire the exclusive file lock.
lib/std/posix.zig+1
......@@ -54,6 +54,7 @@ else switch (native_os) {
5454 pub const uid_t = void;
5555 pub const gid_t = void;
5656 pub const mode_t = u0;
57 pub const nlink_t = u0;
5758 pub const ino_t = void;
5859 pub const IFNAMESIZE = {};
5960 pub const SIG = void;