Function fstat_wasi [src]
Prototype
pub fn fstat_wasi(fd: posix.fd_t) posix.FStatError!wasi.filestat_t
Parameters
fd: posix.fd_t
Source
pub fn fstat_wasi(fd: posix.fd_t) posix.FStatError!wasi.filestat_t {
var stat: wasi.filestat_t = undefined;
switch (wasi.fd_filestat_get(fd, &stat)) {
.SUCCESS => return stat,
.INVAL => unreachable,
.BADF => unreachable, // Always a race condition.
.NOMEM => return error.SystemResources,
.ACCES => return error.AccessDenied,
.NOTCAPABLE => return error.AccessDenied,
else => |err| return posix.unexpectedErrno(err),
}
}