(
ctx: &mut VmCtx,
v_fd: u32,
pathname: u32,
path_len: u32,
)
| 430 | #[ensures(ctx_safe(ctx))] |
| 431 | #[ensures(trace_safe(trace, ctx))] |
| 432 | pub fn wasi_path_create_directory( |
| 433 | ctx: &mut VmCtx, |
| 434 | v_fd: u32, |
| 435 | pathname: u32, |
| 436 | path_len: u32, |
| 437 | ) -> RuntimeResult<()> { |
| 438 | // let fd = ctx.fdmap.fd_to_native(v_fd)?; |
| 439 | |
| 440 | if v_fd != HOMEDIR_FD { |
| 441 | return Err(Enotcapable); |
| 442 | } |
| 443 | assert!(v_fd == HOMEDIR_FD); |
| 444 | let fd = ctx.homedir_host_fd; |
| 445 | |
| 446 | // create directory follows symlinks |
| 447 | let host_pathname = ctx.translate_path(pathname, path_len, true, fd); |
| 448 | unwrap_result!(host_pathname); |
| 449 | // wasi doesn't specify what permissions should be |
| 450 | // We use rw------- cause it seems sane. |
| 451 | let res = trace_mkdirat(ctx, fd, host_pathname, 0o766)?; |
| 452 | Ok(()) |
| 453 | } |
| 454 | |
| 455 | // https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#path_filestat_get |
| 456 | // modifies: None |
no test coverage detected