diff options
-rw-r--r-- | libc/misc/pthread/weaks.c | 6 | ||||
-rw-r--r-- | libpthread/nptl/sysdeps/unix/sysv/linux/fork.c | 25 |
2 files changed, 27 insertions, 4 deletions
diff --git a/libc/misc/pthread/weaks.c b/libc/misc/pthread/weaks.c index 89c26110c..8486dc203 100644 --- a/libc/misc/pthread/weaks.c +++ b/libc/misc/pthread/weaks.c @@ -66,10 +66,10 @@ weak_alias (__pthread_return_0, pthread_mutex_init) weak_alias (__pthread_return_0, pthread_mutex_lock) /* weak_alias (__pthread_return_0, pthread_mutex_trylock) */ weak_alias (__pthread_return_0, pthread_mutex_unlock) -/* weak_alias (__pthread_return_0, pthread_mutexattr_destroy) */ +weak_alias (__pthread_return_0, pthread_mutexattr_destroy) /* weak_alias (__pthread_return_0, pthread_mutexattr_gettype) */ -/* weak_alias (__pthread_return_0, pthread_mutexattr_init) */ -/* weak_alias (__pthread_return_0, pthread_mutexattr_settype) */ +weak_alias (__pthread_return_0, pthread_mutexattr_init) +weak_alias (__pthread_return_0, pthread_mutexattr_settype) /* weak_alias (__pthread_return_0, pthread_rwlock_destroy) */ /* weak_alias (__pthread_return_0, pthread_rwlock_init) */ /* weak_alias (__pthread_return_0, pthread_rwlock_rdlock) */ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c index 0bc2a2410..c03bfd4d6 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c @@ -46,9 +46,20 @@ fresetlockfiles (void) { #ifdef __UCLIBC__ FILE *fp; - +#ifdef __USE_STDIO_FUTEXES__ for (fp = _stdio_openlist; fp != NULL; fp = fp->__nextopen) _IO_lock_init(fp->_lock); +# else + pthread_mutexattr_t attr; + + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); + + for (fp = _stdio_openlist; fp != NULL; fp = fp->__nextopen) + pthread_mutex_init(&fp->__lock, &attr); + + pthread_mutexattr_destroy(&attr); +# endif #else _IO_ITER i; @@ -125,8 +136,12 @@ __libc_fork (void) } #ifdef __UCLIBC__ +#ifdef __USE_STDIO_FUTEXES__ _IO_lock_lock (_stdio_openlist_lock); #else + __pthread_mutex_lock(&_stdio_openlist_lock); +#endif +#else _IO_list_lock (); #endif @@ -173,7 +188,11 @@ __libc_fork (void) /* Reset locks in the I/O code. */ #ifdef __UCLIBC__ +# ifdef __USE_STDIO_FUTEXES__ _IO_lock_init (_stdio_openlist_lock); +# else + __stdio_init_mutex(&_stdio_openlist_lock); +# endif #else _IO_list_resetlock (); #endif @@ -214,7 +233,11 @@ __libc_fork (void) /* We execute this even if the 'fork' call failed. */ #ifdef __UCLIBC__ +# ifdef __USE_STDIO_FUTEXES__ _IO_lock_unlock(_stdio_openlist_lock); +# else + __pthread_mutex_unlock(&_stdio_openlist_lock); +# endif #else _IO_list_unlock (); #endif |