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:
@ -187,6 +187,12 @@ typedef uint32_t os_raw_file_handle;
|
||||
#define UWP_DEFAULT_VPRINTF
|
||||
#endif
|
||||
|
||||
static inline os_file_handle
|
||||
os_get_invalid_handle()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1466,12 +1466,6 @@ os_is_dir_stream_valid(os_dir_stream *dir_stream)
|
||||
return true;
|
||||
}
|
||||
|
||||
os_file_handle
|
||||
os_get_invalid_handle()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
os_is_handle_valid(os_file_handle *handle)
|
||||
{
|
||||
|
||||
@ -29,7 +29,7 @@ access_to_win32_flags(int prot)
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
DWORD alloc_type = MEM_RESERVE;
|
||||
DWORD protect;
|
||||
|
||||
Reference in New Issue
Block a user