Standard library / std::runtime::wasi::fs

std::runtime::wasi::fs

Source: std/runtime/wasi/fs.slk

This is the exact canonical documentation page for std::runtime::wasi::fs.

Role#

std::runtime::wasi::fs is an implementation-facing runtime module in the shipped std/** tree. It exists so higher-level stdlib surfaces can delegate platform or runtime-specific behavior without changing their public module names.

Canonical Context#

Use the following owning docs for the substantive API/design context for this module:

Notes#

  • The shipped source for this module is std/runtime/wasi/fs.slk.
  • The canonical module name is std::runtime::wasi::fs.
  • The shipped WASI backend now projects preview1 file metadata into the stable raw-stat layout used by std::runtime::fs::{stat,lstat,fstat} and std::fs::Stats, with documented zero/fallback fields where preview1 lacks POSIX metadata.
  • fstat_size(fd) reads the preview1 descriptor filestat directly without changing the descriptor offset. It returns -1 and records a mapped errno when the syscall fails, the descriptor is invalid, allocation fails, or the unsigned WASI size cannot be represented as a Silk i64.
  • It exposes the same borrowed directory-entry fill surface as the POSIX backend for std::fs::Dir.next_view(), backed by the per-directory WASI fd_readdir buffer.
  • This page is intentionally implementation-oriented. Downstream users should usually start with the higher-level std module docs listed above unless they are working on the runtime layer itself.

Source repository · Edit this page · View Markdown