summaryrefslogtreecommitdiff
path: root/libpthread
diff options
context:
space:
mode:
Diffstat (limited to 'libpthread')
-rw-r--r--libpthread/linuxthreads/lockfile.c29
-rw-r--r--libpthread/linuxthreads/pthread.c15
2 files changed, 17 insertions, 27 deletions
diff --git a/libpthread/linuxthreads/lockfile.c b/libpthread/linuxthreads/lockfile.c
index 051bb75bc..d54377fc0 100644
--- a/libpthread/linuxthreads/lockfile.c
+++ b/libpthread/linuxthreads/lockfile.c
@@ -20,29 +20,8 @@
#include <stdio.h>
#include <pthread.h>
-void
-__flockfile (FILE *stream)
-{
- pthread_mutex_lock(&stream->lock);
-}
-weak_alias (__flockfile, flockfile);
-
-
-void
-__funlockfile (FILE *stream)
-{
- pthread_mutex_unlock(&stream->lock);
-}
-weak_alias (__funlockfile, funlockfile);
-
-
-int
-__ftrylockfile (FILE *stream)
-{
- return pthread_mutex_trylock(&stream->lock);
-}
-weak_alias (__ftrylockfile, ftrylockfile);
-
+/* Note: glibc puts flockfile, funlockfile, and ftrylockfile in both
+ * libc and libpthread. In uClibc, they are now in libc only. */
void
__fresetlockfiles (void)
@@ -53,8 +32,8 @@ __fresetlockfiles (void)
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);
+ for (fp = _stdio_openlist; fp != NULL; fp = fp->__nextopen)
+ pthread_mutex_init(&fp->__lock, &attr);
pthread_mutexattr_destroy(&attr);
}
diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c
index e9ca9aa32..c4225bce8 100644
--- a/libpthread/linuxthreads/pthread.c
+++ b/libpthread/linuxthreads/pthread.c
@@ -101,7 +101,7 @@ struct _pthread_descr_struct __pthread_initial_thread = {
0 /* int p_untracked_readlock_count; */
#ifdef __UCLIBC_HAS_XLOCALE__
,
- NULL, /* __locale_t locale; */
+ &__global_locale_data, /* __locale_t locale; */
#endif /* __UCLIBC_HAS_XLOCALE__ */
};
@@ -157,7 +157,7 @@ struct _pthread_descr_struct __pthread_manager_thread = {
0 /* int p_untracked_readlock_count; */
#ifdef __UCLIBC_HAS_XLOCALE__
,
- NULL, /* __locale_t locale; */
+ &__global_locale_data, /* __locale_t locale; */
#endif /* __UCLIBC_HAS_XLOCALE__ */
};
@@ -332,6 +332,17 @@ static void pthread_initialize(void)
__pthread_initial_thread.locale = __curlocale_var;
#endif /* __UCLIBC_HAS_XLOCALE__ */
+ { /* uClibc-specific stdio initialization for threads. */
+ FILE *fp;
+
+ _stdio_user_locking = 0; /* 2 if threading not initialized */
+ for (fp = _stdio_openlist; fp != NULL; fp = fp->__nextopen) {
+ if (fp->__user_locking != 1) {
+ fp->__user_locking = 0;
+ }
+ }
+ }
+
/* Play with the stack size limit to make sure that no stack ever grows
beyond STACK_SIZE minus two pages (one page for the thread descriptor
immediately beyond, and one page to act as a guard page). */