MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / getFileAt

Function getFileAt

system/lib/wasmfs/paths.cpp:152–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152ParsedFile 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
168ParsedFile getFileFrom(std::shared_ptr<Directory> base, std::string_view path) {
169 size_t recursions = 0;

Callers 4

__syscall_newfstatatFunction · 0.85
__syscall_utimensatFunction · 0.85
__syscall_fchmodat2Function · 0.85
__syscall_fchownatFunction · 0.85

Calls 6

parseFileFunction · 0.85
getCWDMethod · 0.80
getEntryMethod · 0.80
sizeMethod · 0.65
lockedMethod · 0.45
getFileMethod · 0.45

Tested by

no test coverage detected