| 150 | } |
| 151 | |
| 152 | ParsedFile getFileAt(__wasi_fd_t fd, std::string_view path, int flags) { |
| 153 | if ((flags & AT_EMPTY_PATH) && path.size() == 0) { |
| 154 | // Don't parse a path, just use `dirfd` directly. |
| 155 | if (fd == AT_FDCWD) { |
| 156 | return {wasmFS.getCWD()}; |
| 157 | } |
| 158 | auto openFile = wasmFS.getFileTable().locked().getEntry(fd); |
| 159 | if (!openFile) { |
| 160 | return {-EBADF}; |
| 161 | } |
| 162 | return {openFile->locked().getFile()}; |
| 163 | } |
| 164 | auto links = (flags & AT_SYMLINK_NOFOLLOW) ? NoFollowLinks : FollowLinks; |
| 165 | return path::parseFile(path, fd, links); |
| 166 | } |
| 167 | |
| 168 | ParsedFile getFileFrom(std::shared_ptr<Directory> base, std::string_view path) { |
| 169 | size_t recursions = 0; |
no test coverage detected