mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-31 14:01:18 +08:00
Make libio compile without _IO_MTSAFE_IO.
This commit is contained in:
parent
c75ccd4c3a
commit
b2e1c56272
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user