diff --git a/musl_src.gni b/musl_src.gni index 2e0a75969da21c9825c3d95c2d0793402ee3190a..21e78ff43f0178274961dcbb072119664574cfc2 100644 --- a/musl_src.gni +++ b/musl_src.gni @@ -2119,9 +2119,11 @@ musl_src_porting_file = [ "src/thread/pthread_mutex_lock.c", "src/thread/pthread_mutex_timedlock_monotonic_np.c", "src/thread/pthread_mutex_lock_timeout_np.c", + "src/thread/pthread_mutex_init.c", "src/thread/pthread_rwlock_clockrdlock.c", "src/thread/pthread_rwlock_timedrdlock.c", "src/thread/pthread_rwlock_timedrdlock_monotonic_np.c", + "src/thread/pthread_rwlock_init.c", "src/thread/pthread_cond_timedwait_monotonic_np.c", "src/thread/pthread_cond_timeout_np.c", "src/thread/pthread_cond_clockwait.c", diff --git a/porting/linux/user/src/thread/pthread_mutex_init.c b/porting/linux/user/src/thread/pthread_mutex_init.c new file mode 100644 index 0000000000000000000000000000000000000000..f606428db366ead2f84b6eb05873ac9a3f774441 --- /dev/null +++ b/porting/linux/user/src/thread/pthread_mutex_init.c @@ -0,0 +1,8 @@ +#include "pthread_impl.h" + +int pthread_mutex_init(pthread_mutex_t *restrict m, const pthread_mutexattr_t *restrict a) +{ + __builtin_memset(m, 0, sizeof(pthread_mutex_t)); + if (a) m->_m_type = a->__attr; + return 0; +} diff --git a/porting/linux/user/src/thread/pthread_rwlock_init.c b/porting/linux/user/src/thread/pthread_rwlock_init.c new file mode 100644 index 0000000000000000000000000000000000000000..27cf8723e11bafc0661117f6f7e939381ff36218 --- /dev/null +++ b/porting/linux/user/src/thread/pthread_rwlock_init.c @@ -0,0 +1,8 @@ +#include "pthread_impl.h" + +int pthread_rwlock_init(pthread_rwlock_t *restrict rw, const pthread_rwlockattr_t *restrict a) +{ + __builtin_memset(rw, 0, sizeof(pthread_rwlock_t)); + if (a) rw->_rw_shared = a->__attr[0]*128; + return 0; +}