MCPcopy Create free account
hub / github.com/PLSysSec/wave / wasi_fd_fdstat_get

Function wasi_fd_fdstat_get

src/wrappers.rs:240–255  ·  view source on GitHub ↗
(ctx: &VmCtx, v_fd: u32)

Source from the content-addressed store, hash-verified

238#[ensures(ctx_safe(ctx))]
239#[ensures(trace_safe(trace, ctx))]
240pub fn wasi_fd_fdstat_get(ctx: &VmCtx, v_fd: u32) -> RuntimeResult<FdStat> {
241 let fd = ctx.fdmap.fd_to_native(v_fd)?;
242 let mut stat = fresh_stat();
243 let result = trace_fstat(ctx, fd, &mut stat)?;
244 let filetype = stat.st_mode;
245
246 let mode_flags = trace_fgetfl(ctx, fd)?;
247
248 let result = FdStat {
249 fs_filetype: (filetype as libc::mode_t).into(),
250 fs_flags: FdFlags::from_posix(mode_flags as i32),
251 fs_rights_base: 0, // We don't bother to implement rights
252 fs_rights_inheriting: u64::MAX,
253 };
254 Ok(result)
255}
256
257// https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#fd_fdstat_set_flags
258#[with_ghost_var(trace: &mut Trace)]

Calls 4

fresh_statFunction · 0.85
trace_fstatFunction · 0.85
trace_fgetflFunction · 0.85
fd_to_nativeMethod · 0.80

Tested by

no test coverage detected