about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-10 21:40:18 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-10 21:40:18 +0000
commit0d875352b73d4e50c4a578a706378b3e51885126 (patch)
tree4681287a082d0b009ceb77a851e9171cb7e651d3
parentc31c27256e4735e9d05676aecd9d5be73bbabde1 (diff)
downloadglibc-0d875352b73d4e50c4a578a706378b3e51885126.tar.gz
glibc-0d875352b73d4e50c4a578a706378b3e51885126.tar.xz
glibc-0d875352b73d4e50c4a578a706378b3e51885126.zip
Call __fsetlocking for temporary stream.
-rw-r--r--libio/iovdprintf.c6
-rw-r--r--libio/obprintf.c6
-rw-r--r--libio/strops.c8
-rw-r--r--libio/vasprintf.c4
-rw-r--r--libio/wstrops.c8
5 files changed, 28 insertions, 4 deletions
diff --git a/libio/iovdprintf.c b/libio/iovdprintf.c
index a0dda97d14..d7c656a459 100644
--- a/libio/iovdprintf.c
+++ b/libio/iovdprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997-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
@@ -27,6 +27,7 @@
 
 #include "libioP.h"
 #include "libio.h"
+#include <stdio_ext.h>
 
 int
 _IO_vdprintf (d, format, arg)
@@ -59,6 +60,9 @@ _IO_vdprintf (d, format, arg)
     (_IO_mask_flags (&tmpfil.file, _IO_NO_READS,
 		     _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING)
      | _IO_DELETE_DONT_CLOSE);
+#ifdef _IO_MTSAFE_IO
+  __fsetlocking ((FILE *) &tmpfil, FSETLOCKING_BYCALLER);
+#endif
 
   done = _IO_vfprintf ((_IO_FILE *) &tmpfil, format, arg);
 
diff --git a/libio/obprintf.c b/libio/obprintf.c
index 20e888269d..c0f0e8c8ff 100644
--- a/libio/obprintf.c
+++ b/libio/obprintf.c
@@ -1,5 +1,5 @@
 /* Print output of stream to given obstack.
-   Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -28,6 +28,7 @@
 #include <errno.h>
 #include <obstack.h>
 #include <stdarg.h>
+#include <stdio_ext.h>
 
 
 struct _IO_obstack_file
@@ -166,6 +167,9 @@ _IO_obstack_vprintf (struct obstack *obstack, const char *format, va_list args)
   obstack_blank_fast (obstack, room);
 
   new_f.ofile.obstack = obstack;
+#ifdef _IO_MTSAFE_IO
+  __fsetlocking ((FILE *) &new_f.ofile.file, FSETLOCKING_BYCALLER);
+#endif
 
   result = _IO_vfprintf ((_IO_FILE *) &new_f.ofile.file, format, args);
 
diff --git a/libio/strops.c b/libio/strops.c
index 68202756d8..c3b6625a1d 100644
--- a/libio/strops.c
+++ b/libio/strops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997-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
@@ -28,6 +28,7 @@
 #include "strfile.h"
 #include "libioP.h"
 #include <string.h>
+#include <stdio_ext.h>
 
 #if 0
 /* The following definitions are for exposition only.
@@ -107,6 +108,11 @@ _IO_str_init_static (sf, ptr, size, pstart)
     }
   /* A null _allocate_buffer function flags the strfile as being static. */
   sf->_s._allocate_buffer = (_IO_alloc_type) 0;
+
+#ifdef _IO_MTSAFE_IO
+  /* We never have to lock this stream.  */
+  __fsetlocking ((FILE *) fp, FSETLOCKING_BYCALLER);
+#endif
 }
 
 void
diff --git a/libio/vasprintf.c b/libio/vasprintf.c
index 852de2367b..8dda7d9b1b 100644
--- a/libio/vasprintf.c
+++ b/libio/vasprintf.c
@@ -29,6 +29,7 @@
 #include <string.h>
 #include "libioP.h"
 #include "stdio.h"
+#include <stdio_ext.h>
 #include "strfile.h"
 
 int
@@ -60,6 +61,9 @@ _IO_vasprintf (result_ptr, format, args)
   sf._sbf._f._flags &= ~_IO_USER_BUF;
   sf._s._allocate_buffer = (_IO_alloc_type) malloc;
   sf._s._free_buffer = (_IO_free_type) free;
+#ifdef _IO_MTSAFE_IO
+  __fsetlocking ((FILE *) &sf, FSETLOCKING_BYCALLER);
+#endif
   ret = _IO_vfprintf ((_IO_FILE *) &sf, format, args);
   if (ret < 0)
     return ret;
diff --git a/libio/wstrops.c b/libio/wstrops.c
index 92d7f2fe95..bfc71c2918 100644
--- a/libio/wstrops.c
+++ b/libio/wstrops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 1998, 1999, 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
@@ -29,6 +29,7 @@
 #include "libioP.h"
 #include <string.h>
 #include <wchar.h>
+#include <stdio_ext.h>
 
 #if 0
 /* The following definitions are for exposition only.
@@ -106,6 +107,11 @@ _IO_wstr_init_static (fp, ptr, size, pstart)
     }
   /* A null _allocate_buffer function flags the strfile as being static. */
   (((_IO_strfile *) fp)->_s._allocate_buffer) =  (_IO_alloc_type)0;
+
+#ifdef _IO_MTSAFE_IO
+  /* We never have to lock this stream.  */
+  __fsetlocking ((FILE *) fp, FSETLOCKING_BYCALLER);
+#endif
 }
 
 void