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.
/* 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)
/* Give the other thread time to finish up its use of the
stream. */
__sched_yield ();
+#endif
if (! dealloc_buffers && !(fp->_flags & _IO_USER_BUF))
{
_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
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
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
+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>
-# 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.
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