aboutsummaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
Diffstat (limited to 'libio')
-rw-r--r--libio/Makefile54
-rw-r--r--libio/fileops.c7
-rw-r--r--libio/fputc.c8
-rw-r--r--libio/fputwc.c8
-rw-r--r--libio/freopen.c6
-rw-r--r--libio/freopen64.c6
-rw-r--r--libio/fseek.c9
-rw-r--r--libio/fseeko.c8
-rw-r--r--libio/fseeko64.c8
-rw-r--r--libio/ftello.c8
-rw-r--r--libio/ftello64.c8
-rw-r--r--libio/fwide.c10
-rw-r--r--libio/getc.c9
-rw-r--r--libio/getchar.c9
-rw-r--r--libio/getwc.c9
-rw-r--r--libio/getwchar.c9
-rw-r--r--libio/iofclose.c6
-rw-r--r--libio/iofflush.c9
-rw-r--r--libio/iofgetpos.c8
-rw-r--r--libio/iofgetpos64.c8
-rw-r--r--libio/iofgets.c9
-rw-r--r--libio/iofgetws.c9
-rw-r--r--libio/iofputs.c6
-rw-r--r--libio/iofputws.c9
-rw-r--r--libio/iofread.c9
-rw-r--r--libio/iofsetpos.c9
-rw-r--r--libio/iofsetpos64.c9
-rw-r--r--libio/ioftell.c6
-rw-r--r--libio/iofwrite.c6
-rw-r--r--libio/iogetdelim.c8
-rw-r--r--libio/iogets.c9
-rw-r--r--libio/ioputs.c7
-rw-r--r--libio/ioseekoff.c8
-rw-r--r--libio/ioseekpos.c10
-rw-r--r--libio/iosetbuffer.c6
-rw-r--r--libio/iosetvbuf.c9
-rw-r--r--libio/ioungetc.c8
-rw-r--r--libio/ioungetwc.c9
-rw-r--r--libio/oldiofclose.c6
-rw-r--r--libio/oldiofgetpos.c9
-rw-r--r--libio/oldiofgetpos64.c9
-rw-r--r--libio/oldiofsetpos.c9
-rw-r--r--libio/oldiofsetpos64.c9
-rw-r--r--libio/peekc.c8
-rw-r--r--libio/putc.c9
-rw-r--r--libio/putchar.c9
-rw-r--r--libio/putwc.c9
-rw-r--r--libio/putwchar.c9
-rw-r--r--libio/rewind.c8
-rw-r--r--libio/wfileops.c7
50 files changed, 205 insertions, 249 deletions
diff --git a/libio/Makefile b/libio/Makefile
index ad2d5dda75..645448f9f1 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -75,10 +75,60 @@ CPPFLAGS += -D_IO_MTSAFE_IO
endif
# Support for exception handling.
-CFLAGS-genops.c = $(exceptions)
-CFLAGS-wgenops.c = $(exceptions)
CFLAGS-fileops.c = $(exceptions)
+CFLAGS-fputc.c = $(exceptions)
+CFLAGS-fputwc.c = $(exceptions)
+CFLAGS-freopen64.c = $(exceptions)
+CFLAGS-freopen.c = $(exceptions)
+CFLAGS-fseek.c = $(exceptions)
+CFLAGS-fseeko64.c = $(exceptions)
+CFLAGS-fseeko.c = $(exceptions)
+CFLAGS-ftello64.c = $(exceptions)
+CFLAGS-ftello.c = $(exceptions)
+CFLAGS-fwide.c = $(exceptions)
+CFLAGS-genops.c = $(exceptions)
+CFLAGS-getc.c = $(exceptions)
+CFLAGS-getchar.c = $(exceptions)
+CFLAGS-getwc.c = $(exceptions)
+CFLAGS-getwchar.c = $(exceptions)
+CFLAGS-iofclose.c = $(exceptions)
+CFLAGS-iofflush.c = $(exceptions)
+CFLAGS-iofgetpos64.c = $(exceptions)
+CFLAGS-iofgetpos.c = $(exceptions)
+CFLAGS-iofgets.c = $(exceptions)
+CFLAGS-iofgetws.c = $(exceptions)
+CFLAGS-iofputs.c = $(exceptions)
+CFLAGS-iofputws.c = $(exceptions)
+CFLAGS-iofread.c = $(exceptions)
+CFLAGS-iofsetpos64.c = $(exceptions)
+CFLAGS-iofsetpos.c = $(exceptions)
+CFLAGS-ioftell.c = $(exceptions)
+CFLAGS-iofwrite.c = $(exceptions)
+CFLAGS-iogetdelim.c = $(exceptions)
+CFLAGS-iogetline.c = $(exceptions)
+CFLAGS-iogets.c = $(exceptions)
+CFLAGS-iogetwline.c = $(exceptions)
+CFLAGS-ioputs.c = $(exceptions)
+CFLAGS-ioseekoff.c = $(exceptions)
+CFLAGS-ioseekpos.c = $(exceptions)
+CFLAGS-iosetbuffer.c = $(exceptions)
+CFLAGS-iosetvbuf.c = $(exceptions)
+CFLAGS-ioungetc.c = $(exceptions)
+CFLAGS-ioungetwc.c = $(exceptions)
+CFLAGS-oldfileops.c = $(exceptions)
+CFLAGS-oldiofclose.c = $(exceptions)
+CFLAGS-oldiofgetpos64.c = $(exceptions)
+CFLAGS-oldiofgetpos.c = $(exceptions)
+CFLAGS-oldiofsetpos64.c = $(exceptions)
+CFLAGS-oldiofsetpos.c = $(exceptions)
+CFLAGS-peekc.c = $(exceptions)
+CFLAGS-putc.c = $(exceptions)
+CFLAGS-putchar.c = $(exceptions)
+CFLAGS-putwc.c = $(exceptions)
+CFLAGS-putwchar.c = $(exceptions)
+CFLAGS-rewind.c = $(exceptions)
CFLAGS-wfileops.c = $(exceptions)
+CFLAGS-wgenops.c = $(exceptions)
# XXX Do we need filedoalloc and wfiledoalloc? Others?
CFLAGS-tst_putwc.c = -DOBJPFX=\"$(objpfx)\"
diff --git a/libio/fileops.c b/libio/fileops.c
index 0faf01f09f..4993630efc 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -562,16 +562,13 @@ _IO_new_file_underflow (fp)
traditional Unix systems did this for stdout. stderr better
not be line buffered. So we do just that here
explicitly. --drepper */
- _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
- _IO_stdout);
- _IO_flockfile (_IO_stdout);
+ _IO_acquire_lock (_IO_stdout);
if ((_IO_stdout->_flags & (_IO_LINKED | _IO_NO_WRITES | _IO_LINE_BUF))
== (_IO_LINKED | _IO_LINE_BUF))
_IO_OVERFLOW (_IO_stdout, EOF);
- _IO_funlockfile (_IO_stdout);
- _IO_cleanup_region_end (0);
+ _IO_release_lock (_IO_stdout);
#endif
}
diff --git a/libio/fputc.c b/libio/fputc.c
index 5ef048ff41..8fd0b8066c 100644
--- a/libio/fputc.c
+++ b/libio/fputc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1996, 1997, 1998, 2003 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,11 +35,9 @@ fputc (c, fp)
{
int result;
CHECK_FILE (fp, EOF);
- _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
- _IO_flockfile (fp);
+ _IO_acquire_lock (fp);
result = _IO_putc_unlocked (c, fp);
- _IO_funlockfile (fp);
- _IO_cleanup_region_end (0);
+ _IO_release_lock (fp);
return result;
}
diff --git a/libio/fputwc.c b/libio/fputwc.c
index 600d7307c7..8c749435a0 100644
--- a/libio/fputwc.c
+++ b/libio/fputwc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1996,1997,1998,1999,2003 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,13 +35,11 @@ fputwc (wc, fp)
{
int result;
CHECK_FILE (fp, EOF);
- _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
- _IO_flockfile (fp);
+ _IO_acquire_lock (fp);
if (_IO_fwide (fp, 1) < 0)
result = WEOF;
else
result = _IO_putwc_unlocked (wc, fp);
- _IO_funlockfile (fp);
- _IO_cleanup_region_end (0);
+ _IO_release_lock (fp);
return result;
}
diff --git a/libio/freopen.c b/libio/freopen.c
index cae9d307cd..d94a5629f1 100644
--- a/libio/freopen.c
+++ b/libio/freopen.c
@@ -44,8 +44,7 @@ freopen (filename, mode, fp)
CHECK_FILE (fp, NULL);
if (!(fp->_flags & _IO_IS_FILEBUF))
return NULL;
- _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
- _IO_flockfile (fp);
+ _IO_acquire_lock (fp);
if (filename == NULL && _IO_fileno (fp) >= 0)
{
fd = __dup (_IO_fileno (fp));
@@ -84,7 +83,6 @@ freopen (filename, mode, fp)
if (filename != NULL)
free ((char *) filename);
}
- _IO_funlockfile (fp);
- _IO_cleanup_region_end (0);
+ _IO_release_lock (fp);
return result;
}
diff --git a/libio/freopen64.c b/libio/freopen64.c
index d57994df05..f8da78c46e 100644
--- a/libio/freopen64.c
+++ b/libio/freopen64.c
@@ -44,8 +44,7 @@ freopen64 (filename, mode, fp)
CHECK_FILE (fp, NULL);
if (!(fp->_flags & _IO_IS_FILEBUF))
return NULL;
- _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
- _IO_flockfile (fp);
+ _IO_acquire_lock (fp);
if (filename == NULL && _IO_fileno (fp) >= 0)
{
fd = __dup (_IO_fileno (fp));
@@ -68,8 +67,7 @@ freopen64 (filename, mode, fp)
if (filename != NULL)
free ((char *) filename);
}
- _IO_funlockfile (fp);
- _IO_cleanup_region_end (0);
+ _IO_release_lock (fp);
return result;
#else
__set_errno (ENOSYS);
diff --git a/libio/fseek.c b/libio/fseek.c
index 831a4d497b..0515822e0e 100644
--- a/libio/fseek.c
+++ b/libio/fseek.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993,1995,1996,1997,1998,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1996, 1997, 1998, 2002, 2003
+ 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
@@ -36,11 +37,9 @@ fseek (fp, offset, whence)
{
int result;
CHECK_FILE (fp, -1);
- _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
- _IO_flockfile (fp);
+ _IO_acquire_lock (fp);
result = _IO_fseek (fp, offset, whence);
- _IO_funlockfile (fp);
- _IO_cleanup_region_end (0);
+ _IO_release_lock (fp);
return result;
}
libc_hidden_def (fseek)
diff --git a/libio/fseeko.c b/libio/fseeko.c
index 8087b957d2..d464c99502 100644
--- a/libio/fseeko.c
+++ b/libio/fseeko.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1995,1996,1997,1998,2003 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
@@ -36,10 +36,8 @@ fseeko (fp, offset, whence)
{
int result;
CHECK_FILE (fp, -1);
- _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
- _IO_flockfile (fp);
+ _IO_acquire_lock (fp);
result = _IO_fseek (fp, offset, whence);
- _IO_funlockfile (fp);
- _IO_cleanup_region_end (0);
+ _IO_release_lock (fp);
return result;
}
diff --git a/libio/fseeko64.c b/libio/fseeko64.c
index 149e70190f..5dbfc45bf0 100644
--- a/libio/fseeko64.c
+++ b/libio/fseeko64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1995,1996,1997,1998,2003 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
@@ -38,11 +38,9 @@ fseeko64 (fp, offset, whence)
#ifdef _G_LSEEK64
int result;
CHECK_FILE (fp, -1);
- _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
- _IO_flockfile (fp);
+ _IO_acquire_lock (fp);
result = _IO_fseek (fp, offset, whence);
- _IO_funlockfile (fp);
- _IO_cleanup_region_end (0);
+ _IO_release_lock (fp);
return result;
#else
__set_errno (ENOSYS);
diff --git a/libio/ftello.c b/libio/ftello.c
index e14866408f..4975a0bd73 100644
--- a/libio/ftello.c
+++ b/libio/ftello.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995-2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995-2001, 2002, 2003 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,16 +37,14 @@ ftello (fp)
{
_IO_off64_t pos;
CHECK_FILE (fp, -1L);
- _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, fp);
- _IO_flockfile (fp);
+ _IO_acquire_lock (fp);
pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
if (_IO_in_backup (fp))
{
if (fp->_mode <= 0)
pos -= fp->_IO_save_end - fp->_IO_save_base;
}
- _IO_funlockfile (fp);
- _IO_cleanup_region_end (0);
+ _IO_release_lock (fp);
if (pos == _IO_pos_BAD)
{
#ifdef EIO
diff --git a/libio/ftello64.c b/libio/ftello64.c
index b2da11d133..0275c0ca35 100644
--- a/libio/ftello64.c
+++ b/libio/ftello64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995-2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995-2001, 2002, 2003 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
@@ -38,16 +38,14 @@ ftello64 (fp)
#ifdef _G_LSEEK64
_IO_off64_t pos;
CHECK_FILE (fp, -1L);
- _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, fp);
- _IO_flockfile (fp);
+ _IO_acquire_lock (fp);
pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
if (_IO_in_backup (fp))
{
if (fp->_mode <= 0)
pos -= fp->_IO_save_end - fp->_IO_save_base;
}
- _IO_funlockfile (fp);
- _IO_cleanup_region_end (0);
+ _IO_release_lock (fp);
if (pos == _IO_pos_BAD)
{
#ifdef EIO
diff --git a/libio/fwide.c b/libio/fwide.c
index c435e5ec17..21214a901b 100644
--- a/libio/fwide.c
+++ b/libio/fwide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2003 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
@@ -44,13 +44,9 @@ fwide (fp, mode)
or the orientation already has been determined. */
return fp->_mode;
- _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
- _IO_flockfile (fp);
-
+ _IO_acquire_lock (fp);
result = _IO_fwide (fp, mode);
-
- _IO_funlockfile (fp);
- _IO_cleanup_region_end (0);
+ _IO_release_lock (fp);
return result;
}
diff --git a/libio/getc.c b/libio/getc.c
index a35dcb9f8d..9121e40c9d 100644
--- a/libio/getc.c
+++ b/libio/getc.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2003
+ 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
@@ -36,11 +37,9 @@ _IO_getc (fp)
{
int result;
CHECK_FILE (fp, EOF);
- _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
- _IO_flockfile (fp);
+ _IO_acquire_lock (fp);
result = _IO_getc_unlocked (fp);
- _IO_funlockfile (fp);
- _IO_cleanup_region_end (0);
+ _IO_release_lock (fp);
return result;
}