(ctx: &VmCtx, v_fd: u32)
| 238 | #[ensures(ctx_safe(ctx))] |
| 239 | #[ensures(trace_safe(trace, ctx))] |
| 240 | pub 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)] |
no test coverage detected