(
ctx: &mut VmCtx,
v_fd: u32,
pathname: u32,
path_len: u32,
ptr: u32,
len: u32,
)
| 630 | #[ensures(ctx_safe(ctx))] |
| 631 | #[ensures(trace_safe(trace, ctx))] |
| 632 | pub fn wasi_path_readlink( |
| 633 | ctx: &mut VmCtx, |
| 634 | v_fd: u32, |
| 635 | pathname: u32, |
| 636 | path_len: u32, |
| 637 | ptr: u32, |
| 638 | len: u32, |
| 639 | ) -> RuntimeResult<u32> { |
| 640 | // let fd = ctx.fdmap.fd_to_native(v_fd)?; |
| 641 | if v_fd != HOMEDIR_FD { |
| 642 | return Err(Enotcapable); |
| 643 | } |
| 644 | assert!(v_fd == HOMEDIR_FD); |
| 645 | let fd = ctx.homedir_host_fd; |
| 646 | |
| 647 | let should_follow = false; // readlink never follows symlink (it reads it!) |
| 648 | // TODO: replace once we can support the ? again |
| 649 | let host_pathname = ctx.translate_path(pathname, path_len, should_follow, fd); |
| 650 | unwrap_result!(host_pathname); |
| 651 | |
| 652 | if !ctx.fits_in_lin_mem(ptr, len) { |
| 653 | return Err(Efault); |
| 654 | } |
| 655 | |
| 656 | let res = trace_readlinkat(ctx, fd, host_pathname, ptr, len as usize)?; |
| 657 | let res = res as u32; |
| 658 | Ok(res) |
| 659 | } |
| 660 | |
| 661 | // https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#path_remove_directory |
| 662 | // modifies: none |
no test coverage detected