zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit be0a4dc299c71dd916817ab6c181b8a441f22ddd (tree)
parent 829afe98d16d72a9a3af3ae30622ce6576c8b27f
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed,  7 Jan 2026 14:50:25 -0800

goodbye posix.fstatat

see #6600

Diffstat:
Mlib/std/posix.zig | 48------------------------------------------------
1 file changed, 0 insertions(+), 48 deletions(-)

diff --git a/lib/std/posix.zig b/lib/std/posix.zig @@ -792,54 +792,6 @@ pub fn fstat(fd: fd_t) FStatError!Stat { } } -pub const FStatAtError = FStatError || error{ - NameTooLong, - FileNotFound, - SymLinkLoop, - BadPathName, -}; - -/// Similar to `fstat`, but returns stat of a resource pointed to by `pathname` -/// which is relative to `dirfd` handle. -/// On WASI, `pathname` should be encoded as valid UTF-8. -/// On other platforms, `pathname` is an opaque sequence of bytes with no particular encoding. -/// See also `fstatatZ`. -pub fn fstatat(dirfd: fd_t, pathname: []const u8, flags: u32) FStatAtError!Stat { - if (native_os == .wasi and !builtin.link_libc) { - @compileError("use std.Io instead"); - } else if (native_os == .windows) { - @compileError("fstatat is not yet implemented on Windows"); - } else { - const pathname_c = try toPosixPath(pathname); - return fstatatZ(dirfd, &pathname_c, flags); - } -} - -/// Same as `fstatat` but `pathname` is null-terminated. -/// See also `fstatat`. -pub fn fstatatZ(dirfd: fd_t, pathname: [*:0]const u8, flags: u32) FStatAtError!Stat { - if (native_os == .wasi and !builtin.link_libc) { - @compileError("use std.Io instead"); - } - - var stat = mem.zeroes(Stat); - switch (errno(system.fstatat(dirfd, pathname, &stat, flags))) { - .SUCCESS => return stat, - .INVAL => unreachable, - .BADF => unreachable, // Always a race condition. - .NOMEM => return error.SystemResources, - .ACCES => return error.AccessDenied, - .PERM => return error.PermissionDenied, - .FAULT => unreachable, - .NAMETOOLONG => return error.NameTooLong, - .LOOP => return error.SymLinkLoop, - .NOENT => return error.FileNotFound, - .NOTDIR => return error.FileNotFound, - .ILSEQ => return error.BadPathName, - else => |err| return unexpectedErrno(err), - } -} - pub const KQueueError = error{ /// The per-process limit on the number of open file descriptors has been reached. ProcessFdQuotaExceeded,