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:
@ -80,4 +80,10 @@ int isnan(double x);
|
||||
/* clang-format on */
|
||||
#endif
|
||||
|
||||
static inline os_file_handle
|
||||
os_get_invalid_handle()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* end of _BH_PLATFORM_H */
|
||||
|
||||
@ -50,7 +50,7 @@ os_dumps_proc_mem_info(char *out, unsigned int size)
|
||||
}
|
||||
|
||||
void *
|
||||
os_mmap(void *hint, size_t size, int prot, int flags)
|
||||
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
|
||||
{
|
||||
if (size > ((unsigned)~0))
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user