| 473 | } |
| 474 | |
| 475 | WasiExpect<void> INode::fdRead(Span<Span<uint8_t>> IOVs, |
| 476 | __wasi_size_t &NRead) const noexcept { |
| 477 | iovec SysIOVs[kIOVMax]; |
| 478 | size_t SysIOVsSize = 0; |
| 479 | for (auto &IOV : IOVs) { |
| 480 | SysIOVs[SysIOVsSize].iov_base = IOV.data(); |
| 481 | SysIOVs[SysIOVsSize].iov_len = IOV.size(); |
| 482 | ++SysIOVsSize; |
| 483 | } |
| 484 | |
| 485 | if (auto Res = ::readv(Fd, SysIOVs, SysIOVsSize); unlikely(Res < 0)) { |
| 486 | return WasiUnexpect(fromErrNo(errno)); |
| 487 | } else { |
| 488 | NRead = EndianValue(static_cast<__wasi_size_t>(Res)).le(); |
| 489 | } |
| 490 | |
| 491 | return {}; |
| 492 | } |
| 493 | |
| 494 | // Due to the unfortunate design of wasi::fd_readdir, It's nearly impossible to |
| 495 | // provide a correct implementation. The below implementation is just a |
nothing calls this directly
no test coverage detected