| 49 | } |
| 50 | |
| 51 | __wasi_fd_t |
| 52 | FileTable::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 | |
| 63 | int OpenFileState::create(std::shared_ptr<File> file, |
| 64 | oflags_t flags, |
no outgoing calls
no test coverage detected