Extend os_mmap to support map file from fd (#2763)

Add an extra argument `os_file_handle file` for `os_mmap` to support
mapping file from a file fd, and remove `os_get_invalid_handle` from
`posix_file.c` and `win_file.c`, instead, add it in the `platform_internal.h`
files to remove the dependency on libc-wasi.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi
2023-11-16 08:28:54 +08:00
committed by GitHub
parent 0b8a904193
commit 24aa1cb408
35 changed files with 127 additions and 45 deletions

View File

@ -1467,7 +1467,7 @@ wasm_app_module_on_install_request_byte_arrive(uint8 ch, int request_total_size,
if (total_size >= UINT32_MAX
|| !(section->section_body =
os_mmap(NULL, (uint32)total_size, map_prot,
map_flags))) {
map_flags, os_get_invalid_handle()))) {
app_manager_printf(
"Allocate executable memory failed!\n");
SEND_ERR_RESPONSE(recv_ctx.message.request_mid,