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

Method addEntry

system/lib/wasmfs/file_table.cpp:51–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51__wasi_fd_t
52FileTable::Handle::addEntry(std::shared_ptr<OpenFileState> openFileState) {
53 // TODO: add freelist to avoid linear lookup time.
54 for (__wasi_fd_t i = 0; i < WASMFS_FD_MAX; i++) {
55 if (!getEntry(i)) {
56 (void)setEntry(i, openFileState);
57 return i;
58 }
59 }
60 return -EBADF;
61}
62
63int OpenFileState::create(std::shared_ptr<File> file,
64 oflags_t flags,

Callers 3

__syscall_dupFunction · 0.80
doOpenFunction · 0.80
__syscall_pipe2Function · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected