This commit is contained in:
liang.he 2025-05-07 17:52:47 +08:00 committed by GitHub
commit 5aa93ed71d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 71 additions and 2 deletions

View File

@ -4127,6 +4127,12 @@ create_module(char *name, char *error_buf, uint32 error_buf_size)
}
#endif
#if WASM_ENABLE_LIBC_WASI != 0
module->wasi_args.stdio[0] = os_invalid_raw_handle();
module->wasi_args.stdio[1] = os_invalid_raw_handle();
module->wasi_args.stdio[2] = os_invalid_raw_handle();
#endif
return module;
#if WASM_ENABLE_GC != 0
fail2:

View File

@ -6376,6 +6376,12 @@ create_module(char *name, char *error_buf, uint32 error_buf_size)
}
#endif
#if WASM_ENABLE_LIBC_WASI != 0
module->wasi_args.stdio[0] = os_invalid_raw_handle();
module->wasi_args.stdio[1] = os_invalid_raw_handle();
module->wasi_args.stdio[2] = os_invalid_raw_handle();
#endif
(void)ret;
return module;

View File

@ -3137,6 +3137,12 @@ create_module(char *name, char *error_buf, uint32 error_buf_size)
}
#endif
#if WASM_ENABLE_LIBC_WASI != 0
module->wasi_args.stdio[0] = os_invalid_raw_handle();
module->wasi_args.stdio[1] = os_invalid_raw_handle();
module->wasi_args.stdio[2] = os_invalid_raw_handle();
#endif
(void)ret;
return module;
}

View File

@ -79,3 +79,9 @@ os_dcache_flush()
void
os_icache_flush(void *start, size_t len)
{}
os_raw_file_handle
os_invalid_raw_handle(void)
{
return -1;
}

View File

@ -1032,4 +1032,10 @@ char *
os_realpath(const char *path, char *resolved_path)
{
return realpath(path, resolved_path);
}
}
os_raw_file_handle
os_invalid_raw_handle(void)
{
return -1;
}

View File

@ -1032,4 +1032,10 @@ char *
os_realpath(const char *path, char *resolved_path)
{
return realpath(path, resolved_path);
}
}
os_raw_file_handle
os_invalid_raw_handle(void)
{
return -1;
}

View File

@ -1607,6 +1607,15 @@ os_is_dir_stream_valid(os_dir_stream *dir_stream);
os_file_handle
os_get_invalid_handle(void);
/**
* Returns an invalid raw file handle that is guaranteed to cause failure when
* called with any filesystem operation.
*
* @return the invalid raw file handle
*/
os_raw_file_handle
os_invalid_raw_handle(void);
/**
* Checks whether the given file handle is valid. An invalid handle is
* guaranteed to cause failure when called with any filesystem operation.

View File

@ -95,3 +95,9 @@ os_dcache_flush(void)
void
os_icache_flush(void *start, size_t len)
{}
os_raw_file_handle
os_invalid_raw_handle(void)
{
return -1;
}

View File

@ -192,3 +192,9 @@ posix_fallocate(int __fd, off_t __offset, off_t __length)
errno = ENOSYS;
return -1;
}
os_raw_file_handle
os_invalid_raw_handle(void)
{
return -1;
}

View File

@ -1810,3 +1810,9 @@ os_realpath(const char *path, char *resolved_path)
return resolved_path;
}
os_raw_file_handle
os_invalid_raw_handle(void)
{
return INVALID_HANDLE_VALUE;
}

View File

@ -255,3 +255,9 @@ set_exec_mem_alloc_func(exec_mem_alloc_func_t alloc_func,
exec_mem_alloc_func = alloc_func;
exec_mem_free_func = free_func;
}
os_raw_file_handle
os_invalid_raw_handle(void)
{
return -1;
}