Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve some pthreads stub functions, batch 0 #519

Merged
merged 3 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,16 @@ LIBC_TOP_HALF_MUSL_SOURCES += \
thread/pthread_attr_destroy.c \
thread/pthread_attr_get.c \
thread/pthread_attr_init.c \
thread/pthread_attr_setstack.c \
thread/pthread_attr_setdetachstate.c \
thread/pthread_attr_setguardsize.c \
thread/pthread_attr_setstack.c \
thread/pthread_attr_setstacksize.c \
thread/pthread_barrier_destroy.c \
thread/pthread_barrier_init.c \
thread/pthread_barrier_wait.c \
thread/pthread_barrierattr_destroy.c \
thread/pthread_barrierattr_init.c \
thread/pthread_barrierattr_setpshared.c \
thread/pthread_cleanup_push.c \
thread/pthread_cond_broadcast.c \
thread/pthread_cond_destroy.c \
Expand Down
4 changes: 4 additions & 0 deletions expected/wasm32-wasip1-threads/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -992,12 +992,16 @@ pthread_attr_getstack
pthread_attr_getstacksize
pthread_attr_init
pthread_attr_setdetachstate
pthread_attr_setguardsize
pthread_attr_setstack
pthread_attr_setstacksize
pthread_barrier_destroy
pthread_barrier_init
pthread_barrier_wait
pthread_barrierattr_destroy
pthread_barrierattr_getpshared
pthread_barrierattr_init
pthread_barrierattr_setpshared
pthread_cond_broadcast
pthread_cond_destroy
pthread_cond_init
Expand Down
5 changes: 5 additions & 0 deletions libc-top-half/musl/src/thread/pthread_attr_setguardsize.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

int pthread_attr_setguardsize(pthread_attr_t *a, size_t size)
{
#ifdef __wasilibc_unmodified_upstream
if (size > SIZE_MAX/8) return EINVAL;
#else
/* WASI doesn't have memory protection required for stack guards. */
if (size > 0) return EINVAL;
#endif
a->_a_guardsize = size;
return 0;
}
3 changes: 2 additions & 1 deletion libc-top-half/musl/src/thread/pthread_mutexattr_setrobust.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ int pthread_mutexattr_setrobust(pthread_mutexattr_t *a, int robust)
a->__attr &= ~4;
return 0;
#else
return EINVAL;
if (robust) return EINVAL;
return 0;
#endif
}