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

Function wasm2c_marshal_and_writeback_fdstat

src/writeback.rs:113–132  ·  view source on GitHub ↗
(
    ctx: &mut VmCtx,
    addr: usize,
    res: RuntimeResult<FdStat>,
)

Source from the content-addressed store, hash-verified

111#[ensures(ctx_safe(ctx))]
112#[ensures(trace_safe(trace, ctx))]
113pub fn wasm2c_marshal_and_writeback_fdstat(
114 ctx: &mut VmCtx,
115 addr: usize,
116 res: RuntimeResult<FdStat>,
117) -> u32 {
118 if !ctx.fits_in_lin_mem_usize(addr, 24) {
119 return RuntimeError::Eoverflow.into();
120 }
121 //log::debug!("wasm2c_marshal_and_writeback_fdstat: {:?}", result);
122 match res {
123 Ok(r) => {
124 ctx.write_u16(addr, r.fs_filetype.to_wasi() as u16);
125 ctx.write_u16(addr + 2, r.fs_flags.to_posix() as u16);
126 ctx.write_u64(addr + 8, r.fs_rights_base);
127 ctx.write_u64(addr + 16, r.fs_rights_inheriting);
128 0
129 }
130 Err(err) => err.into(),
131 }
132}
133
134#[with_ghost_var(trace: &mut Trace)]
135#[requires(ctx_safe(ctx))]

Calls 5

fits_in_lin_mem_usizeMethod · 0.80
write_u16Method · 0.80
to_wasiMethod · 0.80
write_u64Method · 0.80
to_posixMethod · 0.45

Tested by

no test coverage detected