mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 02:44:43 +01:00
std.posix: make nlink_t on unsupported systems u0
instead of void
This commit is contained in:
parent
f078c7138f
commit
9bbb8e0d8e
4 changed files with 12 additions and 16 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue