[Partial] Build wasi-libc for Windows (#2338)

Build wasi-libc library on Windows since libuv may be not supported. This PR is a first step
to make it working, but there's still a number of changes to get it fully working.
This commit is contained in:
Marcin Kolny
2023-07-13 14:02:29 +01:00
committed by GitHub
parent 81f0371f63
commit 662e38e9b0
19 changed files with 428 additions and 139 deletions

View File

@ -50,6 +50,7 @@ typedef pthread_t korp_thread;
typedef pthread_t korp_tid;
typedef pthread_mutex_t korp_mutex;
typedef pthread_cond_t korp_cond;
typedef pthread_rwlock_t korp_rwlock;
typedef unsigned int korp_sem;
#ifndef SGX_DISABLE_PTHREAD

View File

@ -210,3 +210,68 @@ os_thread_get_stack_boundary()
/* TODO: get sgx stack boundary */
return NULL;
}
int
os_rwlock_init(korp_rwlock *lock)
{
#ifndef SGX_DISABLE_PTHREAD
assert(lock);
if (pthread_rwlock_init(lock, NULL) != BHT_OK)
return BHT_ERROR;
#endif
return BHT_OK;
}
int
os_rwlock_rdlock(korp_rwlock *lock)
{
#ifndef SGX_DISABLE_PTHREAD
assert(lock);
if (pthread_rwlock_rdlock(lock) != BHT_OK)
return BHT_ERROR;
#endif
return BHT_OK;
}
int
os_rwlock_wrlock(korp_rwlock *lock)
{
#ifndef SGX_DISABLE_PTHREAD
assert(lock);
if (pthread_rwlock_wrlock(lock) != BHT_OK)
return BHT_ERROR;
#endif
return BHT_OK;
}
int
os_rwlock_unlock(korp_rwlock *lock)
{
#ifndef SGX_DISABLE_PTHREAD
assert(lock);
if (pthread_rwlock_unlock(lock) != BHT_OK)
return BHT_ERROR;
#endif
return BHT_OK;
}
int
os_rwlock_destroy(korp_rwlock *lock)
{
#ifndef SGX_DISABLE_PTHREAD
assert(lock);
if (pthread_rwlock_destroy(lock) != BHT_OK)
return BHT_ERROR;
#endif
return BHT_OK;
}