aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Io/Threaded.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-12-11 22:11:16 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-12-23 22:15:09 -0800
commit68621afd2e203d82b6f53bf4ede951827fa98db8 (patch)
tree60899decd0062ce7786592e49ca77ab6f80d22fd /lib/std/Io/Threaded.zig
parent0e230993d51d0ecded40d5235ada4f2f64036b26 (diff)
downloadzig-68621afd2e203d82b6f53bf4ede951827fa98db8.tar.gz
zig-68621afd2e203d82b6f53bf4ede951827fa98db8.zip
std.tar: update fs API calls to take io argument
Diffstat (limited to 'lib/std/Io/Threaded.zig')
-rw-r--r--lib/std/Io/Threaded.zig50
1 files changed, 25 insertions, 25 deletions
diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig
index 2fb0f3ad1f..d4c4da3990 100644
--- a/lib/std/Io/Threaded.zig
+++ b/lib/std/Io/Threaded.zig
@@ -708,7 +708,7 @@ pub fn io(t: *Threaded) Io {
.dirMakePath = dirMakePath,
.dirMakeOpenPath = dirMakeOpenPath,
.dirStat = dirStat,
- .dirStatPath = dirStatPath,
+ .dirStatFile = dirStatFile,
.dirAccess = dirAccess,
.dirCreateFile = dirCreateFile,
.dirOpenFile = dirOpenFile,
@@ -840,7 +840,7 @@ pub fn ioBasic(t: *Threaded) Io {
.dirMakePath = dirMakePath,
.dirMakeOpenPath = dirMakeOpenPath,
.dirStat = dirStat,
- .dirStatPath = dirStatPath,
+ .dirStatFile = dirStatFile,
.dirAccess = dirAccess,
.dirCreateFile = dirCreateFile,
.dirOpenFile = dirOpenFile,
@@ -1623,7 +1623,7 @@ fn dirMakePath(
// could cause an infinite loop
check_dir: {
// workaround for windows, see https://github.com/ziglang/zig/issues/16738
- const fstat = dirStatPath(t, dir, component.path, .{}) catch |stat_err| switch (stat_err) {
+ const fstat = dirStatFile(t, dir, component.path, .{}) catch |stat_err| switch (stat_err) {
error.IsDir => break :check_dir,
else => |e| return e,
};
@@ -1752,7 +1752,7 @@ fn dirMakeOpenPathWindows(
// could cause an infinite loop
check_dir: {
// workaround for windows, see https://github.com/ziglang/zig/issues/16738
- const fstat = dirStatPathWindows(t, dir, component.path, .{
+ const fstat = dirStatFileWindows(t, dir, component.path, .{
.follow_symlinks = options.follow_symlinks,
}) catch |stat_err| switch (stat_err) {
error.IsDir => break :check_dir,
@@ -1806,19 +1806,19 @@ fn dirStat(userdata: ?*anyopaque, dir: Dir) Dir.StatError!Dir.Stat {
return fileStat(t, file);
}
-const dirStatPath = switch (native_os) {
- .linux => dirStatPathLinux,
- .windows => dirStatPathWindows,
- .wasi => dirStatPathWasi,
- else => dirStatPathPosix,
+const dirStatFile = switch (native_os) {
+ .linux => dirStatFileLinux,
+ .windows => dirStatFileWindows,
+ .wasi => dirStatFileWasi,
+ else => dirStatFilePosix,
};
-fn dirStatPathLinux(
+fn dirStatFileLinux(
userdata: ?*anyopaque,
dir: Dir,
sub_path: []const u8,
- options: Dir.StatPathOptions,
-) Dir.StatPathError!File.Stat {
+ options: Dir.StatFileOptions,
+) Dir.StatFileError!File.Stat {
const t: *Threaded = @ptrCast(@alignCast(userdata));
const current_thread = Thread.getCurrent(t);
const linux = std.os.linux;
@@ -1875,12 +1875,12 @@ fn dirStatPathLinux(
}
}
-fn dirStatPathPosix(
+fn dirStatFilePosix(
userdata: ?*anyopaque,
dir: Dir,
sub_path: []const u8,
- options: Dir.StatPathOptions,
-) Dir.StatPathError!File.Stat {
+ options: Dir.StatFileOptions,
+) Dir.StatFileError!File.Stat {
const t: *Threaded = @ptrCast(@alignCast(userdata));
const current_thread = Thread.getCurrent(t);
@@ -1889,10 +1889,10 @@ fn dirStatPathPosix(
const flags: u32 = if (!options.follow_symlinks) posix.AT.SYMLINK_NOFOLLOW else 0;
- return posixStatPath(current_thread, dir.handle, sub_path_posix, flags);
+ return posixStatFile(current_thread, dir.handle, sub_path_posix, flags);
}
-fn posixStatPath(current_thread: *Thread, dir_fd: posix.fd_t, sub_path: [:0]const u8, flags: u32) Dir.StatPathError!File.Stat {
+fn posixStatFile(current_thread: *Thread, dir_fd: posix.fd_t, sub_path: [:0]const u8, flags: u32) Dir.StatFileError!File.Stat {
try current_thread.beginSyscall();
while (true) {
var stat = std.mem.zeroes(posix.Stat);
@@ -1927,12 +1927,12 @@ fn posixStatPath(current_thread: *Thread, dir_fd: posix.fd_t, sub_path: [:0]cons
}
}
-fn dirStatPathWindows(
+fn dirStatFileWindows(
userdata: ?*anyopaque,
dir: Dir,
sub_path: []const u8,
- options: Dir.StatPathOptions,
-) Dir.StatPathError!File.Stat {
+ options: Dir.StatFileOptions,
+) Dir.StatFileError!File.Stat {
const t: *Threaded = @ptrCast(@alignCast(userdata));
const file = try dirOpenFileWindows(t, dir, sub_path, .{
.follow_symlinks = options.follow_symlinks,
@@ -1941,13 +1941,13 @@ fn dirStatPathWindows(
return fileStatWindows(t, file);
}
-fn dirStatPathWasi(
+fn dirStatFileWasi(
userdata: ?*anyopaque,
dir: Dir,
sub_path: []const u8,
- options: Dir.StatPathOptions,
-) Dir.StatPathError!File.Stat {
- if (builtin.link_libc) return dirStatPathPosix(userdata, dir, sub_path, options);
+ options: Dir.StatFileOptions,
+) Dir.StatFileError!File.Stat {
+ if (builtin.link_libc) return dirStatFilePosix(userdata, dir, sub_path, options);
const t: *Threaded = @ptrCast(@alignCast(userdata));
const current_thread = Thread.getCurrent(t);
const wasi = std.os.wasi;
@@ -3629,7 +3629,7 @@ fn dirReadIllumos(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) D
if (std.mem.eql(u8, name, ".") or std.mem.eql(u8, name, "..")) continue;
// illumos dirent doesn't expose type, so we have to call stat to get it.
- const stat = try posixStatPath(current_thread, dr.dir.handle, name, posix.AT.SYMLINK_NOFOLLOW);
+ const stat = try posixStatFile(current_thread, dr.dir.handle, name, posix.AT.SYMLINK_NOFOLLOW);
buffer[buffer_index] = .{
.name = name,