+2001-11-28 Ulrich Drepper <drepper@redhat.com>
+
+ * libio/genops.c (_IO_flush_all_lockp): New function. The same code
+ as the old _IO_flush_all but lock only if parameter is nonzero.
+ (_IO_flush_all): Call _IO_flush_all_lockp with 1 as parameter.
+ * libio/libioP.h: Add prototype for _IO_flush_all_lockp.
+ * sysdeps/generic/abort.c (fflush): Define to _IO_flush_all_lockp(0)
+ if libio is used.
+
2001-11-28 Jakub Jelinek <jakub@redhat.com>
* sysdeps/sparc/fpu/bits/mathinline.h (__signbitf, __signbit,
int
-_IO_flush_all ()
+_IO_flush_all_lockp (int do_lock)
{
int result = 0;
struct _IO_FILE *fp;
#ifdef _IO_MTSAFE_IO
_IO_cleanup_region_start_noarg (flush_cleanup);
- _IO_lock_lock (list_all_lock);
+ if (do_lock)
+ _IO_lock_lock (list_all_lock);
#endif
last_stamp = _IO_list_all_stamp;
while (fp != NULL)
{
run_fp = fp;
- _IO_flockfile (fp);
+ if (do_lock)
+ _IO_flockfile (fp);
if (((fp->_mode <= 0 && fp->_IO_write_ptr > fp->_IO_write_base)
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
&& _IO_OVERFLOW (fp, EOF) == EOF)
result = EOF;
- _IO_funlockfile (fp);
+ if (do_lock)
+ _IO_funlockfile (fp);
run_fp = NULL;
if (last_stamp != _IO_list_all_stamp)
}
#ifdef _IO_MTSAFE_IO
- _IO_lock_unlock (list_all_lock);
+ if (do_lock)
+ _IO_lock_unlock (list_all_lock);
_IO_cleanup_region_end (0);
#endif
return result;
}
+
+int
+_IO_flush_all ()
+{
+ /* We want locking. */
+ return _IO_flush_all_lockp (1);
+}
+
void
_IO_flush_all_linebuffered ()
{
-/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
extern int _IO_new_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
extern int _IO_old_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
extern int _IO_wdo_write __P ((_IO_FILE *, const wchar_t *, _IO_size_t));
+extern int _IO_flush_all_lockp __P ((int));
extern int _IO_flush_all __P ((void));
extern int _IO_cleanup __P ((void));
extern void _IO_flush_all_linebuffered __P ((void));
-/* Copyright (C) 1991, 93, 95, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 93, 95, 96, 97, 98, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
-# define fflush(s) _IO_fflush (s)
+# define fflush(s) _IO_flush_all_lockp (0)
#endif
/* We must avoid to run in circles. Therefore we remember how far we