ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 1,823 microarchs · 16,083 chips · 105 sources
Arch:
Tier:

wasi:fd_readdir

T1 wasm syscall syscall
WASI Preview 1 Syscall: fd_readdir
SourceWASI Snapshot Preview 1 System Call Interface (WebAssembly/WASI) (wasi_syscalls)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeWASI Preview 1 (wasip1)
WebAssembly WASI Preview 1 (Wasmtime, WasmEdge, Wasmer, WAMR, Node.js)
License & VersionW3C Community CLA
wasi_snapshot_preview1
Upstreamhttps://github.com/WebAssembly/WASI/blob/wasi-0.1/preview1/witx/wasi_snapshot_preview1.witx
Privilegeguest->host
ExtensionsWASI, wasip1, wasi_snapshot_preview1

Summary

WASI wasi_snapshot_preview1 host syscall fd_readdir. Read directory entries from a directory. When successful, the contents of the output buffer consist of a sequence of directory entries. Each directory entry consists of a dirent object, followed by dirent::d_namlen bytes holding the name of the directory entry. This function fills the output buffer as much as possible, potentially truncating the last directory…

Syntax / Encoding

wasi_snapshot_preview1::fd_readdir(fd: $fd, buf: (@witx pointer u8), buf_len: $size, cookie: $dircookie) -> (expected $size (error $errno))

Operands

NameDescription
fdWASI parameter `fd` of type `$fd`
bufThe buffer where directory entries are stored
buf_lenWASI parameter `buf_len` of type `$size`
cookieThe location within the directory to start reading
errorThe number of bytes stored in the read buffer. If less than the size of the read buffer, the end of the directory has been reached.