summaryrefslogtreecommitdiffstats
path: root/libpthread/nptl/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2005-09-06 02:15:55 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2005-09-06 02:15:55 +0000
commitdf6c58b8931a9419d9898ab5868796f319b13f8f (patch)
treef6d2b1a6a1afe9aebdec76e0c226ac74c3b6ee76 /libpthread/nptl/sysdeps/unix/sysv/linux
parentd1b72b0a5dc0813132ad004d785d89c0e8e69be1 (diff)
downloaduClibc-alpine-df6c58b8931a9419d9898ab5868796f319b13f8f.tar.bz2
uClibc-alpine-df6c58b8931a9419d9898ab5868796f319b13f8f.tar.xz
We can now deselect STDIO futex support independently of NPTL.
Diffstat (limited to 'libpthread/nptl/sysdeps/unix/sysv/linux')
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/fork.c25
1 files changed, 24 insertions, 1 deletions
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