DoxigAlpha

fstatat_wasi

WASI-only. Same as fstatat but targeting WASI. pathname should be encoded as valid UTF-8. See also fstatat.

Function parameters

Parameters

#
dirfd:posix.fd_t
pathname:[]const u8
flags:wasi.lookupflags_t

Type definitions in this namespace

Types

#

Call from Windows-specific code if you already have a WTF-16LE encoded, null terminated string.

Functions

#
accessW
Call from Windows-specific code if you already have a WTF-16LE encoded, null terminated string.
getFdPath
Return canonical path of handle `fd`.
fstatat_wasi
WASI-only.

See also `getenv`.

Values

#
environ
See also `getenv`.
argv
Populated by startup code before main().

Source

Implementation

#
pub fn fstatat_wasi(dirfd: posix.fd_t, pathname: []const u8, flags: wasi.lookupflags_t) posix.FStatAtError!wasi.filestat_t {
    var stat: wasi.filestat_t = undefined;
    switch (wasi.path_filestat_get(dirfd, flags, pathname.ptr, pathname.len, &stat)) {
        .SUCCESS => return stat,
        .INVAL => unreachable,
        .BADF => unreachable, // Always a race condition.
        .NOMEM => return error.SystemResources,
        .ACCES => return error.AccessDenied,
        .FAULT => unreachable,
        .NAMETOOLONG => return error.NameTooLong,
        .NOENT => return error.FileNotFound,
        .NOTDIR => return error.FileNotFound,
        .NOTCAPABLE => return error.AccessDenied,
        .ILSEQ => return error.InvalidUtf8,
        else => |err| return posix.unexpectedErrno(err),
    }
}