LibWasm: Keep track of created directory fds in path_create_directory

This commit is contained in:
Ali Mohammad Pur 2023-05-04 00:38:54 +03:30 committed by Andreas Kling
parent 5121b368cd
commit 47248a3511
Notes: sideshowbarker 2024-07-17 04:32:07 +09:00
3 changed files with 9 additions and 0 deletions

View File

@ -478,6 +478,10 @@
# cmakedefine01 WASI_DEBUG
#endif
#ifndef WASI_FINE_GRAINED_DEBUG
# cmakedefine01 WASI_FINE_GRAINED_DEBUG
#endif
#ifndef WASM_BINPARSER_DEBUG
# cmakedefine01 WASM_BINPARSER_DEBUG
#endif

View File

@ -197,6 +197,7 @@ set(VPX_DEBUG ON)
set(WAITBLOCK_DEBUG ON)
set(WAITQUEUE_DEBUG ON)
set(WASI_DEBUG ON)
set(WASI_FINE_GRAINED_DEBUG ON)
set(WASM_BINPARSER_DEBUG ON)
set(WASM_TRACE_DEBUG ON)
set(WASM_VALIDATOR_DEBUG ON)

View File

@ -636,12 +636,16 @@ ErrorOr<Result<FD>> Implementation::impl$path_open(Configuration& configuration,
auto path_data = TRY(slice_typed_memory(configuration, path, path_len));
auto path_string = DeprecatedString::copy(path_data);
dbgln_if(WASI_FINE_GRAINED_DEBUG, "path_open: dir_fd={}, path={}, open_flags={}", dir_fd, path_string, open_flags);
int opened_fd = openat(dir_fd, path_string.characters(), open_flags, 0644);
if (opened_fd < 0)
return errno_value_from_errno(errno);
// FIXME: Implement Rights and RightsInheriting.
m_fd_map.insert(opened_fd, static_cast<u32>(opened_fd));
return FD(opened_fd);
}