aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--libio/genops.c8
-rw-r--r--libio/iovdprintf.c16
-rw-r--r--libio/iovsprintf.c9
-rw-r--r--libio/iovsscanf.c7
-rw-r--r--libio/iovswscanf.c7
-rw-r--r--libio/obprintf.c15
-rw-r--r--libio/strops.c5
-rw-r--r--libio/vasprintf.c12
-rw-r--r--libio/vsnprintf.c7
-rw-r--r--libio/vswprintf.c5
-rw-r--r--libio/wgenops.c3
-rw-r--r--libio/wstrops.c5
-rw-r--r--stdio-common/vfprintf.c5
14 files changed, 48 insertions, 70 deletions
diff --git a/ChangeLog b/ChangeLog
index 2fac870..1f3d91c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,12 +5,22 @@
* elf/dl-load.c (fillin_rpath): In SUID binaries, don't mark
non-system-dirs in LD_LIBRARY_PATH as nonexisting, simply drop them.
- * libio/iovdprintf.c (_IO_vdprintf): Call __fsetlocking for temporary
- stream.
+ * libio/iovdprintf.c (_IO_vdprintf): Set _IO_USER_LOCK flag for
+ temporary stream. Don't define lock.
* libio/obprintf.c (_IO_obstack_vprintf): Likewise.
* libio/strops.c (_IO_str_init_static): Likewise.
* libio/vasprintf.c (_IO_vasprintf): Likewise.
* libio/wstrops.c (_IO_wstr_init_static): Likewise.
+ * libio/iovsprintf.c: Likewise.
+ * libio/iovsnprintf.c: Likewise.
+ * libio/iovswprintf.c: Likewise.
+ * libio/iovsscanf.c: Likewise.
+ * libio/iovswscanf.c: Likewise.
+ * stdio-common/vfprintf.c [USE_IN_LIBIO] (buffered_vfprintf): Likewise.
+ * libio/genops.c (_IO_no_init): Don't call _IO_lock_init if _lock
+ is NULL.
+ (_IO_default_finish): Likewise.
+ * libio/wgenops.c (_IO_wdefault_finish): Likewise.
2001-08-10 Andreas Jaeger <aj@suse.de>
diff --git a/libio/genops.c b/libio/genops.c
index f68912c..d786ebc 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -613,7 +613,8 @@ _IO_no_init (fp, flags, orientation, wd, jmp)
fp->_vtable_offset = 0;
#endif
#ifdef _IO_MTSAFE_IO
- _IO_lock_init (*fp->_lock);
+ if (fp->_lock != NULL)
+ _IO_lock_init (*fp->_lock);
#endif
fp->_mode = orientation;
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
@@ -669,7 +670,8 @@ _IO_default_finish (fp, dummy)
}
#ifdef _IO_MTSAFE_IO
- _IO_lock_fini (*fp->_lock);
+ if (fp->_lock != NULL)
+ _IO_lock_fini (*fp->_lock);
#endif
_IO_un_link ((struct _IO_FILE_plus *) fp);
@@ -682,7 +684,7 @@ _IO_default_seekoff (fp, offset, dir, mode)
int dir;
int mode;
{
- return _IO_pos_BAD;
+ return _IO_pos_BAD;
}
int
diff --git a/libio/iovdprintf.c b/libio/iovdprintf.c
index d7c656a..636259e 100644
--- a/libio/iovdprintf.c
+++ b/libio/iovdprintf.c
@@ -36,22 +36,19 @@ _IO_vdprintf (d, format, arg)
_IO_va_list arg;
{
struct _IO_FILE_plus tmpfil;
-#ifdef _IO_MTSAFE_IO
- _IO_lock_t lock;
-#endif
struct _IO_wide_data wd;
int done;
#ifdef _IO_MTSAFE_IO
- tmpfil.file._lock = &lock;
+ tmpfil.file._lock = NULL;
#endif
- _IO_no_init (&tmpfil.file, 0, 0, &wd, &_IO_wfile_jumps);
+ _IO_no_init (&tmpfil.file, _IO_USER_LOCK, 0, &wd, &_IO_wfile_jumps);
_IO_JUMPS (&tmpfil) = &_IO_file_jumps;
_IO_file_init (&tmpfil);
#if !_IO_UNIFIED_JUMPTABLES
tmpfil.vtable = NULL;
#endif
- if (_IO_file_attach ((_IO_FILE *) &tmpfil, d) == NULL)
+ if (_IO_file_attach (&tmpfil.file, d) == NULL)
{
_IO_un_link (&tmpfil);
return EOF;
@@ -60,13 +57,10 @@ _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);
+ done = _IO_vfprintf (&tmpfil.file, format, arg);
- _IO_FINISH ((_IO_FILE *) &tmpfil);
+ _IO_FINISH (&tmpfil.file);
return done;
}
diff --git a/libio/iovsprintf.c b/libio/iovsprintf.c
index 1921fe5..ac1d9bd 100644
--- a/libio/iovsprintf.c
+++ b/libio/iovsprintf.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
@@ -35,15 +35,12 @@ _IO_vsprintf (string, format, args)
_IO_va_list args;
{
_IO_strfile sf;
-#ifdef _IO_MTSAFE_IO
- _IO_lock_t lock;
-#endif
int ret;
#ifdef _IO_MTSAFE_IO
- sf._sbf._f._lock = &lock;
+ sf._sbf._f._lock = NULL;
#endif
- _IO_no_init (&sf._sbf._f, 0, -1, NULL, NULL);
+ _IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
_IO_JUMPS ((struct _IO_FILE_plus *) &sf._sbf) = &_IO_str_jumps;
_IO_str_init_static (&sf, string, -1, string);
ret = _IO_vfprintf ((_IO_FILE *) &sf._sbf, format, args);
diff --git a/libio/iovsscanf.c b/libio/iovsscanf.c
index 0f07304..2653b47 100644
--- a/libio/iovsscanf.c
+++ b/libio/iovsscanf.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
@@ -37,10 +37,9 @@ _IO_vsscanf (string, format, args)
int ret;
_IO_strfile sf;
#ifdef _IO_MTSAFE_IO
- _IO_lock_t lock;
- sf._sbf._f._lock = &lock;
+ sf._sbf._f._lock = NULL;
#endif
- _IO_no_init (&sf._sbf._f, 0, -1, NULL, NULL);
+ _IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
_IO_JUMPS ((struct _IO_FILE_plus *) &sf._sbf) = &_IO_str_jumps;
_IO_str_init_static (&sf, (char*)string, 0, NULL);
ret = _IO_vfscanf ((_IO_FILE *) &sf._sbf, format, args, NULL);
diff --git a/libio/iovswscanf.c b/libio/iovswscanf.c
index 0bcd291..dd7dbf8 100644
--- a/libio/iovswscanf.c
+++ b/libio/iovswscanf.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
@@ -39,10 +39,9 @@ vswscanf (string, format, args)
_IO_strfile sf;
struct _IO_wide_data wd;
#ifdef _IO_MTSAFE_IO
- _IO_lock_t lock;
- sf._sbf._f._lock = &lock;
+ sf._sbf._f._lock = NULL;
#endif
- _IO_no_init (&sf._sbf._f, 0, 0, &wd, &_IO_wstr_jumps);
+ _IO_no_init (&sf._sbf._f, _IO_USER_LOCK, 0, &wd, &_IO_wstr_jumps);
_IO_fwide (&sf._sbf._f, 1);
_IO_wstr_init_static (&sf._sbf._f, (wchar_t *)string, 0, NULL);
ret = _IO_vfwscanf ((_IO_FILE *) &sf._sbf, format, args, NULL);
diff --git a/libio/obprintf.c b/libio/obprintf.c
index c0f0e8c..9ef90bb 100644
--- a/libio/obprintf.c
+++ b/libio/obprintf.c
@@ -124,19 +124,16 @@ _IO_obstack_vprintf (struct obstack *obstack, const char *format, va_list args)
struct obstack_FILE
{
struct _IO_obstack_file ofile;
-#ifdef _IO_MTSAFE_IO
- _IO_lock_t lock;
-#endif
} new_f;
int result;
int size;
int room;
#ifdef _IO_MTSAFE_IO
- new_f.ofile.file.file._lock = &new_f.lock;
+ new_f.ofile.file.file._lock = NULL;
#endif
- _IO_no_init (&new_f.ofile.file.file, 0, -1, NULL, NULL);
+ _IO_no_init (&new_f.ofile.file.file, _IO_USER_LOCK, -1, NULL, NULL);
_IO_JUMPS (&new_f.ofile.file) = &_IO_obstack_jumps;
room = obstack_room (obstack);
size = obstack_object_size (obstack) + room;
@@ -156,7 +153,8 @@ _IO_obstack_vprintf (struct obstack *obstack, const char *format, va_list args)
assert (size != 0);
}
- _IO_str_init_static ((struct _IO_strfile_ *) &new_f.ofile, obstack_base (obstack),
+ _IO_str_init_static ((struct _IO_strfile_ *) &new_f.ofile,
+ obstack_base (obstack),
size, obstack_next_free (obstack));
/* Now allocate the rest of the current chunk. */
assert (size == (new_f.ofile.file.file._IO_write_end
@@ -167,11 +165,8 @@ _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);
+ result = _IO_vfprintf (&new_f.ofile.file.file, format, args);
/* Shrink the buffer to the space we really currently need. */
obstack_blank_fast (obstack, (new_f.ofile.file.file._IO_write_ptr
diff --git a/libio/strops.c b/libio/strops.c
index c3b6625..d679a0d 100644
--- a/libio/strops.c
+++ b/libio/strops.c
@@ -108,11 +108,6 @@ _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 8dda7d9..1cab485 100644
--- a/libio/vasprintf.c
+++ b/libio/vasprintf.c
@@ -43,9 +43,6 @@ _IO_vasprintf (result_ptr, format, args)
const _IO_size_t init_string_size = 100;
char *string;
_IO_strfile sf;
-#ifdef _IO_MTSAFE_IO
- _IO_lock_t lock;
-#endif
int ret;
_IO_size_t needed;
_IO_size_t allocated;
@@ -53,18 +50,15 @@ _IO_vasprintf (result_ptr, format, args)
if (string == NULL)
return -1;
#ifdef _IO_MTSAFE_IO
- sf._sbf._f._lock = &lock;
+ sf._sbf._f._lock = NULL;
#endif
- _IO_no_init ((_IO_FILE *) &sf._sbf, 0, -1, NULL, NULL);
+ _IO_no_init ((_IO_FILE *) &sf._sbf, _IO_USER_LOCK, -1, NULL, NULL);
_IO_JUMPS ((struct _IO_FILE_plus *) &sf._sbf) = &_IO_str_jumps;
_IO_str_init_static (&sf, string, init_string_size, string);
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);
+ ret = _IO_vfprintf (&sf._sbf._f, format, args);
if (ret < 0)
return ret;
/* Only use realloc if the size we need is of the same order of
diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c
index fe45c62..f356902 100644
--- a/libio/vsnprintf.c
+++ b/libio/vsnprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1997, 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
@@ -112,8 +112,7 @@ _IO_vsnprintf (string, maxlen, format, args)
_IO_strnfile sf;
int ret;
#ifdef _IO_MTSAFE_IO
- _IO_lock_t lock;
- sf.f._sbf._f._lock = &lock;
+ sf.f._sbf._f._lock = NULL;
#endif
/* We need to handle the special case where MAXLEN is 0. Use the
@@ -124,7 +123,7 @@ _IO_vsnprintf (string, maxlen, format, args)
maxlen = sizeof (sf.overflow_buf);
}
- _IO_no_init (&sf.f._sbf._f, 0, -1, NULL, NULL);
+ _IO_no_init (&sf.f._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
_IO_JUMPS ((struct _IO_FILE_plus *) &sf.f._sbf) = &_IO_strn_jumps;
string[0] = '\0';
_IO_str_init_static (&sf.f, string, maxlen - 1, string);
diff --git a/libio/vswprintf.c b/libio/vswprintf.c
index 00dc62c..6f2cf79 100644
--- a/libio/vswprintf.c
+++ b/libio/vswprintf.c
@@ -111,8 +111,7 @@ _IO_vswprintf (string, maxlen, format, args)
int ret;
struct _IO_wide_data wd;
#ifdef _IO_MTSAFE_IO
- _IO_lock_t lock;
- sf.f._sbf._f._lock = &lock;
+ sf.f._sbf._f._lock = NULL;
#endif
if (maxlen == 0)
@@ -120,7 +119,7 @@ _IO_vswprintf (string, maxlen, format, args)
length of zero always makes the function fail. */
return -1;
- _IO_no_init (&sf.f._sbf._f, 0, 0, &wd, &_IO_wstrn_jumps);
+ _IO_no_init (&sf.f._sbf._f, _IO_USER_LOCK, 0, &wd, &_IO_wstrn_jumps);
_IO_fwide (&sf.f._sbf._f, 1);
string[0] = L'\0';
_IO_wstr_init_static (&sf.f._sbf._f, string, maxlen - 1, string);
diff --git a/libio/wgenops.c b/libio/wgenops.c
index bfcef9e..f021e8a 100644
--- a/libio/wgenops.c
+++ b/libio/wgenops.c
@@ -210,7 +210,8 @@ _IO_wdefault_finish (fp, dummy)
}
#ifdef _IO_MTSAFE_IO
- _IO_lock_fini (*fp->_lock);
+ if (fp->_lock != NULL)
+ _IO_lock_fini (*fp->_lock);
#endif
_IO_un_link ((struct _IO_FILE_plus *) fp);
diff --git a/libio/wstrops.c b/libio/wstrops.c
index bfc71c2..0e90613 100644
--- a/libio/wstrops.c
+++ b/libio/wstrops.c
@@ -107,11 +107,6 @@ _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
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index f9c5062..9973e5e 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -2073,13 +2073,12 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format,
_IO_setp (hp, buf, buf + sizeof buf);
hp->_mode = -1;
#endif
- hp->_IO_file_flags = _IO_MAGIC|_IO_NO_READS;
+ hp->_IO_file_flags = _IO_MAGIC|_IO_NO_READS|_IO_USER_LOCK;
#if _IO_JUMPS_OFFSET
hp->_vtable_offset = 0;
#endif
#ifdef _IO_MTSAFE_IO
- hp->_lock = &helper.lock;
- __libc_lock_init (*hp->_lock);
+ hp->_lock = NULL;
#endif
_IO_JUMPS (&helper._f) = (struct _IO_jump_t *) &_IO_helper_jumps;