commit 9bbb8e0d8e8ce413ad2a9125b1eb9ddbf32b6c87 (tree)
parent f078c7138f0dfbab95d8963e6c067515c6a54460
Author: Andrew Kelley <andrew@ziglang.org>
Date: Thu, 18 Dec 2025 19:57:01 -0800
std.posix: make nlink_t on unsupported systems u0
instead of void
Diffstat:
4 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig
@@ -2168,7 +2168,7 @@ fn fileStatWindows(userdata: ?*anyopaque, file: File) File.StatError!File.Stat {
.atime = windows.fromSysTime(info.BasicInformation.LastAccessTime),
.mtime = windows.fromSysTime(info.BasicInformation.LastWriteTime),
.ctime = windows.fromSysTime(info.BasicInformation.ChangeTime),
- .nlink = {},
+ .nlink = 0,
};
}
@@ -3763,7 +3763,7 @@ fn dirReadWindows(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) D
null,
&io_status_block,
unreserved_buffer.ptr,
- std.math.cast(w.ULONG, unreserved_buffer.len) orelse std.math.maxInt(w.ULONG),
+ std.math.lossyCast(w.ULONG, unreserved_buffer.len),
.BothDirectory,
w.FALSE,
null,
diff --git a/lib/std/Io/Writer.zig b/lib/std/Io/Writer.zig
@@ -2842,7 +2842,7 @@ test "discarding sendFile" {
try file_writer.interface.writeByte('h');
try file_writer.interface.flush();
- var file_reader = file_writer.moveToReader(io);
+ var file_reader = file_writer.moveToReader();
try file_reader.seekTo(0);
var w_buffer: [256]u8 = undefined;
@@ -2864,7 +2864,7 @@ test "allocating sendFile" {
try file_writer.interface.writeAll("abcd");
try file_writer.interface.flush();
- var file_reader = file_writer.moveToReader(io);
+ var file_reader = file_writer.moveToReader();
try file_reader.seekTo(0);
try file_reader.interface.fill(2);
@@ -2888,7 +2888,7 @@ test sendFileReading {
try file_writer.interface.writeAll("abcd");
try file_writer.interface.flush();
- var file_reader = file_writer.moveToReader(io);
+ var file_reader = file_writer.moveToReader();
try file_reader.seekTo(0);
try file_reader.interface.fill(2);
diff --git a/lib/std/fs/test.zig b/lib/std/fs/test.zig
@@ -24,7 +24,7 @@ const PathType = enum {
absolute,
unc,
- pub fn isSupported(self: PathType, target_os: std.Target.Os) bool {
+ fn isSupported(self: PathType, target_os: std.Target.Os) bool {
return switch (self) {
.relative => true,
.absolute => target_os.tag == .windows, // TODO: implement getPathForHandle for other targets
@@ -32,10 +32,10 @@ const PathType = enum {
};
}
- pub const TransformError = Dir.RealPathError || error{OutOfMemory};
- pub const TransformFn = fn (allocator: mem.Allocator, dir: Dir, relative_path: [:0]const u8) TransformError![:0]const u8;
+ const TransformError = Dir.RealPathError || error{OutOfMemory};
+ const TransformFn = fn (allocator: mem.Allocator, dir: Dir, relative_path: [:0]const u8) TransformError![:0]const u8;
- pub fn getTransformFn(comptime path_type: PathType) TransformFn {
+ fn getTransformFn(comptime path_type: PathType) TransformFn {
switch (path_type) {
.relative => return struct {
fn transform(allocator: mem.Allocator, dir: Dir, relative_path: [:0]const u8) TransformError![:0]const u8 {
@@ -1623,7 +1623,7 @@ test "copyFile" {
try ctx.dir.copyFile(src_file, ctx.dir, dest_file, io, .{});
defer ctx.dir.deleteFile(io, dest_file) catch {};
- try ctx.dir.copyFile(src_file, ctx.dir, dest_file2, io, .{ .permissions = .default_file });
+ try ctx.dir.copyFile(src_file, ctx.dir, dest_file2, io, .{});
defer ctx.dir.deleteFile(io, dest_file2) catch {};
try expectFileContents(io, ctx.dir, dest_file, data);
@@ -1740,12 +1740,7 @@ test "open file with exclusive lock twice, make sure second lock waits" {
var started: std.Thread.ResetEvent = .unset;
var locked: std.Thread.ResetEvent = .unset;
- const t = try std.Thread.spawn(.{}, S.checkFn, .{
- ctx,
- filename,
- &started,
- &locked,
- });
+ const t = try std.Thread.spawn(.{}, S.checkFn, .{ ctx, filename, &started, &locked });
defer t.join();
// Wait for the spawned thread to start trying to acquire the exclusive file lock.
diff --git a/lib/std/posix.zig b/lib/std/posix.zig
@@ -54,6 +54,7 @@ else switch (native_os) {
pub const uid_t = void;
pub const gid_t = void;
pub const mode_t = u0;
+ pub const nlink_t = u0;
pub const ino_t = void;
pub const IFNAMESIZE = {};
pub const SIG = void;