Fix linux-sgx build error when libc-wasi is disabled (#2997)
Compilation error was reported when `cmake -DWAMR_BUILD_LIBC_WASI=0`
on linux-sgx platform:
```
core/shared/platform/linux-sgx/sgx_socket.c:8:10:
fatal error: libc_errno.h: No such file or directory
8 | #include "libc_errno.h"
| ^~~~~~~~~~~~~~
```
After fixing, both `cmake -DWAMR_BUILD_LIBC_WASI=1` and
`WAMR_BUILD_LIBC_WASI=0` work good.
This commit is contained in:
@ -119,6 +119,18 @@ strcpy(char *dest, const char *src)
|
||||
return dest;
|
||||
}
|
||||
|
||||
#if WASM_ENABLE_LIBC_WASI == 0
|
||||
bool
|
||||
os_is_handle_valid(os_file_handle *handle)
|
||||
{
|
||||
assert(handle != NULL);
|
||||
|
||||
return *handle > -1;
|
||||
}
|
||||
#else
|
||||
/* implemented in posix_file.c */
|
||||
#endif
|
||||
|
||||
void *
|
||||
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
|
||||
{
|
||||
|
||||
@ -5,10 +5,11 @@
|
||||
|
||||
#include "platform_api_vmcore.h"
|
||||
#include "platform_api_extension.h"
|
||||
#include "libc_errno.h"
|
||||
|
||||
#ifndef SGX_DISABLE_WASI
|
||||
|
||||
#include "libc_errno.h"
|
||||
|
||||
#define TRACE_OCALL_FAIL() os_printf("ocall %s failed!\n", __FUNCTION__)
|
||||
|
||||
/** OCALLs prototypes **/
|
||||
|
||||
Reference in New Issue
Block a user