aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--libio/genops.c4
-rw-r--r--libio/libioP.h14
-rw-r--r--misc/Makefile1
-rw-r--r--nptl/ChangeLog5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/Makefile4
6 files changed, 31 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e37db9..9d8543c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2012-08-17 Roland McGrath <roland@hack.frob.com>
+ * libio/genops.c (_IO_unbuffer_write): Conditionalize locking code on
+ [_IO_MTSAFE_IO].
+ * libio/libioP.h [!_IO_MTSAFE_IO && !NOT_IN_libc]
+ (_IO_acquire_lock, _IO_acquire_lock_clear_flags2, _IO_release_lock):
+ New macros.
+
* Makeconfig [$(libc-reentrant) = yes] (libio-mtsafe): New variable.
* libio/Makefile (CPPFLAGS): Append $(libio-mtsafe) unconditionally
rather than -D_IO_MTSAFE_IO conditionally.
diff --git a/libio/genops.c b/libio/genops.c
index c8297ff..0a81a5d 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -952,6 +952,7 @@ _IO_unbuffer_write (void)
/* Iff stream is un-orientated, it wasn't used. */
&& fp->_mode != 0)
{
+#ifdef _IO_MTSAFE_IO
int cnt;
#define MAXTRIES 2
for (cnt = 0; cnt < MAXTRIES; ++cnt)
@@ -961,6 +962,7 @@ _IO_unbuffer_write (void)
/* Give the other thread time to finish up its use of the
stream. */
__sched_yield ();
+#endif
if (! dealloc_buffers && !(fp->_flags & _IO_USER_BUF))
{
@@ -974,8 +976,10 @@ _IO_unbuffer_write (void)
_IO_SETBUF (fp, NULL, 0);
+#ifdef _IO_MTSAFE_IO
if (cnt < MAXTRIES && fp->_lock != NULL)
_IO_lock_unlock (*fp->_lock);
+#endif
}
/* Make sure that never again the wide char functions can be
diff --git a/libio/libioP.h b/libio/libioP.h
index 486c670..aa2b3bf 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -933,3 +933,17 @@ _IO_acquire_lock_clear_flags2_fct (_IO_FILE **p)
if ((fp->_flags & _IO_USER_LOCK) == 0)
_IO_funlockfile (fp);
}
+
+#if !defined _IO_MTSAFE_IO && !defined NOT_IN_libc
+# define _IO_acquire_lock(_fp) \
+ do { \
+ _IO_FILE *_IO_acquire_lock_file = NULL
+# define _IO_acquire_lock_clear_flags2(_fp) \
+ do { \
+ _IO_FILE *_IO_acquire_lock_file = (_fp)
+# define _IO_release_lock(_fp) \
+ if (_IO_acquire_lock_file != NULL) \
+ _IO_acquire_lock_file->_flags2 &= ~(_IO_FLAGS2_FORTIFY \
+ | _IO_FLAGS2_SCANF_STD); \
+ } while (0)
+#endif
diff --git a/misc/Makefile b/misc/Makefile
index d1c0a02..d35654c 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -95,7 +95,6 @@ CFLAGS-getsysstats.c = -fexceptions
CFLAGS-getusershell.c = -fexceptions
CFLAGS-err.c = -fexceptions
CFLAGS-tst-tsearch.c = $(stack-align-test-flags)
-CFLAGS-mntent_r.c = -D_IO_MTSAFE_IO
include ../Rules
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 8a8cbb8..eb84863 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,8 +1,13 @@
2012-08-15 Roland McGrath <roland@hack.frob.com>
+2012-08-15 Roland McGrath <roland@hack.frob.com>
+
+2012-08-15 Roland McGrath <roland@hack.frob.com>
+
* Makefile (CFLAGS-flockfile.c): Use $(libio-mtsafe) instead
of -D_IO_MTSAFE_IO.
(CFLAGS-ftrylockfile.c, CFLAGS-funlockfile.c): Likewise.
+ * sysdeps/unix/sysv/linux/Makefile (CFLAGS-fork.c): Likewise.
2012-08-16 Joseph Myers <joseph@codesourcery.com>
diff --git a/nptl/sysdeps/unix/sysv/linux/Makefile b/nptl/sysdeps/unix/sysv/linux/Makefile
index 64a3f4f..d24a9bc 100644
--- a/nptl/sysdeps/unix/sysv/linux/Makefile
+++ b/nptl/sysdeps/unix/sysv/linux/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -29,7 +29,7 @@ gen-as-const-headers += lowlevelcond.sym lowlevelrwlock.sym \
endif
ifeq ($(subdir),posix)
-CFLAGS-fork.c = -D_IO_MTSAFE_IO
+CFLAGS-fork.c = $(libio-mtsafe)
CFLAGS-getpid.o = -fomit-frame-pointer
CFLAGS-getpid.os = -fomit-frame-pointer
endif