public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-11 16:36 [PATCH 0/6] Mostly mechanical libio decrufting Zack Weinberg
  2018-02-11 16:36 ` [PATCH 1/6] Remove vestiges of external build support from libio headers Zack Weinberg
@ 2018-02-11 16:36 ` Zack Weinberg
  2018-02-11 18:39   ` Andreas Schwab
                     ` (2 more replies)
  2018-02-11 16:36 ` [PATCH 6/6] Remove completely unused libio flag bits Zack Weinberg
                   ` (4 subsequent siblings)
  6 siblings, 3 replies; 29+ messages in thread
From: Zack Weinberg @ 2018-02-11 16:36 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, adhemerval.zanella

This patch eliminates a number of #if 0 and #ifdef TODO blocks, macros
that are never used, macros that provide portability to substrates that
lack basic things like EINVAL and off_t, and other such debris.

I preserved IO_DEBUG and CHECK_FILE, even though as far as I can tell
IO_DEBUG is never defined and therefore CHECK_FILE never does
anything, because it seems like we might actually want to turn it _on_.

	* libio/libio.h (_IO_pos_BAD, _IO_pos_0, _IO_pos_adjust):
	Define here, unconditionally.
	* libio/iolibio.h (_IO_pos_BAD): Don't define here.
	* libio/libioP.h: Remove #if 0 blocks.
	(_IO_pos_BAD, _IO_pos_0, _IO_pos_adjust): Don't define here.
	(_IO_va_start, COERCE_FILE, MAYBE_SET_EINVAL): Don't define.
	(CHECK_FILE): Don't use MAYBE_SET_EINVAL or COERCE_FILE.  Fix style.

	* libio/clearerr.c, libio/fputc.c, libio/getchar.c:
	Assume weak_alias is always defined.

	* libio/fileops.c, libio/genops.c, libio/oldfileops.c
	* libio/oldpclose.c, libio/pclose.c, libio/wfileops.c:
	Remove #if 0 and #ifdef TODO blocks.
	Assume text_set_element is always defined.

	* libio/iofdopen.c, libio/iogetdelim.c, libio/oldiofdopen.c
	Use __set_errno (EINVAL) instead of MAYBE_SET_EINVAL.
	* libio/tst-mmap-eofsync.c: Make #if 1 block unconditional.
---
 libio/clearerr.c         |   2 +-
 libio/fileops.c          |  18 --------
 libio/fputc.c            |   2 +-
 libio/genops.c           | 116 +----------------------------------------------
 libio/getchar.c          |   2 +-
 libio/iofdopen.c         |   4 +-
 libio/iogetdelim.c       |   2 +-
 libio/iolibio.h          |   3 --
 libio/libio.h            |   8 ++++
 libio/libioP.h           |  49 ++++----------------
 libio/oldfileops.c       |   9 ----
 libio/oldiofdopen.c      |   2 +-
 libio/oldpclose.c        |   8 +---
 libio/pclose.c           |   8 +---
 libio/tst-mmap-eofsync.c |   2 -
 libio/wfileops.c         |   5 --
 libio/wgenops.c          |  34 --------------
 stdio-common/vfprintf.c  |   2 +-
 stdio-common/vfscanf.c   |   2 +-
 19 files changed, 32 insertions(+), 246 deletions(-)

diff --git a/libio/clearerr.c b/libio/clearerr.c
index 5d29fc500a0..77ac552fac1 100644
--- a/libio/clearerr.c
+++ b/libio/clearerr.c
@@ -27,6 +27,6 @@ clearerr (FILE *fp)
   _IO_funlockfile (fp);
 }
 
-#if defined weak_alias && !defined _IO_MTSAFE_IO
+#ifndef _IO_MTSAFE_IO
 weak_alias (clearerr, clearerr_unlocked)
 #endif
diff --git a/libio/fileops.c b/libio/fileops.c
index fb39bec63cd..618c0d5c311 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -468,11 +468,6 @@ int
 _IO_new_file_underflow (FILE *fp)
 {
   ssize_t count;
-#if 0
-  /* SysV does not make this test; take it out for compatibility */
-  if (fp->_flags & _IO_EOF_SEEN)
-    return (EOF);
-#endif
 
   if (fp->_flags & _IO_NO_READS)
     {
@@ -494,13 +489,9 @@ _IO_new_file_underflow (FILE *fp)
       _IO_doallocbuf (fp);
     }
 
-  /* Flush all line buffered files before reading. */
   /* FIXME This can/should be moved to genops ?? */
   if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
     {
-#if 0
-      _IO_flush_all_linebuffered ();
-#else
       /* We used to flush all line-buffered stream.  This really isn't
 	 required by any standard.  My recollection is that
 	 traditional Unix systems did this for stdout.  stderr better
@@ -513,7 +504,6 @@ _IO_new_file_underflow (FILE *fp)
 	_IO_OVERFLOW (_IO_stdout, EOF);
 
       _IO_release_lock (_IO_stdout);
-#endif
     }
 
   _IO_switch_to_get_mode (fp);
@@ -813,10 +803,6 @@ _IO_new_file_sync (FILE *fp)
   delta = fp->_IO_read_ptr - fp->_IO_read_end;
   if (delta != 0)
     {
-#ifdef TODO
-      if (_IO_in_backup (fp))
-	delta -= eGptr () - Gbase ();
-#endif
       off64_t new_pos = _IO_SYSSEEK (fp, delta, 1);
       if (new_pos != (off64_t) EOF)
 	fp->_IO_read_end = fp->_IO_read_ptr;
@@ -838,10 +824,6 @@ _IO_file_sync_mmap (FILE *fp)
 {
   if (fp->_IO_read_ptr != fp->_IO_read_end)
     {
-#ifdef TODO
-      if (_IO_in_backup (fp))
-	delta -= eGptr () - Gbase ();
-#endif
       if (__lseek64 (fp->_fileno, fp->_IO_read_ptr - fp->_IO_buf_base,
 		     SEEK_SET)
 	  != fp->_IO_read_ptr - fp->_IO_buf_base)
diff --git a/libio/fputc.c b/libio/fputc.c
index 13b3b84a769..1e743eb74c9 100644
--- a/libio/fputc.c
+++ b/libio/fputc.c
@@ -40,7 +40,7 @@ fputc (int c, FILE *fp)
   return result;
 }
 
-#if defined weak_alias && !defined _IO_MTSAFE_IO
+#ifndef _IO_MTSAFE_IO
 #undef fputc_unlocked
 weak_alias (fputc, fputc_unlocked)
 #endif
diff --git a/libio/genops.c b/libio/genops.c
index 2b820c86d20..2fec221b997 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -194,24 +194,6 @@ _IO_free_backup_area (FILE *fp)
 }
 libc_hidden_def (_IO_free_backup_area)
 
-#if 0
-int
-_IO_switch_to_put_mode (FILE *fp)
-{
-  fp->_IO_write_base = fp->_IO_read_ptr;
-  fp->_IO_write_ptr = fp->_IO_read_ptr;
-  /* Following is wrong if line- or un-buffered? */
-  fp->_IO_write_end = (fp->_flags & _IO_IN_BACKUP
-		       ? fp->_IO_read_end : fp->_IO_buf_end);
-
-  fp->_IO_read_ptr = fp->_IO_read_end;
-  fp->_IO_read_base = fp->_IO_read_end;
-
-  fp->_flags |= _IO_CURRENTLY_PUTTING;
-  return 0;
-}
-#endif
-
 int
 __overflow (FILE *f, int ch)
 {
@@ -465,15 +447,6 @@ _IO_default_xsgetn (FILE *fp, void *data, size_t n)
 }
 libc_hidden_def (_IO_default_xsgetn)
 
-#if 0
-/* Seems not to be needed. --drepper */
-int
-_IO_sync (FILE *fp)
-{
-  return 0;
-}
-#endif
-
 FILE *
 _IO_default_setbuf (FILE *fp, char *p, ssize_t len)
 {
@@ -697,28 +670,6 @@ _IO_sungetc (FILE *fp)
   return result;
 }
 
-#if 0 /* Work in progress */
-/* Seems not to be needed.  */
-#if 0
-void
-_IO_set_column (FILE *fp, int c)
-{
-  if (c == -1)
-    fp->_column = -1;
-  else
-    fp->_column = c - (fp->_IO_write_ptr - fp->_IO_write_base);
-}
-#else
-int
-_IO_set_column (FILE *fp, int i)
-{
-  fp->_cur_column = i + 1;
-  return 0;
-}
-#endif
-#endif
-
-
 unsigned
 _IO_adjust_column (unsigned start, const char *line, int count)
 {
@@ -730,20 +681,6 @@ _IO_adjust_column (unsigned start, const char *line, int count)
 }
 libc_hidden_def (_IO_adjust_column)
 
-#if 0
-/* Seems not to be needed. --drepper */
-int
-_IO_get_column (FILE *fp)
-{
-  if (fp->_cur_column)
-    return _IO_adjust_column (fp->_cur_column - 1,
-			      fp->_IO_write_base,
-			      fp->_IO_write_ptr - fp->_IO_write_base);
-  return -1;
-}
-#endif
-
-
 int
 _IO_flush_all_lockp (int do_lock)
 {
@@ -964,10 +901,8 @@ _IO_remove_marker (struct _IO_marker *marker)
 	  return;
 	}
     }
-#if 0
-    if _sbuf has a backup area that is no longer needed, should we delete
-    it now, or wait until the next underflow?
-#endif
+  /* FIXME: if _sbuf has a backup area that is no longer needed,
+     should we delete it now, or wait until the next underflow? */
 }
 
 #define BAD_DELTA EOF
@@ -1018,20 +953,6 @@ _IO_unsave_markers (FILE *fp)
   struct _IO_marker *mark = fp->_markers;
   if (mark)
     {
-#ifdef TODO
-      streampos offset = seekoff (0, ios::cur, ios::in);
-      if (offset != EOF)
-	{
-	  offset += eGptr () - Gbase ();
-	  for ( ; mark != NULL; mark = mark->_next)
-	    mark->set_streampos (mark->_pos + offset);
-	}
-    else
-      {
-	for ( ; mark != NULL; mark = mark->_next)
-	  mark->set_streampos (EOF);
-      }
-#endif
       fp->_markers = 0;
     }
 
@@ -1040,19 +961,6 @@ _IO_unsave_markers (FILE *fp)
 }
 libc_hidden_def (_IO_unsave_markers)
 
-#if 0
-/* Seems not to be needed. --drepper */
-int
-_IO_nobackup_pbackfail (FILE *fp, int c)
-{
-  if (fp->_IO_read_ptr > fp->_IO_read_base)
-	fp->_IO_read_ptr--;
-  if (c != EOF && *fp->_IO_read_ptr != c)
-      *fp->_IO_read_ptr = c;
-  return (unsigned char) c;
-}
-#endif
-
 int
 _IO_default_pbackfail (FILE *fp, int c)
 {
@@ -1200,24 +1108,4 @@ _IO_list_resetlock (void)
 }
 libc_hidden_def (_IO_list_resetlock)
 
-
-#ifdef TODO
-#if defined(linux)
-#define IO_CLEANUP ;
-#endif
-
-#ifdef IO_CLEANUP
-  IO_CLEANUP
-#else
-struct __io_defs {
-    __io_defs() { }
-    ~__io_defs() { _IO_cleanup (); }
-};
-__io_defs io_defs__;
-#endif
-
-#endif /* TODO */
-
-#ifdef text_set_element
 text_set_element(__libc_atexit, _IO_cleanup);
-#endif
diff --git a/libio/getchar.c b/libio/getchar.c
index 8f8555f8c1e..0e3f4153c89 100644
--- a/libio/getchar.c
+++ b/libio/getchar.c
@@ -41,7 +41,7 @@ getchar (void)
   return result;
 }
 
-#if defined weak_alias && !defined _IO_MTSAFE_IO
+#ifndef _IO_MTSAFE_IO
 #undef getchar_unlocked
 weak_alias (getchar, getchar_unlocked)
 #endif
diff --git a/libio/iofdopen.c b/libio/iofdopen.c
index 21a53e30f6c..1f20eacb256 100644
--- a/libio/iofdopen.c
+++ b/libio/iofdopen.c
@@ -62,7 +62,7 @@ _IO_new_fdopen (int fd, const char *mode)
       read_write = _IO_NO_READS|_IO_IS_APPENDING;
       break;
     default:
-      MAYBE_SET_EINVAL;
+      __set_errno (EINVAL);
       return NULL;
   }
   for (i = 1; i < 5; ++i)
@@ -92,7 +92,7 @@ _IO_new_fdopen (int fd, const char *mode)
   if (((fd_flags & O_ACCMODE) == O_RDONLY && !(read_write & _IO_NO_WRITES))
       || ((fd_flags & O_ACCMODE) == O_WRONLY && !(read_write & _IO_NO_READS)))
     {
-      MAYBE_SET_EINVAL;
+      __set_errno (EINVAL);
       return NULL;
     }
 
diff --git a/libio/iogetdelim.c b/libio/iogetdelim.c
index f5b0991be8c..4f3ce5ed62c 100644
--- a/libio/iogetdelim.c
+++ b/libio/iogetdelim.c
@@ -45,7 +45,7 @@ _IO_getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
 
   if (lineptr == NULL || n == NULL)
     {
-      MAYBE_SET_EINVAL;
+      __set_errno (EINVAL);
       return -1;
     }
   CHECK_FILE (fp, -1);
diff --git a/libio/iolibio.h b/libio/iolibio.h
index ceaa33a44bb..69e1c0e699c 100644
--- a/libio/iolibio.h
+++ b/libio/iolibio.h
@@ -59,9 +59,6 @@ struct obstack;
 extern int _IO_obstack_vprintf (struct obstack *, const char *, __gnuc_va_list)
        __THROW;
 extern int _IO_obstack_printf (struct obstack *, const char *, ...) __THROW;
-#ifndef _IO_pos_BAD
-#define _IO_pos_BAD ((off64_t)(-1))
-#endif
 #define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
 #define _IO_fseek(__fp, __offset, __whence) \
   (_IO_seekoff_unlocked (__fp, __offset, __whence, _IOS_INPUT|_IOS_OUTPUT) \
diff --git a/libio/libio.h b/libio/libio.h
index d1516185667..1371161e025 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -124,6 +124,14 @@ typedef union
 #define _IO_DONT_CLOSE 0100000
 #define _IO_BOOLALPHA 0200000
 
+/* _IO_pos_BAD is an off64_t value indicating error, unknown, or EOF. */
+#define _IO_pos_BAD ((off64_t) -1)
+
+/* _IO_pos_adjust adjust an off64_t by some number of bytes. */
+#define _IO_pos_adjust(pos, delta) ((pos) += (delta))
+
+/* _IO_pos_0 is an off64_t value indicating beginning of file. */
+#define _IO_pos_0 ((off64_t) 0)
 
 struct _IO_jump_t;
 
diff --git a/libio/libioP.h b/libio/libioP.h
index ee23296ddba..8afe7032e3f 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -309,10 +309,6 @@ struct _IO_jump_t
     JUMP_FIELD(_IO_stat_t, __stat);
     JUMP_FIELD(_IO_showmanyc_t, __showmanyc);
     JUMP_FIELD(_IO_imbue_t, __imbue);
-#if 0
-    get_column;
-    set_column;
-#endif
 };
 
 /* We always allocate an extra word following an _IO_FILE.
@@ -710,19 +706,6 @@ extern off64_t _IO_seekpos_unlocked (FILE *, off64_t, int)
 
 extern int _IO_vscanf (const char *, va_list) __THROW;
 
-/* _IO_pos_BAD is an off64_t value indicating error, unknown, or EOF. */
-#ifndef _IO_pos_BAD
-# define _IO_pos_BAD ((off64_t) -1)
-#endif
-/* _IO_pos_adjust adjust an off64_t by some number of bytes. */
-#ifndef _IO_pos_adjust
-# define _IO_pos_adjust(pos, delta) ((pos) += (delta))
-#endif
-/* _IO_pos_0 is an off64_t value indicating beginning of file. */
-#ifndef _IO_pos_0
-# define _IO_pos_0 ((off64_t) 0)
-#endif
-
 #ifdef _IO_MTSAFE_IO
 /* check following! */
 # ifdef _IO_USE_OLD_IO_FILE
@@ -752,33 +735,19 @@ extern int _IO_vscanf (const char *, va_list) __THROW;
 # endif
 #endif
 
-#define _IO_va_start(args, last) va_start(args, last)
-
 extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
 
-#if 1
-# define COERCE_FILE(FILE) /* Nothing */
-#else
-/* This is part of the kludge for binary compatibility with old stdio. */
-# define COERCE_FILE(FILE) \
-  (((FILE)->_flags & _IO_MAGIC_MASK) == _OLD_MAGIC_MASK \
-    && (FILE) = *(FILE**)&((int*)fp)[1])
-#endif
-
-#ifdef EINVAL
-# define MAYBE_SET_EINVAL __set_errno (EINVAL)
-#else
-# define MAYBE_SET_EINVAL /* nothing */
-#endif
-
 #ifdef IO_DEBUG
-# define CHECK_FILE(FILE, RET) \
-	if ((FILE) == NULL) { MAYBE_SET_EINVAL; return RET; } \
-	else { COERCE_FILE(FILE); \
-	       if (((FILE)->_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
-	  { MAYBE_SET_EINVAL; return RET; }}
+# define CHECK_FILE(FILE, RET) do {			\
+    if ((FILE) == NULL ||				\
+	((FILE)->_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
+      {							\
+	__set_errno (EINVAL);				\
+	return RET;					\
+      }							\
+  } while (0)
 #else
-# define CHECK_FILE(FILE, RET) COERCE_FILE (FILE)
+# define CHECK_FILE(FILE, RET) do { } while (0)
 #endif
 
 static inline void
diff --git a/libio/oldfileops.c b/libio/oldfileops.c
index 5a0f246411c..b53dcacbbc7 100644
--- a/libio/oldfileops.c
+++ b/libio/oldfileops.c
@@ -294,11 +294,6 @@ attribute_compat_text_section
 _IO_old_file_underflow (FILE *fp)
 {
   ssize_t count;
-#if 0
-  /* SysV does not make this test; take it out for compatibility */
-  if (fp->_flags & _IO_EOF_SEEN)
-    return (EOF);
-#endif
 
   if (fp->_flags & _IO_NO_READS)
     {
@@ -516,10 +511,6 @@ _IO_old_file_seekoff (FILE *fp, off64_t offset, int dir, int mode)
 			      + (fp->_IO_read_end - fp->_IO_read_base));
       if (rel_offset >= 0)
 	{
-#if 0
-	  if (_IO_in_backup (fp))
-	    _IO_switch_to_main_get_area (fp);
-#endif
 	  if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
 	    {
 	      _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset,
diff --git a/libio/oldiofdopen.c b/libio/oldiofdopen.c
index 17930c2786f..cec6642fc40 100644
--- a/libio/oldiofdopen.c
+++ b/libio/oldiofdopen.c
@@ -60,7 +60,7 @@ _IO_old_fdopen (int fd, const char *mode)
       read_write = _IO_NO_READS|_IO_IS_APPENDING;
       break;
     default:
-      MAYBE_SET_EINVAL;
+      __set_errno (EINVAL);
       return NULL;
   }
   if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+'))
diff --git a/libio/oldpclose.c b/libio/oldpclose.c
index f02a05fc376..d2975206a3d 100644
--- a/libio/oldpclose.c
+++ b/libio/oldpclose.c
@@ -32,16 +32,12 @@
 #include "stdio.h"
 #include <errno.h>
 
+/* Does not actually test that stream was created by popen(). Instead,
+   it depends on the filebuf::sys_close() virtual to Do The Right Thing. */
 int
 attribute_compat_text_section
 __old_pclose (FILE *fp)
 {
-#if 0
-  /* Does not actually test that stream was created by popen(). Instead,
-     it depends on the filebuf::sys_close() virtual to Do The Right Thing. */
-  if (fp is not a proc_file)
-    return -1;
-#endif
   return _IO_old_fclose (fp);
 }
 
diff --git a/libio/pclose.c b/libio/pclose.c
index 74851b55ba3..052efaa31ed 100644
--- a/libio/pclose.c
+++ b/libio/pclose.c
@@ -29,15 +29,11 @@
 #include <errno.h>
 #include <shlib-compat.h>
 
+/* Does not actually test that stream was created by popen(). Instead,
+   it depends on the filebuf::sys_close() virtual to Do The Right Thing. */
 int
 __new_pclose (FILE *fp)
 {
-#if 0
-  /* Does not actually test that stream was created by popen(). Instead,
-     it depends on the filebuf::sys_close() virtual to Do The Right Thing. */
-  if (fp is not a proc_file)
-    return -1;
-#endif
   return _IO_new_fclose (fp);
 }
 
diff --git a/libio/tst-mmap-eofsync.c b/libio/tst-mmap-eofsync.c
index e8ef7271489..0c568e8eb5e 100644
--- a/libio/tst-mmap-eofsync.c
+++ b/libio/tst-mmap-eofsync.c
@@ -60,7 +60,6 @@ do_test (void)
   printf ("feof = %d, ferror = %d immediately after fgets\n",
 	  feof (f), ferror (f));
 
-#if 1
   c = fgetc (f);
   if (c == EOF)
     printf ("fgetc -> EOF (feof = %d, ferror = %d)\n",
@@ -71,7 +70,6 @@ do_test (void)
 	      c, feof (f), ferror (f));
       result = 1;
     }
-#endif
 
   c = write (temp_fd, text2, sizeof text2 - 1);
   if (c == sizeof text2 - 1)
diff --git a/libio/wfileops.c b/libio/wfileops.c
index aecbf0d86d7..8bb4fd78c9f 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -196,13 +196,9 @@ _IO_wfile_underflow (FILE *fp)
       _IO_wdoallocbuf (fp);
     }
 
-  /* Flush all line buffered files before reading. */
   /* FIXME This can/should be moved to genops ?? */
   if (fp->_flags & (_IO_LINE_BUF | _IO_UNBUFFERED))
     {
-#if 0
-      _IO_flush_all_linebuffered ();
-#else
       /* We used to flush all line-buffered stream.  This really isn't
 	 required by any standard.  My recollection is that
 	 traditional Unix systems did this for stdout.  stderr better
@@ -215,7 +211,6 @@ _IO_wfile_underflow (FILE *fp)
 	_IO_OVERFLOW (_IO_stdout, EOF);
 
       _IO_release_lock (_IO_stdout);
-#endif
     }
 
   _IO_switch_to_get_mode (fp);
diff --git a/libio/wgenops.c b/libio/wgenops.c
index 2d61bc96524..a2413ec20a2 100644
--- a/libio/wgenops.c
+++ b/libio/wgenops.c
@@ -426,26 +426,6 @@ _IO_free_wbackup_area (FILE *fp)
 }
 libc_hidden_def (_IO_free_wbackup_area)
 
-#if 0
-int
-_IO_switch_to_wput_mode (FILE *fp)
-{
-  fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_read_ptr;
-  fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_read_ptr;
-  /* Following is wrong if line- or un-buffered? */
-  fp->_wide_data->_IO_write_end = (fp->_flags & _IO_IN_BACKUP
-				   ? fp->_wide_data->_IO_read_end
-				   : fp->_wide_data->_IO_buf_end);
-
-  fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
-  fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_end;
-
-  fp->_flags |= _IO_CURRENTLY_PUTTING;
-  return 0;
-}
-#endif
-
-
 static int
 save_for_wbackup (FILE *fp, wchar_t *end_p)
 {
@@ -624,20 +604,6 @@ _IO_unsave_wmarkers (FILE *fp)
   struct _IO_marker *mark = fp->_markers;
   if (mark)
     {
-#ifdef TODO
-      streampos offset = seekoff (0, ios::cur, ios::in);
-      if (offset != EOF)
-	{
-	  offset += eGptr () - Gbase ();
-	  for ( ; mark != NULL; mark = mark->_next)
-	    mark->set_streampos (mark->_pos + offset);
-	}
-    else
-      {
-	for ( ; mark != NULL; mark = mark->_next)
-	  mark->set_streampos (EOF);
-      }
-#endif
       fp->_markers = 0;
     }
 
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 8f0a6f8cf28..ae412e4b844 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -58,7 +58,7 @@
 	}								      \
       if (Format == NULL)						      \
 	{								      \
-	  MAYBE_SET_EINVAL;						      \
+	  __set_errno (EINVAL);						      \
 	  return -1;							      \
 	}								      \
     } while (0)
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index a519a57b8fd..3263268c7ea 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -172,7 +172,7 @@
 	}								      \
       else if (format == NULL)						      \
 	{								      \
-	  MAYBE_SET_EINVAL;						      \
+	  __set_errno (EINVAL);						      \
 	  return EOF;							      \
 	}								      \
     } while (0)
-- 
2.16.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH 2/6] Mechanically remove _IO_ name aliases for types and constants.
  2018-02-11 16:36 [PATCH 0/6] Mostly mechanical libio decrufting Zack Weinberg
                   ` (2 preceding siblings ...)
  2018-02-11 16:36 ` [PATCH 6/6] Remove completely unused libio flag bits Zack Weinberg
@ 2018-02-11 16:36 ` Zack Weinberg
  2018-02-11 17:57   ` Andreas Schwab
  2018-02-11 17:45 ` [PATCH 3/6] Remove legacy configuration knobs from libio Zack Weinberg
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 29+ messages in thread
From: Zack Weinberg @ 2018-02-11 16:36 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, adhemerval.zanella

This patch mechanically removes all remaining uses, and the
definitions, of the following libio name aliases:

 name                         replaced with
 ----                         -------------
 _IO_FILE                     FILE
 _IO_fpos_t                   __fpos_t
 _IO_fpos64_t                 __fpos64_t
 _IO_size_t                   size_t
 _IO_ssize_t                  ssize_t or __ssize_t
 _IO_off_t                    off_t
 _IO_off64_t                  off64_t
 _IO_pid_t                    pid_t
 _IO_uid_t                    uid_t
 _IO_wint_t                   wint_t
 _IO_va_list                  va_list or __gnuc_va_list
 _IO_BUFSIZ                   BUFSIZ
 _IO_cookie_io_functions_t    cookie_io_functions_t
 __io_read_fn                 cookie_read_function_t
 __io_write_fn                cookie_write_function_t
 __io_seek_fn                 cookie_seek_function_t
 __io_close_fn                cookie_close_function_t

I used __fpos_t and __fpos64_t instead of fpos_t and fpos64_t because
the definitions of fpos_t and fpos64_t depend on the largefile mode.
I used __ssize_t and __gnuc_va_list in a handful of headers where
namespace cleanliness might be relevant even though they're
internal-use-only.  In all other cases, I used the public-namespace
name.

There are a tiny handful of places where I left a use of 'struct _IO_FILE'
alone, because it was being used together with 'struct _IO_FILE_plus'
or 'struct _IO_FILE_complete' in the same arithmetic expression.

Because this patch was almost entirely done with search and replace, I
may have introduced indentation botches.  I did proofread the diff,
but I may have missed something.

The ChangeLog below calls out all of the places where this was not a
pure search-and-replace change.

	* libio/libio.h (_IO_FILE): Delete; all uses changed to FILE.
	(_IO_fpos_t): Delete; all uses changed to __fpos_t.
	(_IO_fpos64_t): Delete; all uses changed to __fpos64_t.
	(_IO_size_t): Delete; all uses changed to size_t.
	(_IO_ssize_t): Delete; all uses changed to ssize_t or __ssize_t.
	(_IO_off_t): Delete; all uses changed to off_t.
	(_IO_off64_t): Delete; all uses changed to off64_t.
	(_IO_pid_t): Delete; all uses changed to pid_t.
	(_IO_uid_t): Delete; all uses changed to uid_t.
	(_IO_wint_t): Delete; all uses changed to wint_t.
	(_IO_va_list): Delete; all uses changed to va_list or __gnuc_va_list.
	(_IO_BUFSIZ): Delete; all uses changed to BUFSIZ.
	(_IO_cookie_io_functions_t): Delete; all uses changed to
	cookie_io_functions_t.
	(__io_read_fn): Delete; all uses changed to cookie_read_function_t.
	(__io_write_fn): Delete; all uses changed to cookie_write_function_t.
	(__io_seek_fn): Delete; all uses changed to cookie_seek_function_t.
	(__io_close_fn): Delete: all uses changed to cookie_close_function_t.

	* libio/iofopncook.c: Remove unnecessary forward declarations.
	* libio/iolibio.h: Correct outdated commentary.
	* malloc/malloc.c (__malloc_stats): Remove unnecessary casts.
	* stdio-common/fxprintf.c (__fxprintf_nocancel):
	Remove unnecessary casts.
	* stdio-common/getline.c: Use _IO_getdelim directly.
	Don't redefine ssize_t.
	* stdio-common/printf_fp.c, stdio_common/printf_fphex.c
	* stdio-common/printf_size.c: Don't redefine size_t or FILE.
	Remove outdated comments.
	* stdio-common/vfscanf.c: Don't redefine va_list.
---
 debug/fgets_chk.c                          |   4 +-
 debug/fgets_u_chk.c                        |   4 +-
 debug/fgetws_chk.c                         |   4 +-
 debug/fgetws_u_chk.c                       |   4 +-
 debug/gets_chk.c                           |   2 +-
 debug/vasprintf_chk.c                      |   6 +-
 debug/vsprintf_chk.c                       |   4 +-
 debug/vswprintf_chk.c                      |   2 +-
 hurd/fopenport.c                           |   2 +-
 include/stdio.h                            |  16 +-
 libio/feof.c                               |   2 +-
 libio/feof_u.c                             |   2 +-
 libio/ferror.c                             |   2 +-
 libio/ferror_u.c                           |   2 +-
 libio/filedoalloc.c                        |   8 +-
 libio/fileno.c                             |   2 +-
 libio/fileops.c                            | 151 ++++++------
 libio/fmemopen.c                           |   8 +-
 libio/fputc.c                              |   2 +-
 libio/fputc_u.c                            |   2 +-
 libio/fputwc.c                             |   2 +-
 libio/fputwc_u.c                           |   2 +-
 libio/fseek.c                              |   2 +-
 libio/fseeko.c                             |   2 +-
 libio/fseeko64.c                           |   2 +-
 libio/ftello.c                             |   6 +-
 libio/ftello64.c                           |   4 +-
 libio/fwide.c                              |   2 +-
 libio/genops.c                             | 176 +++++++-------
 libio/iofclose.c                           |   2 +-
 libio/iofdopen.c                           |   4 +-
 libio/iofflush.c                           |   2 +-
 libio/iofflush_u.c                         |   2 +-
 libio/iofgetpos.c                          |   6 +-
 libio/iofgetpos64.c                        |   4 +-
 libio/iofgets.c                            |   4 +-
 libio/iofgets_u.c                          |   4 +-
 libio/iofgetws.c                           |   4 +-
 libio/iofgetws_u.c                         |   4 +-
 libio/iofopen.c                            |  10 +-
 libio/iofopen64.c                          |   2 +-
 libio/iofopncook.c                         |  63 ++---
 libio/iofputs.c                            |   4 +-
 libio/iofputs_u.c                          |   4 +-
 libio/iofputws.c                           |   4 +-
 libio/iofputws_u.c                         |   4 +-
 libio/iofread.c                            |   8 +-
 libio/iofread_u.c                          |   8 +-
 libio/iofsetpos.c                          |   2 +-
 libio/iofsetpos64.c                        |   2 +-
 libio/ioftell.c                            |   6 +-
 libio/iofwide.c                            |   6 +-
 libio/iofwrite.c                           |   8 +-
 libio/iofwrite_u.c                         |   9 +-
 libio/iogetdelim.c                         |  12 +-
 libio/iogetline.c                          |  14 +-
 libio/iogets.c                             |   2 +-
 libio/iogetwline.c                         |  14 +-
 libio/iolibio.h                            |  82 +++----
 libio/iopadn.c                             |   8 +-
 libio/iopopen.c                            |  20 +-
 libio/ioputs.c                             |   2 +-
 libio/ioseekoff.c                          |  10 +-
 libio/ioseekpos.c                          |  10 +-
 libio/iosetbuffer.c                        |   2 +-
 libio/iosetvbuf.c                          |   2 +-
 libio/ioungetc.c                           |   2 +-
 libio/ioungetwc.c                          |   2 +-
 libio/iovdprintf.c                         |   2 +-
 libio/iovsprintf.c                         |   2 +-
 libio/iovsscanf.c                          |   2 +-
 libio/iovswscanf.c                         |   4 +-
 libio/iowpadn.c                            |   8 +-
 libio/libio.h                              |  98 +++-----
 libio/libioP.h                             | 376 ++++++++++++++---------------
 libio/memstream.c                          |  20 +-
 libio/obprintf.c                           |   6 +-
 libio/oldfileops.c                         |  74 +++---
 libio/oldfmemopen.c                        |   6 +-
 libio/oldiofclose.c                        |   2 +-
 libio/oldiofdopen.c                        |   4 +-
 libio/oldiofgetpos.c                       |   4 +-
 libio/oldiofgetpos64.c                     |   4 +-
 libio/oldiofopen.c                         |   6 +-
 libio/oldiofsetpos.c                       |   2 +-
 libio/oldiofsetpos64.c                     |   2 +-
 libio/oldiopopen.c                         |  18 +-
 libio/oldstdfiles.c                        |   6 +-
 libio/peekc.c                              |   2 +-
 libio/putc.c                               |   2 +-
 libio/putc_u.c                             |   2 +-
 libio/putwc.c                              |   2 +-
 libio/putwc_u.c                            |   2 +-
 libio/rewind.c                             |   2 +-
 libio/setbuf.c                             |   4 +-
 libio/setlinebuf.c                         |   2 +-
 libio/stdio.c                              |   6 +-
 libio/strfile.h                            |   5 +-
 libio/strops.c                             |  50 ++--
 libio/vasprintf.c                          |   8 +-
 libio/vscanf.c                             |   2 +-
 libio/vsnprintf.c                          |   8 +-
 libio/vswprintf.c                          |  10 +-
 libio/vwscanf.c                            |   2 +-
 libio/wfiledoalloc.c                       |   4 +-
 libio/wfileops.c                           |  46 ++--
 libio/wgenops.c                            |  96 ++++----
 libio/wmemstream.c                         |  20 +-
 libio/wstrops.c                            |  56 ++---
 malloc/malloc.c                            |   6 +-
 stdio-common/fxprintf.c                    |   6 +-
 stdio-common/getline.c                     |   8 +-
 stdio-common/isoc99_vfscanf.c              |   2 +-
 stdio-common/isoc99_vscanf.c               |   2 +-
 stdio-common/isoc99_vsscanf.c              |   2 +-
 stdio-common/printf_fp.c                   |   7 +-
 stdio-common/printf_fphex.c                |   7 +-
 stdio-common/printf_size.c                 |   8 +-
 stdio-common/vfprintf.c                    |  26 +-
 stdio-common/vfscanf.c                     |   7 +-
 sysdeps/generic/stdio-lock.h               |   4 +-
 sysdeps/ieee754/ldbl-opt/nldbl-compat.c    |   3 +-
 sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c |   2 +-
 sysdeps/nptl/stdio-lock.h                  |   4 +-
 wcsmbs/isoc99_vfwscanf.c                   |   2 +-
 wcsmbs/isoc99_vswscanf.c                   |   5 +-
 wcsmbs/isoc99_vwscanf.c                    |   2 +-
 127 files changed, 900 insertions(+), 965 deletions(-)

diff --git a/debug/fgets_chk.c b/debug/fgets_chk.c
index 024c5cc0eea..f2236533700 100644
--- a/debug/fgets_chk.c
+++ b/debug/fgets_chk.c
@@ -29,9 +29,9 @@
 #include <sys/param.h>
 
 char *
-__fgets_chk (char *buf, size_t size, int n, _IO_FILE *fp)
+__fgets_chk (char *buf, size_t size, int n, FILE *fp)
 {
-  _IO_size_t count;
+  size_t count;
   char *result;
   CHECK_FILE (fp, NULL);
   if (n <= 0)
diff --git a/debug/fgets_u_chk.c b/debug/fgets_u_chk.c
index 668fdc81d47..317ae5649df 100644
--- a/debug/fgets_u_chk.c
+++ b/debug/fgets_u_chk.c
@@ -29,9 +29,9 @@
 #include <sys/param.h>
 
 char *
-__fgets_unlocked_chk (char *buf, size_t size, int n, _IO_FILE *fp)
+__fgets_unlocked_chk (char *buf, size_t size, int n, FILE *fp)
 {
-  _IO_size_t count;
+  size_t count;
   char *result;
   CHECK_FILE (fp, NULL);
   if (n <= 0)
diff --git a/debug/fgetws_chk.c b/debug/fgetws_chk.c
index 4693a0ba1bd..8ea6635b30e 100644
--- a/debug/fgetws_chk.c
+++ b/debug/fgetws_chk.c
@@ -20,9 +20,9 @@
 #include <sys/param.h>
 
 wchar_t *
-__fgetws_chk (wchar_t *buf, size_t size, int n, _IO_FILE *fp)
+__fgetws_chk (wchar_t *buf, size_t size, int n, FILE *fp)
 {
-  _IO_size_t count;
+  size_t count;
   wchar_t *result;
   int old_error;
   CHECK_FILE (fp, NULL);
diff --git a/debug/fgetws_u_chk.c b/debug/fgetws_u_chk.c
index 36627d79be9..42dad6bc8b5 100644
--- a/debug/fgetws_u_chk.c
+++ b/debug/fgetws_u_chk.c
@@ -29,9 +29,9 @@
 #include <sys/param.h>
 
 wchar_t *
-__fgetws_unlocked_chk (wchar_t *buf, size_t size, int n, _IO_FILE *fp)
+__fgetws_unlocked_chk (wchar_t *buf, size_t size, int n, FILE *fp)
 {
-  _IO_size_t count;
+  size_t count;
   wchar_t *result;
   int old_error;
   CHECK_FILE (fp, NULL);
diff --git a/debug/gets_chk.c b/debug/gets_chk.c
index 6c10d68f340..df3f947e705 100644
--- a/debug/gets_chk.c
+++ b/debug/gets_chk.c
@@ -30,7 +30,7 @@
 char *
 __gets_chk (char *buf, size_t size)
 {
-  _IO_size_t count;
+  size_t count;
   int ch;
   char *retval;
 
diff --git a/debug/vasprintf_chk.c b/debug/vasprintf_chk.c
index a00ef771e6d..46603d95388 100644
--- a/debug/vasprintf_chk.c
+++ b/debug/vasprintf_chk.c
@@ -37,12 +37,12 @@ __vasprintf_chk (char **result_ptr, int flags, const char *format,
 {
   /* Initial size of the buffer to be used.  Will be doubled each time an
      overflow occurs.  */
-  const _IO_size_t init_string_size = 100;
+  const size_t init_string_size = 100;
   char *string;
   _IO_strfile sf;
   int ret;
-  _IO_size_t needed;
-  _IO_size_t allocated;
+  size_t needed;
+  size_t allocated;
   /* No need to clear the memory here (unlike for open_memstream) since
      we know we will never seek on the stream.  */
   string = (char *) malloc (init_string_size);
diff --git a/debug/vsprintf_chk.c b/debug/vsprintf_chk.c
index aa9571d475a..9a443bb699b 100644
--- a/debug/vsprintf_chk.c
+++ b/debug/vsprintf_chk.c
@@ -21,10 +21,10 @@
 #include "../libio/strfile.h"
 
 
-static int _IO_str_chk_overflow (_IO_FILE *fp, int c) __THROW;
+static int _IO_str_chk_overflow (FILE *fp, int c) __THROW;
 
 static int
-_IO_str_chk_overflow (_IO_FILE *fp, int c)
+_IO_str_chk_overflow (FILE *fp, int c)
 {
   /* When we come to here this means the user supplied buffer is
      filled.  */
diff --git a/debug/vswprintf_chk.c b/debug/vswprintf_chk.c
index 816955707f3..c6a7edcacd7 100644
--- a/debug/vswprintf_chk.c
+++ b/debug/vswprintf_chk.c
@@ -59,7 +59,7 @@ __vswprintf_chk (wchar_t *s, size_t maxlen, int flags, size_t slen,
     sf.f._sbf._f._flags2 |= _IO_FLAGS2_FORTIFY;
 
   _IO_wstr_init_static (&sf.f._sbf._f, s, maxlen - 1, s);
-  ret = _IO_vfwprintf ((_IO_FILE *) &sf.f._sbf, format, args);
+  ret = _IO_vfwprintf ((FILE *) &sf.f._sbf, format, args);
 
   if (sf.f._sbf._f._wide_data->_IO_buf_base == sf.overflow_buf)
     /* ISO C99 requires swprintf/vswprintf to return an error if the
diff --git a/hurd/fopenport.c b/hurd/fopenport.c
index f20c1ecdb80..edb12b83f43 100644
--- a/hurd/fopenport.c
+++ b/hurd/fopenport.c
@@ -62,7 +62,7 @@ writeio (void *cookie, const char *buf, size_t n)
    Returns zero if successful, nonzero if not.  */
 static int
 seekio (void *cookie,
-	_IO_off64_t *pos,
+	off64_t *pos,
 	int whence)
 {
   error_t err = __io_seek ((file_t) cookie, *pos, whence, pos);
diff --git a/include/stdio.h b/include/stdio.h
index 94bc2fdc7ef..496c5d14f80 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -25,8 +25,8 @@ libc_hidden_proto (__vfscanf)
 extern int __vscanf (const char *__restrict __format,
 		     __gnuc_va_list __arg)
      __attribute__ ((__format__ (__scanf__, 1, 0)));
-extern _IO_ssize_t __getline (char **__lineptr, size_t *__n,
-			      FILE *__stream) attribute_hidden;
+extern __ssize_t __getline (char **__lineptr, size_t *__n,
+                            FILE *__stream) attribute_hidden;
 extern int __vsscanf (const char *__restrict __s,
 		      const char *__restrict __format,
 		      __gnuc_va_list __arg)
@@ -132,18 +132,18 @@ extern int _sys_nerr_internal attribute_hidden;
 
 libc_hidden_proto (__asprintf)
 #  if IS_IN (libc)
-extern _IO_FILE *_IO_new_fopen (const char*, const char*);
+extern FILE *_IO_new_fopen (const char*, const char*);
 #   define fopen(fname, mode) _IO_new_fopen (fname, mode)
-extern _IO_FILE *_IO_new_fdopen (int, const char*);
+extern FILE *_IO_new_fdopen (int, const char*);
 #   define fdopen(fd, mode) _IO_new_fdopen (fd, mode)
-extern int _IO_new_fclose (_IO_FILE*);
+extern int _IO_new_fclose (FILE*);
 #   define fclose(fp) _IO_new_fclose (fp)
-extern int _IO_fputs (const char*, _IO_FILE*);
+extern int _IO_fputs (const char*, FILE*);
 libc_hidden_proto (_IO_fputs)
 #   define fputs(str, fp) _IO_fputs (str, fp)
-extern int _IO_new_fsetpos (_IO_FILE *, const _IO_fpos_t *);
+extern int _IO_new_fsetpos (FILE *, const __fpos_t *);
 #   define fsetpos(fp, posp) _IO_new_fsetpos (fp, posp)
-extern int _IO_new_fgetpos (_IO_FILE *, _IO_fpos_t *);
+extern int _IO_new_fgetpos (FILE *, __fpos_t *);
 #   define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
 #  endif
 
diff --git a/libio/feof.c b/libio/feof.c
index dbe9a40c1f0..cf9b7eee426 100644
--- a/libio/feof.c
+++ b/libio/feof.c
@@ -28,7 +28,7 @@
 #include "stdio.h"
 
 int
-_IO_feof (_IO_FILE *fp)
+_IO_feof (FILE *fp)
 {
   int result;
   CHECK_FILE (fp, EOF);
diff --git a/libio/feof_u.c b/libio/feof_u.c
index 581808e09c1..868656e61b0 100644
--- a/libio/feof_u.c
+++ b/libio/feof_u.c
@@ -30,7 +30,7 @@
 #undef feof_unlocked
 
 int
-feof_unlocked (_IO_FILE *fp)
+feof_unlocked (FILE *fp)
 {
   CHECK_FILE (fp, EOF);
   return _IO_feof_unlocked (fp);
diff --git a/libio/ferror.c b/libio/ferror.c
index 1121c6d471b..4b5122b6afc 100644
--- a/libio/ferror.c
+++ b/libio/ferror.c
@@ -28,7 +28,7 @@
 #include "stdio.h"
 
 int
-_IO_ferror (_IO_FILE *fp)
+_IO_ferror (FILE *fp)
 {
   int result;
   CHECK_FILE (fp, EOF);
diff --git a/libio/ferror_u.c b/libio/ferror_u.c
index afd0bef225e..85f0c1f1c39 100644
--- a/libio/ferror_u.c
+++ b/libio/ferror_u.c
@@ -30,7 +30,7 @@
 #undef ferror_unlocked
 
 int
-ferror_unlocked (_IO_FILE *fp)
+ferror_unlocked (FILE *fp)
 {
   CHECK_FILE (fp, EOF);
   return _IO_ferror_unlocked (fp);
diff --git a/libio/filedoalloc.c b/libio/filedoalloc.c
index d6517e493b0..190c009172a 100644
--- a/libio/filedoalloc.c
+++ b/libio/filedoalloc.c
@@ -74,13 +74,13 @@ local_isatty (int fd)
 /* Allocate a file buffer, or switch to unbuffered I/O.  Streams for
    TTY devices default to line buffered.  */
 int
-_IO_file_doallocate (_IO_FILE *fp)
+_IO_file_doallocate (FILE *fp)
 {
-  _IO_size_t size;
+  size_t size;
   char *p;
   struct stat64 st;
 
-  size = _IO_BUFSIZ;
+  size = BUFSIZ;
   if (fp->_fileno >= 0 && __builtin_expect (_IO_SYSSTAT (fp, &st), 0) >= 0)
     {
       if (S_ISCHR (st.st_mode))
@@ -94,7 +94,7 @@ _IO_file_doallocate (_IO_FILE *fp)
 	    fp->_flags |= _IO_LINE_BUF;
 	}
 #if defined _STATBUF_ST_BLKSIZE
-      if (st.st_blksize > 0 && st.st_blksize < _IO_BUFSIZ)
+      if (st.st_blksize > 0 && st.st_blksize < BUFSIZ)
 	size = st.st_blksize;
 #endif
     }
diff --git a/libio/fileno.c b/libio/fileno.c
index 8f678ad2aa3..f49c588a961 100644
--- a/libio/fileno.c
+++ b/libio/fileno.c
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 int
-__fileno (_IO_FILE *fp)
+__fileno (FILE *fp)
 {
   CHECK_FILE (fp, EOF);
 
diff --git a/libio/fileops.c b/libio/fileops.c
index 5fd8a9647f2..1162b1b1442 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -125,7 +125,7 @@ _IO_new_file_init (struct _IO_FILE_plus *fp)
 }
 
 int
-_IO_new_file_close_it (_IO_FILE *fp)
+_IO_new_file_close_it (FILE *fp)
 {
   int write_status;
   if (!_IO_file_is_open (fp))
@@ -165,7 +165,7 @@ _IO_new_file_close_it (_IO_FILE *fp)
 libc_hidden_ver (_IO_new_file_close_it, _IO_file_close_it)
 
 void
-_IO_new_file_finish (_IO_FILE *fp, int dummy)
+_IO_new_file_finish (FILE *fp, int dummy)
 {
   if (_IO_file_is_open (fp))
     {
@@ -177,8 +177,8 @@ _IO_new_file_finish (_IO_FILE *fp, int dummy)
 }
 libc_hidden_ver (_IO_new_file_finish, _IO_file_finish)
 
-_IO_FILE *
-_IO_file_open (_IO_FILE *fp, const char *filename, int posix_mode, int prot,
+FILE *
+_IO_file_open (FILE *fp, const char *filename, int posix_mode, int prot,
 	       int read_write, int is32not64)
 {
   int fdesc;
@@ -196,7 +196,7 @@ _IO_file_open (_IO_FILE *fp, const char *filename, int posix_mode, int prot,
   if ((read_write & (_IO_IS_APPENDING | _IO_NO_READS))
       == (_IO_IS_APPENDING | _IO_NO_READS))
     {
-      _IO_off64_t new_pos = _IO_SYSSEEK (fp, 0, _IO_seek_end);
+      off64_t new_pos = _IO_SYSSEEK (fp, 0, _IO_seek_end);
       if (new_pos == _IO_pos_BAD && errno != ESPIPE)
 	{
 	  __close_nocancel (fdesc);
@@ -208,15 +208,15 @@ _IO_file_open (_IO_FILE *fp, const char *filename, int posix_mode, int prot,
 }
 libc_hidden_def (_IO_file_open)
 
-_IO_FILE *
-_IO_new_file_fopen (_IO_FILE *fp, const char *filename, const char *mode,
+FILE *
+_IO_new_file_fopen (FILE *fp, const char *filename, const char *mode,
 		    int is32not64)
 {
   int oflags = 0, omode;
   int read_write;
   int oprot = 0666;
   int i;
-  _IO_FILE *result;
+  FILE *result;
   const char *cs;
   const char *last_recognized;
 
@@ -364,8 +364,8 @@ _IO_new_file_fopen (_IO_FILE *fp, const char *filename, const char *mode,
 }
 libc_hidden_ver (_IO_new_file_fopen, _IO_file_fopen)
 
-_IO_FILE *
-_IO_new_file_attach (_IO_FILE *fp, int fd)
+FILE *
+_IO_new_file_attach (FILE *fp, int fd)
 {
   if (_IO_file_is_open (fp))
     return NULL;
@@ -376,7 +376,7 @@ _IO_new_file_attach (_IO_FILE *fp, int fd)
   /* We have to do that since that may be junk. */
   fp->_offset = _IO_pos_BAD;
   int save_errno = errno;
-  if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
+  if (_IO_SEEKOFF (fp, (off64_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
       == _IO_pos_BAD && errno != ESPIPE)
     return NULL;
   __set_errno (save_errno);
@@ -384,8 +384,8 @@ _IO_new_file_attach (_IO_FILE *fp, int fd)
 }
 libc_hidden_ver (_IO_new_file_attach, _IO_file_attach)
 
-_IO_FILE *
-_IO_new_file_setbuf (_IO_FILE *fp, char *p, _IO_ssize_t len)
+FILE *
+_IO_new_file_setbuf (FILE *fp, char *p, ssize_t len)
 {
   if (_IO_default_setbuf (fp, p, len) == NULL)
     return NULL;
@@ -399,10 +399,10 @@ _IO_new_file_setbuf (_IO_FILE *fp, char *p, _IO_ssize_t len)
 libc_hidden_ver (_IO_new_file_setbuf, _IO_file_setbuf)
 
 
-_IO_FILE *
-_IO_file_setbuf_mmap (_IO_FILE *fp, char *p, _IO_ssize_t len)
+FILE *
+_IO_file_setbuf_mmap (FILE *fp, char *p, ssize_t len)
 {
-  _IO_FILE *result;
+  FILE *result;
 
   /* Change the function table.  */
   _IO_JUMPS_FILE_plus (fp) = &_IO_file_jumps;
@@ -421,24 +421,23 @@ _IO_file_setbuf_mmap (_IO_FILE *fp, char *p, _IO_ssize_t len)
   return result;
 }
 
-static _IO_size_t new_do_write (_IO_FILE *, const char *, _IO_size_t);
+static size_t new_do_write (FILE *, const char *, size_t);
 
 /* Write TO_DO bytes from DATA to FP.
    Then mark FP as having empty buffers. */
 
 int
-_IO_new_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do)
+_IO_new_do_write (FILE *fp, const char *data, size_t to_do)
 {
   return (to_do == 0
-	  || (_IO_size_t) new_do_write (fp, data, to_do) == to_do) ? 0 : EOF;
+	  || (size_t) new_do_write (fp, data, to_do) == to_do) ? 0 : EOF;
 }
 libc_hidden_ver (_IO_new_do_write, _IO_do_write)
 
-static
-_IO_size_t
-new_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do)
+static size_t
+new_do_write (FILE *fp, const char *data, size_t to_do)
 {
-  _IO_size_t count;
+  size_t count;
   if (fp->_flags & _IO_IS_APPENDING)
     /* On a system without a proper O_APPEND implementation,
        you would need to sys_seek(0, SEEK_END) here, but is
@@ -448,7 +447,7 @@ new_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do)
     fp->_offset = _IO_pos_BAD;
   else if (fp->_IO_read_end != fp->_IO_write_base)
     {
-      _IO_off64_t new_pos
+      off64_t new_pos
 	= _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
       if (new_pos == _IO_pos_BAD)
 	return 0;
@@ -466,9 +465,9 @@ new_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do)
 }
 
 int
-_IO_new_file_underflow (_IO_FILE *fp)
+_IO_new_file_underflow (FILE *fp)
 {
-  _IO_ssize_t count;
+  ssize_t count;
 #if 0
   /* SysV does not make this test; take it out for compatibility */
   if (fp->_flags & _IO_EOF_SEEN)
@@ -557,7 +556,7 @@ libc_hidden_ver (_IO_new_file_underflow, _IO_file_underflow)
    If the file is no longer eligible for mmap, its jump tables are reset to
    the vanilla ones and we return nonzero.  */
 static int
-mmap_remap_check (_IO_FILE *fp)
+mmap_remap_check (FILE *fp)
 {
   struct stat64 st;
 
@@ -653,7 +652,7 @@ mmap_remap_check (_IO_FILE *fp)
 
 /* Special callback replacing the underflow callbacks if we mmap the file.  */
 int
-_IO_file_underflow_mmap (_IO_FILE *fp)
+_IO_file_underflow_mmap (FILE *fp)
 {
   if (fp->_IO_read_ptr < fp->_IO_read_end)
     return *(unsigned char *) fp->_IO_read_ptr;
@@ -670,7 +669,7 @@ _IO_file_underflow_mmap (_IO_FILE *fp)
 }
 
 static void
-decide_maybe_mmap (_IO_FILE *fp)
+decide_maybe_mmap (FILE *fp)
 {
   /* We use the file in read-only mode.  This could mean we can
      mmap the file and use it without any copying.  But not all
@@ -732,7 +731,7 @@ decide_maybe_mmap (_IO_FILE *fp)
 }
 
 int
-_IO_file_underflow_maybe_mmap (_IO_FILE *fp)
+_IO_file_underflow_maybe_mmap (FILE *fp)
 {
   /* This is the first read attempt.  Choose mmap or vanilla operations
      and then punt to the chosen underflow routine.  */
@@ -742,7 +741,7 @@ _IO_file_underflow_maybe_mmap (_IO_FILE *fp)
 
 
 int
-_IO_new_file_overflow (_IO_FILE *f, int ch)
+_IO_new_file_overflow (FILE *f, int ch)
 {
   if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
     {
@@ -803,9 +802,9 @@ _IO_new_file_overflow (_IO_FILE *f, int ch)
 libc_hidden_ver (_IO_new_file_overflow, _IO_file_overflow)
 
 int
-_IO_new_file_sync (_IO_FILE *fp)
+_IO_new_file_sync (FILE *fp)
 {
-  _IO_ssize_t delta;
+  ssize_t delta;
   int retval = 0;
 
   /*    char* ptr = cur_ptr(); */
@@ -818,8 +817,8 @@ _IO_new_file_sync (_IO_FILE *fp)
       if (_IO_in_backup (fp))
 	delta -= eGptr () - Gbase ();
 #endif
-      _IO_off64_t new_pos = _IO_SYSSEEK (fp, delta, 1);
-      if (new_pos != (_IO_off64_t) EOF)
+      off64_t new_pos = _IO_SYSSEEK (fp, delta, 1);
+      if (new_pos != (off64_t) EOF)
 	fp->_IO_read_end = fp->_IO_read_ptr;
       else if (errno == ESPIPE)
 	; /* Ignore error from unseekable devices. */
@@ -835,7 +834,7 @@ _IO_new_file_sync (_IO_FILE *fp)
 libc_hidden_ver (_IO_new_file_sync, _IO_file_sync)
 
 static int
-_IO_file_sync_mmap (_IO_FILE *fp)
+_IO_file_sync_mmap (FILE *fp)
 {
   if (fp->_IO_read_ptr != fp->_IO_read_end)
     {
@@ -859,10 +858,10 @@ _IO_file_sync_mmap (_IO_FILE *fp)
 /* ftell{,o} implementation.  The only time we modify the state of the stream
    is when we have unflushed writes.  In that case we seek to the end and
    record that offset in the stream object.  */
-static _IO_off64_t
-do_ftell (_IO_FILE *fp)
+static off64_t
+do_ftell (FILE *fp)
 {
-  _IO_off64_t result, offset = 0;
+  off64_t result, offset = 0;
 
   /* No point looking at unflushed data if we haven't allocated buffers
      yet.  */
@@ -918,11 +917,11 @@ do_ftell (_IO_FILE *fp)
   return result;
 }
 
-_IO_off64_t
-_IO_new_file_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
+off64_t
+_IO_new_file_seekoff (FILE *fp, off64_t offset, int dir, int mode)
 {
-  _IO_off64_t result;
-  _IO_off64_t delta, new_offset;
+  off64_t result;
+  off64_t delta, new_offset;
   long count;
 
   /* Short-circuit into a separate function.  We don't want to mix any
@@ -1003,7 +1002,7 @@ _IO_new_file_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
   if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
       && !_IO_in_backup (fp))
     {
-      _IO_off64_t start_offset = (fp->_offset
+      off64_t start_offset = (fp->_offset
 				  - (fp->_IO_read_end - fp->_IO_buf_base));
       if (offset >= start_offset && offset < fp->_offset)
 	{
@@ -1077,10 +1076,10 @@ resync:
 }
 libc_hidden_ver (_IO_new_file_seekoff, _IO_file_seekoff)
 
-_IO_off64_t
-_IO_file_seekoff_mmap (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
+off64_t
+_IO_file_seekoff_mmap (FILE *fp, off64_t offset, int dir, int mode)
 {
-  _IO_off64_t result;
+  off64_t result;
 
   /* If we are only interested in the current position, calculate it and
      return right now.  This calculation does the right thing when we are
@@ -1132,15 +1131,15 @@ _IO_file_seekoff_mmap (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
   return offset;
 }
 
-static _IO_off64_t
-_IO_file_seekoff_maybe_mmap (_IO_FILE *fp, _IO_off64_t offset, int dir,
+static off64_t
+_IO_file_seekoff_maybe_mmap (FILE *fp, off64_t offset, int dir,
 			     int mode)
 {
   /* We only get here when we haven't tried to read anything yet.
      So there is nothing more useful for us to do here than just
      the underlying lseek call.  */
 
-  _IO_off64_t result = _IO_SYSSEEK (fp, offset, dir);
+  off64_t result = _IO_SYSSEEK (fp, offset, dir);
   if (result < 0)
     return EOF;
 
@@ -1148,8 +1147,8 @@ _IO_file_seekoff_maybe_mmap (_IO_FILE *fp, _IO_off64_t offset, int dir,
   return result;
 }
 
-_IO_ssize_t
-_IO_file_read (_IO_FILE *fp, void *buf, _IO_ssize_t size)
+ssize_t
+_IO_file_read (FILE *fp, void *buf, ssize_t size)
 {
   return (__builtin_expect (fp->_flags2 & _IO_FLAGS2_NOTCANCEL, 0)
 	  ? __read_nocancel (fp->_fileno, buf, size)
@@ -1157,22 +1156,22 @@ _IO_file_read (_IO_FILE *fp, void *buf, _IO_ssize_t size)
 }
 libc_hidden_def (_IO_file_read)
 
-_IO_off64_t
-_IO_file_seek (_IO_FILE *fp, _IO_off64_t offset, int dir)
+off64_t
+_IO_file_seek (FILE *fp, off64_t offset, int dir)
 {
   return __lseek64 (fp->_fileno, offset, dir);
 }
 libc_hidden_def (_IO_file_seek)
 
 int
-_IO_file_stat (_IO_FILE *fp, void *st)
+_IO_file_stat (FILE *fp, void *st)
 {
   return __fxstat64 (_STAT_VER, fp->_fileno, (struct stat64 *) st);
 }
 libc_hidden_def (_IO_file_stat)
 
 int
-_IO_file_close_mmap (_IO_FILE *fp)
+_IO_file_close_mmap (FILE *fp)
 {
   /* In addition to closing the file descriptor we have to unmap the file.  */
   (void) __munmap (fp->_IO_buf_base, fp->_IO_buf_end - fp->_IO_buf_base);
@@ -1183,7 +1182,7 @@ _IO_file_close_mmap (_IO_FILE *fp)
 }
 
 int
-_IO_file_close (_IO_FILE *fp)
+_IO_file_close (FILE *fp)
 {
   /* Cancelling close should be avoided if possible since it leaves an
      unrecoverable state behind.  */
@@ -1191,13 +1190,13 @@ _IO_file_close (_IO_FILE *fp)
 }
 libc_hidden_def (_IO_file_close)
 
-_IO_ssize_t
-_IO_new_file_write (_IO_FILE *f, const void *data, _IO_ssize_t n)
+ssize_t
+_IO_new_file_write (FILE *f, const void *data, ssize_t n)
 {
-  _IO_ssize_t to_do = n;
+  ssize_t to_do = n;
   while (to_do > 0)
     {
-      _IO_ssize_t count = (__builtin_expect (f->_flags2
+      ssize_t count = (__builtin_expect (f->_flags2
 					     & _IO_FLAGS2_NOTCANCEL, 0)
 			   ? __write_nocancel (f->_fileno, data, to_do)
 			   : __write (f->_fileno, data, to_do));
@@ -1215,13 +1214,13 @@ _IO_new_file_write (_IO_FILE *f, const void *data, _IO_ssize_t n)
   return n;
 }
 
-_IO_size_t
-_IO_new_file_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
+size_t
+_IO_new_file_xsputn (FILE *f, const void *data, size_t n)
 {
   const char *s = (const char *) data;
-  _IO_size_t to_do = n;
+  size_t to_do = n;
   int must_flush = 0;
-  _IO_size_t count = 0;
+  size_t count = 0;
 
   if (n <= 0)
     return 0;
@@ -1261,7 +1260,7 @@ _IO_new_file_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
     }
   if (to_do + must_flush > 0)
     {
-      _IO_size_t block_size, do_write;
+      size_t block_size, do_write;
       /* Next flush the (full) buffer. */
       if (_IO_OVERFLOW (f, EOF) == EOF)
 	/* If nothing else has to be written we must not signal the
@@ -1290,11 +1289,11 @@ _IO_new_file_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
 }
 libc_hidden_ver (_IO_new_file_xsputn, _IO_file_xsputn)
 
-_IO_size_t
-_IO_file_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
+size_t
+_IO_file_xsgetn (FILE *fp, void *data, size_t n)
 {
-  _IO_size_t want, have;
-  _IO_ssize_t count;
+  size_t want, have;
+  ssize_t count;
   char *s = data;
 
   want = n;
@@ -1356,7 +1355,7 @@ _IO_file_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
 	  count = want;
 	  if (fp->_IO_buf_base)
 	    {
-	      _IO_size_t block_size = fp->_IO_buf_end - fp->_IO_buf_base;
+	      size_t block_size = fp->_IO_buf_end - fp->_IO_buf_base;
 	      if (block_size >= 128)
 		count -= want % block_size;
 	    }
@@ -1383,10 +1382,10 @@ _IO_file_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
 }
 libc_hidden_def (_IO_file_xsgetn)
 
-static _IO_size_t
-_IO_file_xsgetn_mmap (_IO_FILE *fp, void *data, _IO_size_t n)
+static size_t
+_IO_file_xsgetn_mmap (FILE *fp, void *data, size_t n)
 {
-  _IO_size_t have;
+  size_t have;
   char *read_ptr = fp->_IO_read_ptr;
   char *s = (char *) data;
 
@@ -1428,8 +1427,8 @@ _IO_file_xsgetn_mmap (_IO_FILE *fp, void *data, _IO_size_t n)
   return s - (char *) data;
 }
 
-static _IO_size_t
-_IO_file_xsgetn_maybe_mmap (_IO_FILE *fp, void *data, _IO_size_t n)
+static size_t
+_IO_file_xsgetn_maybe_mmap (FILE *fp, void *data, size_t n)
 {
   /* We only get here if this is the first attempt to read something.
      Decide which operations to use and then punt to the chosen one.  */
diff --git a/libio/fmemopen.c b/libio/fmemopen.c
index 57c58353280..319dba83cb5 100644
--- a/libio/fmemopen.c
+++ b/libio/fmemopen.c
@@ -37,7 +37,7 @@ struct fmemopen_cookie_struct
   int         mybuffer;  /* allocated my buffer?  */
   int         append;    /* buffer open for append?  */
   size_t      size;      /* buffer length in bytes.  */
-  _IO_off64_t pos;       /* current position at the buffer.  */
+  off64_t     pos;       /* current position at the buffer.  */
   size_t      maxpos;    /* max position in buffer.  */
 };
 
@@ -66,7 +66,7 @@ static ssize_t
 fmemopen_write (void *cookie, const char *b, size_t s)
 {
   fmemopen_cookie_t *c = (fmemopen_cookie_t *) cookie;;
-  _IO_off64_t pos = c->append ? c->maxpos : c->pos;
+  off64_t pos = c->append ? c->maxpos : c->pos;
   int addnullc = (s == 0 || b[s - 1] != '\0');
 
   if (pos + s > c->size)
@@ -97,9 +97,9 @@ fmemopen_write (void *cookie, const char *b, size_t s)
 
 
 static int
-fmemopen_seek (void *cookie, _IO_off64_t *p, int w)
+fmemopen_seek (void *cookie, off64_t *p, int w)
 {
-  _IO_off64_t np;
+  off64_t np;
   fmemopen_cookie_t *c = (fmemopen_cookie_t *) cookie;
 
   switch (w)
diff --git a/libio/fputc.c b/libio/fputc.c
index 88902a737d0..13b3b84a769 100644
--- a/libio/fputc.c
+++ b/libio/fputc.c
@@ -28,7 +28,7 @@
 #include "stdio.h"
 
 int
-fputc (int c, _IO_FILE *fp)
+fputc (int c, FILE *fp)
 {
   int result;
   CHECK_FILE (fp, EOF);
diff --git a/libio/fputc_u.c b/libio/fputc_u.c
index abe07f33d3c..9a9f964f3f4 100644
--- a/libio/fputc_u.c
+++ b/libio/fputc_u.c
@@ -30,7 +30,7 @@
 #undef fputc_unlocked
 
 int
-fputc_unlocked (int c, _IO_FILE *fp)
+fputc_unlocked (int c, FILE *fp)
 {
   CHECK_FILE (fp, EOF);
   return _IO_putc_unlocked (c, fp);
diff --git a/libio/fputwc.c b/libio/fputwc.c
index ccf08b78feb..be2baf98fd0 100644
--- a/libio/fputwc.c
+++ b/libio/fputwc.c
@@ -28,7 +28,7 @@
 #include <wchar.h>
 
 wint_t
-fputwc (wchar_t wc, _IO_FILE *fp)
+fputwc (wchar_t wc, FILE *fp)
 {
   wint_t result;
   CHECK_FILE (fp, EOF);
diff --git a/libio/fputwc_u.c b/libio/fputwc_u.c
index d6b0538a5ce..3bcd997848b 100644
--- a/libio/fputwc_u.c
+++ b/libio/fputwc_u.c
@@ -30,7 +30,7 @@
 #undef fputwc_unlocked
 
 wint_t
-fputwc_unlocked (wchar_t wc, _IO_FILE *fp)
+fputwc_unlocked (wchar_t wc, FILE *fp)
 {
   CHECK_FILE (fp, WEOF);
   if (_IO_fwide (fp, 1) < 0)
diff --git a/libio/fseek.c b/libio/fseek.c
index 7167e2cb90f..0865321f55a 100644
--- a/libio/fseek.c
+++ b/libio/fseek.c
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 int
-fseek (_IO_FILE *fp, long int offset, int whence)
+fseek (FILE *fp, long int offset, int whence)
 {
   int result;
   CHECK_FILE (fp, -1);
diff --git a/libio/fseeko.c b/libio/fseeko.c
index 9e1dd10fe9d..2df0453d358 100644
--- a/libio/fseeko.c
+++ b/libio/fseeko.c
@@ -28,7 +28,7 @@
 #include "stdio.h"
 
 int
-fseeko (_IO_FILE *fp, off_t offset, int whence)
+fseeko (FILE *fp, off_t offset, int whence)
 {
   int result;
   CHECK_FILE (fp, -1);
diff --git a/libio/fseeko64.c b/libio/fseeko64.c
index 548d7a33888..eea6455bc39 100644
--- a/libio/fseeko64.c
+++ b/libio/fseeko64.c
@@ -32,7 +32,7 @@
 #ifndef __OFF_T_MATCHES_OFF64_T
 
 int
-fseeko64 (_IO_FILE *fp, __off64_t offset, int whence)
+fseeko64 (FILE *fp, off64_t offset, int whence)
 {
   int result;
   CHECK_FILE (fp, -1);
diff --git a/libio/ftello.c b/libio/ftello.c
index c9df0569f08..5405821b455 100644
--- a/libio/ftello.c
+++ b/libio/ftello.c
@@ -31,9 +31,9 @@
 
 
 off_t
-__ftello (_IO_FILE *fp)
+__ftello (FILE *fp)
 {
-  _IO_off64_t pos;
+  off64_t pos;
   CHECK_FILE (fp, -1L);
   _IO_acquire_lock (fp);
   pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
@@ -49,7 +49,7 @@ __ftello (_IO_FILE *fp)
 	__set_errno (EIO);
       return -1L;
     }
-  if ((_IO_off64_t) (off_t) pos != pos)
+  if ((off64_t) (off_t) pos != pos)
     {
       __set_errno (EOVERFLOW);
       return -1L;
diff --git a/libio/ftello64.c b/libio/ftello64.c
index fcc8495296a..281667fee20 100644
--- a/libio/ftello64.c
+++ b/libio/ftello64.c
@@ -32,9 +32,9 @@
 #ifndef __OFF_T_MATCHES_OFF64_T
 
 off64_t
-ftello64 (_IO_FILE *fp)
+ftello64 (FILE *fp)
 {
-  _IO_off64_t pos;
+  off64_t pos;
   CHECK_FILE (fp, -1L);
   _IO_acquire_lock (fp);
   pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
diff --git a/libio/fwide.c b/libio/fwide.c
index 2357be556ee..3e105592cd9 100644
--- a/libio/fwide.c
+++ b/libio/fwide.c
@@ -29,7 +29,7 @@
 #include <wchar.h>
 
 int
-fwide (_IO_FILE *fp, int mode)
+fwide (FILE *fp, int mode)
 {
   int result;
 
diff --git a/libio/genops.c b/libio/genops.c
index d6f80506690..2b820c86d20 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -36,7 +36,7 @@
 static _IO_lock_t list_all_lock = _IO_lock_initializer;
 #endif
 
-static _IO_FILE *run_fp;
+static FILE *run_fp;
 
 #ifdef _IO_MTSAFE_IO
 static void
@@ -53,12 +53,12 @@ _IO_un_link (struct _IO_FILE_plus *fp)
 {
   if (fp->file._flags & _IO_LINKED)
     {
-      struct _IO_FILE **f;
+      FILE **f;
 #ifdef _IO_MTSAFE_IO
       _IO_cleanup_region_start_noarg (flush_cleanup);
       _IO_lock_lock (list_all_lock);
-      run_fp = (_IO_FILE *) fp;
-      _IO_flockfile ((_IO_FILE *) fp);
+      run_fp = (FILE *) fp;
+      _IO_flockfile ((FILE *) fp);
 #endif
       if (_IO_list_all == NULL)
 	;
@@ -66,14 +66,14 @@ _IO_un_link (struct _IO_FILE_plus *fp)
 	_IO_list_all = (struct _IO_FILE_plus *) _IO_list_all->file._chain;
       else
 	for (f = &_IO_list_all->file._chain; *f; f = &(*f)->_chain)
-	  if (*f == (_IO_FILE *) fp)
+	  if (*f == (FILE *) fp)
 	    {
 	      *f = fp->file._chain;
 	      break;
 	    }
       fp->file._flags &= ~_IO_LINKED;
 #ifdef _IO_MTSAFE_IO
-      _IO_funlockfile ((_IO_FILE *) fp);
+      _IO_funlockfile ((FILE *) fp);
       run_fp = NULL;
       _IO_lock_unlock (list_all_lock);
       _IO_cleanup_region_end (0);
@@ -91,13 +91,13 @@ _IO_link_in (struct _IO_FILE_plus *fp)
 #ifdef _IO_MTSAFE_IO
       _IO_cleanup_region_start_noarg (flush_cleanup);
       _IO_lock_lock (list_all_lock);
-      run_fp = (_IO_FILE *) fp;
-      _IO_flockfile ((_IO_FILE *) fp);
+      run_fp = (FILE *) fp;
+      _IO_flockfile ((FILE *) fp);
 #endif
-      fp->file._chain = (_IO_FILE *) _IO_list_all;
+      fp->file._chain = (FILE *) _IO_list_all;
       _IO_list_all = fp;
 #ifdef _IO_MTSAFE_IO
-      _IO_funlockfile ((_IO_FILE *) fp);
+      _IO_funlockfile ((FILE *) fp);
       run_fp = NULL;
       _IO_lock_unlock (list_all_lock);
       _IO_cleanup_region_end (0);
@@ -108,12 +108,12 @@ libc_hidden_def (_IO_link_in)
 
 /* Return minimum _pos markers
    Assumes the current get area is the main get area. */
-_IO_ssize_t _IO_least_marker (_IO_FILE *fp, char *end_p);
+ssize_t _IO_least_marker (FILE *fp, char *end_p);
 
-_IO_ssize_t
-_IO_least_marker (_IO_FILE *fp, char *end_p)
+ssize_t
+_IO_least_marker (FILE *fp, char *end_p)
 {
-  _IO_ssize_t least_so_far = end_p - fp->_IO_read_base;
+  ssize_t least_so_far = end_p - fp->_IO_read_base;
   struct _IO_marker *mark;
   for (mark = fp->_markers; mark != NULL; mark = mark->_next)
     if (mark->_pos < least_so_far)
@@ -124,7 +124,7 @@ _IO_least_marker (_IO_FILE *fp, char *end_p)
 /* Switch current get area from backup buffer to (start of) main get area. */
 
 void
-_IO_switch_to_main_get_area (_IO_FILE *fp)
+_IO_switch_to_main_get_area (FILE *fp)
 {
   char *tmp;
   fp->_flags &= ~_IO_IN_BACKUP;
@@ -143,7 +143,7 @@ _IO_switch_to_main_get_area (_IO_FILE *fp)
 /* Switch current get area from main get area to (end of) backup area. */
 
 void
-_IO_switch_to_backup_area (_IO_FILE *fp)
+_IO_switch_to_backup_area (FILE *fp)
 {
   char *tmp;
   fp->_flags |= _IO_IN_BACKUP;
@@ -160,7 +160,7 @@ _IO_switch_to_backup_area (_IO_FILE *fp)
 }
 
 int
-_IO_switch_to_get_mode (_IO_FILE *fp)
+_IO_switch_to_get_mode (FILE *fp)
 {
   if (fp->_IO_write_ptr > fp->_IO_write_base)
     if (_IO_OVERFLOW (fp, EOF) == EOF)
@@ -183,7 +183,7 @@ _IO_switch_to_get_mode (_IO_FILE *fp)
 libc_hidden_def (_IO_switch_to_get_mode)
 
 void
-_IO_free_backup_area (_IO_FILE *fp)
+_IO_free_backup_area (FILE *fp)
 {
   if (_IO_in_backup (fp))
     _IO_switch_to_main_get_area (fp);  /* Just in case. */
@@ -196,7 +196,7 @@ libc_hidden_def (_IO_free_backup_area)
 
 #if 0
 int
-_IO_switch_to_put_mode (_IO_FILE *fp)
+_IO_switch_to_put_mode (FILE *fp)
 {
   fp->_IO_write_base = fp->_IO_read_ptr;
   fp->_IO_write_ptr = fp->_IO_read_ptr;
@@ -213,7 +213,7 @@ _IO_switch_to_put_mode (_IO_FILE *fp)
 #endif
 
 int
-__overflow (_IO_FILE *f, int ch)
+__overflow (FILE *f, int ch)
 {
   /* This is a single-byte stream.  */
   if (f->_mode == 0)
@@ -223,16 +223,16 @@ __overflow (_IO_FILE *f, int ch)
 libc_hidden_def (__overflow)
 
 static int
-save_for_backup (_IO_FILE *fp, char *end_p)
+save_for_backup (FILE *fp, char *end_p)
 {
   /* Append [_IO_read_base..end_p] to backup area. */
-  _IO_ssize_t least_mark = _IO_least_marker (fp, end_p);
+  ssize_t least_mark = _IO_least_marker (fp, end_p);
   /* needed_size is how much space we need in the backup area. */
-  _IO_size_t needed_size = (end_p - fp->_IO_read_base) - least_mark;
+  size_t needed_size = (end_p - fp->_IO_read_base) - least_mark;
   /* FIXME: Dubious arithmetic if pointers are NULL */
-  _IO_size_t current_Bsize = fp->_IO_save_end - fp->_IO_save_base;
-  _IO_size_t avail; /* Extra space available for future expansion. */
-  _IO_ssize_t delta;
+  size_t current_Bsize = fp->_IO_save_end - fp->_IO_save_base;
+  size_t avail; /* Extra space available for future expansion. */
+  ssize_t delta;
   struct _IO_marker *mark;
   if (needed_size > current_Bsize)
     {
@@ -283,7 +283,7 @@ save_for_backup (_IO_FILE *fp, char *end_p)
 }
 
 int
-__underflow (_IO_FILE *fp)
+__underflow (FILE *fp)
 {
   if (_IO_vtable_offset (fp) == 0 && _IO_fwide (fp, -1) != -1)
     return EOF;
@@ -313,7 +313,7 @@ __underflow (_IO_FILE *fp)
 libc_hidden_def (__underflow)
 
 int
-__uflow (_IO_FILE *fp)
+__uflow (FILE *fp)
 {
   if (_IO_vtable_offset (fp) == 0 && _IO_fwide (fp, -1) != -1)
     return EOF;
@@ -343,7 +343,7 @@ __uflow (_IO_FILE *fp)
 libc_hidden_def (__uflow)
 
 void
-_IO_setb (_IO_FILE *f, char *b, char *eb, int a)
+_IO_setb (FILE *f, char *b, char *eb, int a)
 {
   if (f->_IO_buf_base && !(f->_flags & _IO_USER_BUF))
     free (f->_IO_buf_base);
@@ -357,7 +357,7 @@ _IO_setb (_IO_FILE *f, char *b, char *eb, int a)
 libc_hidden_def (_IO_setb)
 
 void
-_IO_doallocbuf (_IO_FILE *fp)
+_IO_doallocbuf (FILE *fp)
 {
   if (fp->_IO_buf_base)
     return;
@@ -369,13 +369,13 @@ _IO_doallocbuf (_IO_FILE *fp)
 libc_hidden_def (_IO_doallocbuf)
 
 int
-_IO_default_underflow (_IO_FILE *fp)
+_IO_default_underflow (FILE *fp)
 {
   return EOF;
 }
 
 int
-_IO_default_uflow (_IO_FILE *fp)
+_IO_default_uflow (FILE *fp)
 {
   int ch = _IO_UNDERFLOW (fp);
   if (ch == EOF)
@@ -384,11 +384,11 @@ _IO_default_uflow (_IO_FILE *fp)
 }
 libc_hidden_def (_IO_default_uflow)
 
-_IO_size_t
-_IO_default_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
+size_t
+_IO_default_xsputn (FILE *f, const void *data, size_t n)
 {
   const char *s = (char *) data;
-  _IO_size_t more = n;
+  size_t more = n;
   if (more <= 0)
     return 0;
   for (;;)
@@ -396,7 +396,7 @@ _IO_default_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
       /* Space available. */
       if (f->_IO_write_ptr < f->_IO_write_end)
 	{
-	  _IO_size_t count = f->_IO_write_end - f->_IO_write_ptr;
+	  size_t count = f->_IO_write_end - f->_IO_write_ptr;
 	  if (count > more)
 	    count = more;
 	  if (count > 20)
@@ -407,7 +407,7 @@ _IO_default_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
 	  else if (count)
 	    {
 	      char *p = f->_IO_write_ptr;
-	      _IO_ssize_t i;
+	      ssize_t i;
 	      for (i = count; --i >= 0; )
 		*p++ = *s++;
 	      f->_IO_write_ptr = p;
@@ -422,25 +422,25 @@ _IO_default_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
 }
 libc_hidden_def (_IO_default_xsputn)
 
-_IO_size_t
-_IO_sgetn (_IO_FILE *fp, void *data, _IO_size_t n)
+size_t
+_IO_sgetn (FILE *fp, void *data, size_t n)
 {
   /* FIXME handle putback buffer here! */
   return _IO_XSGETN (fp, data, n);
 }
 libc_hidden_def (_IO_sgetn)
 
-_IO_size_t
-_IO_default_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
+size_t
+_IO_default_xsgetn (FILE *fp, void *data, size_t n)
 {
-  _IO_size_t more = n;
+  size_t more = n;
   char *s = (char*) data;
   for (;;)
     {
       /* Data available. */
       if (fp->_IO_read_ptr < fp->_IO_read_end)
 	{
-	  _IO_size_t count = fp->_IO_read_end - fp->_IO_read_ptr;
+	  size_t count = fp->_IO_read_end - fp->_IO_read_ptr;
 	  if (count > more)
 	    count = more;
 	  if (count > 20)
@@ -468,14 +468,14 @@ libc_hidden_def (_IO_default_xsgetn)
 #if 0
 /* Seems not to be needed. --drepper */
 int
-_IO_sync (_IO_FILE *fp)
+_IO_sync (FILE *fp)
 {
   return 0;
 }
 #endif
 
-_IO_FILE *
-_IO_default_setbuf (_IO_FILE *fp, char *p, _IO_ssize_t len)
+FILE *
+_IO_default_setbuf (FILE *fp, char *p, ssize_t len)
 {
     if (_IO_SYNC (fp) == EOF)
 	return NULL;
@@ -494,34 +494,34 @@ _IO_default_setbuf (_IO_FILE *fp, char *p, _IO_ssize_t len)
     return fp;
 }
 
-_IO_off64_t
-_IO_default_seekpos (_IO_FILE *fp, _IO_off64_t pos, int mode)
+off64_t
+_IO_default_seekpos (FILE *fp, off64_t pos, int mode)
 {
   return _IO_SEEKOFF (fp, pos, 0, mode);
 }
 
 int
-_IO_default_doallocate (_IO_FILE *fp)
+_IO_default_doallocate (FILE *fp)
 {
   char *buf;
 
-  buf = malloc(_IO_BUFSIZ);
+  buf = malloc(BUFSIZ);
   if (__glibc_unlikely (buf == NULL))
     return EOF;
 
-  _IO_setb (fp, buf, buf+_IO_BUFSIZ, 1);
+  _IO_setb (fp, buf, buf+BUFSIZ, 1);
   return 1;
 }
 libc_hidden_def (_IO_default_doallocate)
 
 void
-_IO_init_internal (_IO_FILE *fp, int flags)
+_IO_init_internal (FILE *fp, int flags)
 {
   _IO_no_init (fp, flags, -1, NULL, NULL);
 }
 
 void
-_IO_init (_IO_FILE *fp, int flags)
+_IO_init (FILE *fp, int flags)
 {
   IO_set_accept_foreign_vtables (&_IO_vtable_check);
   _IO_init_internal (fp, flags);
@@ -554,7 +554,7 @@ _IO_enable_locks (void)
 libc_hidden_def (_IO_enable_locks)
 
 void
-_IO_old_init (_IO_FILE *fp, int flags)
+_IO_old_init (FILE *fp, int flags)
 {
   fp->_flags = _IO_MAGIC|flags;
   fp->_flags2 = 0;
@@ -585,7 +585,7 @@ _IO_old_init (_IO_FILE *fp, int flags)
 }
 
 void
-_IO_no_init (_IO_FILE *fp, int flags, int orientation,
+_IO_no_init (FILE *fp, int flags, int orientation,
 	     struct _IO_wide_data *wd, const struct _IO_jump_t *jmp)
 {
   _IO_old_init (fp, flags);
@@ -615,7 +615,7 @@ _IO_no_init (_IO_FILE *fp, int flags, int orientation,
 }
 
 int
-_IO_default_sync (_IO_FILE *fp)
+_IO_default_sync (FILE *fp)
 {
   return 0;
 }
@@ -624,7 +624,7 @@ _IO_default_sync (_IO_FILE *fp)
    current implementation, this function can get called twice! */
 
 void
-_IO_default_finish (_IO_FILE *fp, int dummy)
+_IO_default_finish (FILE *fp, int dummy)
 {
   struct _IO_marker *mark;
   if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
@@ -651,14 +651,14 @@ _IO_default_finish (_IO_FILE *fp, int dummy)
 }
 libc_hidden_def (_IO_default_finish)
 
-_IO_off64_t
-_IO_default_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
+off64_t
+_IO_default_seekoff (FILE *fp, off64_t offset, int dir, int mode)
 {
   return _IO_pos_BAD;
 }
 
 int
-_IO_sputbackc (_IO_FILE *fp, int c)
+_IO_sputbackc (FILE *fp, int c)
 {
   int result;
 
@@ -679,7 +679,7 @@ _IO_sputbackc (_IO_FILE *fp, int c)
 libc_hidden_def (_IO_sputbackc)
 
 int
-_IO_sungetc (_IO_FILE *fp)
+_IO_sungetc (FILE *fp)
 {
   int result;
 
@@ -701,7 +701,7 @@ _IO_sungetc (_IO_FILE *fp)
 /* Seems not to be needed.  */
 #if 0
 void
-_IO_set_column (_IO_FILE *fp, int c)
+_IO_set_column (FILE *fp, int c)
 {
   if (c == -1)
     fp->_column = -1;
@@ -710,7 +710,7 @@ _IO_set_column (_IO_FILE *fp, int c)
 }
 #else
 int
-_IO_set_column (_IO_FILE *fp, int i)
+_IO_set_column (FILE *fp, int i)
 {
   fp->_cur_column = i + 1;
   return 0;
@@ -733,7 +733,7 @@ libc_hidden_def (_IO_adjust_column)
 #if 0
 /* Seems not to be needed. --drepper */
 int
-_IO_get_column (_IO_FILE *fp)
+_IO_get_column (FILE *fp)
 {
   if (fp->_cur_column)
     return _IO_adjust_column (fp->_cur_column - 1,
@@ -748,14 +748,14 @@ int
 _IO_flush_all_lockp (int do_lock)
 {
   int result = 0;
-  struct _IO_FILE *fp;
+  FILE *fp;
 
 #ifdef _IO_MTSAFE_IO
   _IO_cleanup_region_start_noarg (flush_cleanup);
   _IO_lock_lock (list_all_lock);
 #endif
 
-  for (fp = (_IO_FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
+  for (fp = (FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
     {
       run_fp = fp;
       if (do_lock)
@@ -794,14 +794,14 @@ libc_hidden_def (_IO_flush_all)
 void
 _IO_flush_all_linebuffered (void)
 {
-  struct _IO_FILE *fp;
+  FILE *fp;
 
 #ifdef _IO_MTSAFE_IO
   _IO_cleanup_region_start_noarg (flush_cleanup);
   _IO_lock_lock (list_all_lock);
 #endif
 
-  for (fp = (_IO_FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
+  for (fp = (FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
     {
       run_fp = fp;
       _IO_flockfile (fp);
@@ -838,19 +838,19 @@ weak_alias (_IO_flush_all_linebuffered, _flushlbf)
 static void _IO_unbuffer_all (void);
 
 static bool dealloc_buffers;
-static _IO_FILE *freeres_list;
+static FILE *freeres_list;
 
 static void
 _IO_unbuffer_all (void)
 {
-  struct _IO_FILE *fp;
+  FILE *fp;
 
 #ifdef _IO_MTSAFE_IO
   _IO_cleanup_region_start_noarg (flush_cleanup);
   _IO_lock_lock (list_all_lock);
 #endif
 
-  for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
+  for (fp = (FILE *) _IO_list_all; fp; fp = fp->_chain)
     {
       if (! (fp->_flags & _IO_UNBUFFERED)
 	  /* Iff stream is un-orientated, it wasn't used. */
@@ -934,7 +934,7 @@ _IO_cleanup (void)
 
 
 void
-_IO_init_marker (struct _IO_marker *marker, _IO_FILE *fp)
+_IO_init_marker (struct _IO_marker *marker, FILE *fp)
 {
   marker->_sbuf = fp;
   if (_IO_in_put_mode (fp))
@@ -993,7 +993,7 @@ _IO_marker_delta (struct _IO_marker *mark)
 }
 
 int
-_IO_seekmark (_IO_FILE *fp, struct _IO_marker *mark, int delta)
+_IO_seekmark (FILE *fp, struct _IO_marker *mark, int delta)
 {
   if (mark->_sbuf != fp)
     return EOF;
@@ -1013,7 +1013,7 @@ _IO_seekmark (_IO_FILE *fp, struct _IO_marker *mark, int delta)
 }
 
 void
-_IO_unsave_markers (_IO_FILE *fp)
+_IO_unsave_markers (FILE *fp)
 {
   struct _IO_marker *mark = fp->_markers;
   if (mark)
@@ -1043,7 +1043,7 @@ libc_hidden_def (_IO_unsave_markers)
 #if 0
 /* Seems not to be needed. --drepper */
 int
-_IO_nobackup_pbackfail (_IO_FILE *fp, int c)
+_IO_nobackup_pbackfail (FILE *fp, int c)
 {
   if (fp->_IO_read_ptr > fp->_IO_read_base)
 	fp->_IO_read_ptr--;
@@ -1054,7 +1054,7 @@ _IO_nobackup_pbackfail (_IO_FILE *fp, int c)
 #endif
 
 int
-_IO_default_pbackfail (_IO_FILE *fp, int c)
+_IO_default_pbackfail (FILE *fp, int c)
 {
   if (fp->_IO_read_ptr > fp->_IO_read_base && !_IO_in_backup (fp)
       && (unsigned char) fp->_IO_read_ptr[-1] == c)
@@ -1089,8 +1089,8 @@ _IO_default_pbackfail (_IO_FILE *fp, int c)
       else if (fp->_IO_read_ptr <= fp->_IO_read_base)
 	{
 	  /* Increase size of existing backup buffer. */
-	  _IO_size_t new_size;
-	  _IO_size_t old_size = fp->_IO_read_end - fp->_IO_read_base;
+	  size_t new_size;
+	  size_t old_size = fp->_IO_read_end - fp->_IO_read_base;
 	  char *new_buf;
 	  new_size = 2 * old_size;
 	  new_buf = (char *) malloc (new_size);
@@ -1110,38 +1110,38 @@ _IO_default_pbackfail (_IO_FILE *fp, int c)
 }
 libc_hidden_def (_IO_default_pbackfail)
 
-_IO_off64_t
-_IO_default_seek (_IO_FILE *fp, _IO_off64_t offset, int dir)
+off64_t
+_IO_default_seek (FILE *fp, off64_t offset, int dir)
 {
   return _IO_pos_BAD;
 }
 
 int
-_IO_default_stat (_IO_FILE *fp, void *st)
+_IO_default_stat (FILE *fp, void *st)
 {
   return EOF;
 }
 
-_IO_ssize_t
-_IO_default_read (_IO_FILE *fp, void *data, _IO_ssize_t n)
+ssize_t
+_IO_default_read (FILE *fp, void *data, ssize_t n)
 {
   return -1;
 }
 
-_IO_ssize_t
-_IO_default_write (_IO_FILE *fp, const void *data, _IO_ssize_t n)
+ssize_t
+_IO_default_write (FILE *fp, const void *data, ssize_t n)
 {
   return 0;
 }
 
 int
-_IO_default_showmanyc (_IO_FILE *fp)
+_IO_default_showmanyc (FILE *fp)
 {
   return -1;
 }
 
 void
-_IO_default_imbue (_IO_FILE *fp, void *locale)
+_IO_default_imbue (FILE *fp, void *locale)
 {
 }
 
@@ -1166,7 +1166,7 @@ _IO_iter_next (_IO_ITER iter)
 }
 libc_hidden_def (_IO_iter_next)
 
-_IO_FILE *
+FILE *
 _IO_iter_file (_IO_ITER iter)
 {
   return iter;
diff --git a/libio/iofclose.c b/libio/iofclose.c
index 19a25096c77..c7c44ed9b47 100644
--- a/libio/iofclose.c
+++ b/libio/iofclose.c
@@ -30,7 +30,7 @@
 #include <shlib-compat.h>
 
 int
-_IO_new_fclose (_IO_FILE *fp)
+_IO_new_fclose (FILE *fp)
 {
   int status;
 
diff --git a/libio/iofdopen.c b/libio/iofdopen.c
index b6f1500dee4..39617365f53 100644
--- a/libio/iofdopen.c
+++ b/libio/iofdopen.c
@@ -30,7 +30,7 @@
 
 #include <shlib-compat.h>
 
-_IO_FILE *
+FILE *
 _IO_new_fdopen (int fd, const char *mode)
 {
   int read_write;
@@ -157,7 +157,7 @@ _IO_new_fdopen (int fd, const char *mode)
   if (do_seek && ((read_write & (_IO_IS_APPENDING | _IO_NO_READS))
 		  == (_IO_IS_APPENDING | _IO_NO_READS)))
     {
-      _IO_off64_t new_pos = _IO_SYSSEEK (&new_f->fp.file, 0, _IO_seek_end);
+      off64_t new_pos = _IO_SYSSEEK (&new_f->fp.file, 0, _IO_seek_end);
       if (new_pos == _IO_pos_BAD && errno != ESPIPE)
 	return NULL;
     }
diff --git a/libio/iofflush.c b/libio/iofflush.c
index 4a95863338a..5f3a3246a96 100644
--- a/libio/iofflush.c
+++ b/libio/iofflush.c
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 int
-_IO_fflush (_IO_FILE *fp)
+_IO_fflush (FILE *fp)
 {
   if (fp == NULL)
     return _IO_flush_all ();
diff --git a/libio/iofflush_u.c b/libio/iofflush_u.c
index 344f7cfe100..aff264a0b37 100644
--- a/libio/iofflush_u.c
+++ b/libio/iofflush_u.c
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 int
-__fflush_unlocked (_IO_FILE *fp)
+__fflush_unlocked (FILE *fp)
 {
   if (fp == NULL)
     return _IO_flush_all ();
diff --git a/libio/iofgetpos.c b/libio/iofgetpos.c
index aa02481cccf..8177326c9c5 100644
--- a/libio/iofgetpos.c
+++ b/libio/iofgetpos.c
@@ -42,9 +42,9 @@
 #include <shlib-compat.h>
 
 int
-_IO_new_fgetpos (_IO_FILE *fp, _IO_fpos_t *posp)
+_IO_new_fgetpos (FILE *fp, __fpos_t *posp)
 {
-  _IO_off64_t pos;
+  off64_t pos;
   int result = 0;
   CHECK_FILE (fp, EOF);
   _IO_acquire_lock (fp);
@@ -62,7 +62,7 @@ _IO_new_fgetpos (_IO_FILE *fp, _IO_fpos_t *posp)
 	__set_errno (EIO);
       result = EOF;
     }
-  else if ((_IO_off64_t) (__typeof (posp->__pos)) pos != pos)
+  else if ((off64_t) (__typeof (posp->__pos)) pos != pos)
     {
       __set_errno (EOVERFLOW);
       result = EOF;
diff --git a/libio/iofgetpos64.c b/libio/iofgetpos64.c
index da3550622be..0ec54131972 100644
--- a/libio/iofgetpos64.c
+++ b/libio/iofgetpos64.c
@@ -31,9 +31,9 @@
 #ifndef __OFF_T_MATCHES_OFF64_T
 
 int
-_IO_new_fgetpos64 (_IO_FILE *fp, _IO_fpos64_t *posp)
+_IO_new_fgetpos64 (FILE *fp, __fpos64_t *posp)
 {
-  _IO_off64_t pos;
+  off64_t pos;
   int result = 0;
   CHECK_FILE (fp, EOF);
   _IO_acquire_lock (fp);
diff --git a/libio/iofgets.c b/libio/iofgets.c
index c5d27a649d7..b15b59d3bf6 100644
--- a/libio/iofgets.c
+++ b/libio/iofgets.c
@@ -28,9 +28,9 @@
 #include <stdio.h>
 
 char *
-_IO_fgets (char *buf, int n, _IO_FILE *fp)
+_IO_fgets (char *buf, int n, FILE *fp)
 {
-  _IO_size_t count;
+  size_t count;
   char *result;
   int old_error;
   CHECK_FILE (fp, NULL);
diff --git a/libio/iofgets_u.c b/libio/iofgets_u.c
index ec82df18f4d..90916446857 100644
--- a/libio/iofgets_u.c
+++ b/libio/iofgets_u.c
@@ -28,9 +28,9 @@
 #include <stdio.h>
 
 char *
-__fgets_unlocked (char *buf, int n, _IO_FILE *fp)
+__fgets_unlocked (char *buf, int n, FILE *fp)
 {
-  _IO_size_t count;
+  size_t count;
   char *result;
   int old_error;
   CHECK_FILE (fp, NULL);
diff --git a/libio/iofgetws.c b/libio/iofgetws.c
index ad3717cc2df..0e2d515df5e 100644
--- a/libio/iofgetws.c
+++ b/libio/iofgetws.c
@@ -28,9 +28,9 @@
 #include <wchar.h>
 
 wchar_t *
-fgetws (wchar_t *buf, int n, _IO_FILE *fp)
+fgetws (wchar_t *buf, int n, FILE *fp)
 {
-  _IO_size_t count;
+  size_t count;
   wchar_t *result;
   int old_error;
   CHECK_FILE (fp, NULL);
diff --git a/libio/iofgetws_u.c b/libio/iofgetws_u.c
index 664939f86da..a930b47a6df 100644
--- a/libio/iofgetws_u.c
+++ b/libio/iofgetws_u.c
@@ -28,9 +28,9 @@
 #include <wchar.h>
 
 wchar_t *
-fgetws_unlocked (wchar_t *buf, int n, _IO_FILE *fp)
+fgetws_unlocked (wchar_t *buf, int n, FILE *fp)
 {
-  _IO_size_t count;
+  size_t count;
   wchar_t *result;
   int old_error;
   CHECK_FILE (fp, NULL);
diff --git a/libio/iofopen.c b/libio/iofopen.c
index 2ea82e20917..f17ec914579 100644
--- a/libio/iofopen.c
+++ b/libio/iofopen.c
@@ -30,8 +30,8 @@
 #include <stddef.h>
 #include <shlib-compat.h>
 
-_IO_FILE *
-__fopen_maybe_mmap (_IO_FILE *fp)
+FILE *
+__fopen_maybe_mmap (FILE *fp)
 {
 #if _G_HAVE_MMAP
   if ((fp->_flags2 & _IO_FLAGS2_MMAP) && (fp->_flags & _IO_NO_WRITES))
@@ -52,7 +52,7 @@ __fopen_maybe_mmap (_IO_FILE *fp)
 }
 
 
-_IO_FILE *
+FILE *
 __fopen_internal (const char *filename, const char *mode, int is32)
 {
   struct locked_FILE
@@ -75,7 +75,7 @@ __fopen_internal (const char *filename, const char *mode, int is32)
 #if  !_IO_UNIFIED_JUMPTABLES
   new_f->fp.vtable = NULL;
 #endif
-  if (_IO_file_fopen ((_IO_FILE *) new_f, filename, mode, is32) != NULL)
+  if (_IO_file_fopen ((FILE *) new_f, filename, mode, is32) != NULL)
     return __fopen_maybe_mmap (&new_f->fp.file);
 
   _IO_un_link (&new_f->fp);
@@ -83,7 +83,7 @@ __fopen_internal (const char *filename, const char *mode, int is32)
   return NULL;
 }
 
-_IO_FILE *
+FILE *
 _IO_new_fopen (const char *filename, const char *mode)
 {
   return __fopen_internal (filename, mode, 1);
diff --git a/libio/iofopen64.c b/libio/iofopen64.c
index 60d58c6ed5f..e3c7c299038 100644
--- a/libio/iofopen64.c
+++ b/libio/iofopen64.c
@@ -31,7 +31,7 @@
 /* iofopen.c defines _IO_fopen64/fopen64 as aliases if O_LARGEFILE==0.  */
 #if defined O_LARGEFILE && O_LARGEFILE != 0
 
-_IO_FILE *
+FILE *
 _IO_fopen64 (const char *filename, const char *mode)
 {
   return __fopen_internal (filename, mode, 0);
diff --git a/libio/iofopncook.c b/libio/iofopncook.c
index b39b4c364f3..43a87fe4be9 100644
--- a/libio/iofopncook.c
+++ b/libio/iofopncook.c
@@ -29,18 +29,8 @@
 #include <stdlib.h>
 #include <shlib-compat.h>
 
-/* Prototyped for local functions.  */
-static _IO_ssize_t _IO_cookie_read (_IO_FILE* fp, void* buf,
-				    _IO_ssize_t size);
-static _IO_ssize_t _IO_cookie_write (_IO_FILE* fp,
-				     const void* buf, _IO_ssize_t size);
-static _IO_off64_t _IO_cookie_seek (_IO_FILE *fp, _IO_off64_t offset, int dir);
-static _IO_off64_t _IO_cookie_seekoff (_IO_FILE *fp, _IO_off64_t offset,
-				       int dir, int mode);
-static int _IO_cookie_close (_IO_FILE* fp);
-
-static _IO_ssize_t
-_IO_cookie_read (_IO_FILE *fp, void *buf, _IO_ssize_t size)
+static ssize_t
+_IO_cookie_read (FILE *fp, void *buf, ssize_t size)
 {
   struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
   cookie_read_function_t *read_cb = cfile->__io_functions.read;
@@ -54,8 +44,8 @@ _IO_cookie_read (_IO_FILE *fp, void *buf, _IO_ssize_t size)
   return read_cb (cfile->__cookie, buf, size);
 }
 
-static _IO_ssize_t
-_IO_cookie_write (_IO_FILE *fp, const void *buf, _IO_ssize_t size)
+static ssize_t
+_IO_cookie_write (FILE *fp, const void *buf, ssize_t size)
 {
   struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
   cookie_write_function_t *write_cb = cfile->__io_functions.write;
@@ -69,15 +59,15 @@ _IO_cookie_write (_IO_FILE *fp, const void *buf, _IO_ssize_t size)
       return 0;
     }
 
-  _IO_ssize_t n = write_cb (cfile->__cookie, buf, size);
+  ssize_t n = write_cb (cfile->__cookie, buf, size);
   if (n < size)
     fp->_flags |= _IO_ERR_SEEN;
 
   return n;
 }
 
-static _IO_off64_t
-_IO_cookie_seek (_IO_FILE *fp, _IO_off64_t offset, int dir)
+static off64_t
+_IO_cookie_seek (FILE *fp, off64_t offset, int dir)
 {
   struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
   cookie_seek_function_t *seek_cb = cfile->__io_functions.seek;
@@ -88,12 +78,12 @@ _IO_cookie_seek (_IO_FILE *fp, _IO_off64_t offset, int dir)
   return ((seek_cb == NULL
 	   || (seek_cb (cfile->__cookie, &offset, dir)
 	       == -1)
-	   || offset == (_IO_off64_t) -1)
+	   || offset == (off64_t) -1)
 	  ? _IO_pos_BAD : offset);
 }
 
 static int
-_IO_cookie_close (_IO_FILE *fp)
+_IO_cookie_close (FILE *fp)
 {
   struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
   cookie_close_function_t *close_cb = cfile->__io_functions.close;
@@ -108,8 +98,8 @@ _IO_cookie_close (_IO_FILE *fp)
 }
 
 
-static _IO_off64_t
-_IO_cookie_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
+static off64_t
+_IO_cookie_seekoff (FILE *fp, off64_t offset, int dir, int mode)
 {
   /* We must force the fileops code to always use seek to determine
      the position.  */
@@ -145,8 +135,8 @@ static const struct _IO_jump_t _IO_cookie_jumps libio_vtable = {
 /* Copy the callbacks from SOURCE to *TARGET, with pointer
    mangling.  */
 static void
-set_callbacks (_IO_cookie_io_functions_t *target,
-	       _IO_cookie_io_functions_t source)
+set_callbacks (cookie_io_functions_t *target,
+	       cookie_io_functions_t source)
 {
 #ifdef PTR_MANGLE
   PTR_MANGLE (source.read);
@@ -159,7 +149,7 @@ set_callbacks (_IO_cookie_io_functions_t *target,
 
 void
 _IO_cookie_init (struct _IO_cookie_file *cfile, int read_write,
-		 void *cookie, _IO_cookie_io_functions_t io_functions)
+		 void *cookie, cookie_io_functions_t io_functions)
 {
   _IO_init_internal (&cfile->__fp.file, 0);
   _IO_JUMPS (&cfile->__fp) = &_IO_cookie_jumps;
@@ -181,9 +171,9 @@ _IO_cookie_init (struct _IO_cookie_file *cfile, int read_write,
 }
 
 
-_IO_FILE *
+FILE *
 _IO_fopencookie (void *cookie, const char *mode,
-		 _IO_cookie_io_functions_t io_functions)
+		 cookie_io_functions_t io_functions)
 {
   int read_write;
   struct locked_FILE
@@ -221,25 +211,20 @@ _IO_fopencookie (void *cookie, const char *mode,
 
   _IO_cookie_init (&new_f->cfile, read_write, cookie, io_functions);
 
-  return (_IO_FILE *) &new_f->cfile.__fp;
+  return (FILE *) &new_f->cfile.__fp;
 }
 
 versioned_symbol (libc, _IO_fopencookie, fopencookie, GLIBC_2_2);
 
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
 
-static _IO_off64_t _IO_old_cookie_seek (_IO_FILE *fp, _IO_off64_t offset,
-					int dir);
-_IO_FILE * _IO_old_fopencookie (void *cookie, const char *mode,
-				_IO_cookie_io_functions_t io_functions);
-
-static _IO_off64_t
+static off64_t
 attribute_compat_text_section
-_IO_old_cookie_seek (_IO_FILE *fp, _IO_off64_t offset, int dir)
+_IO_old_cookie_seek (FILE *fp, off64_t offset, int dir)
 {
   struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
-  int (*seek_cb) (_IO_FILE *, _IO_off_t, int)
-    = (int (*) (_IO_FILE *, _IO_off_t, int)) cfile->__io_functions.seek;;
+  int (*seek_cb) (FILE *, off_t, int)
+    = (int (*) (FILE *, off_t, int)) cfile->__io_functions.seek;
 #ifdef PTR_DEMANGLE
   PTR_DEMANGLE (seek_cb);
 #endif
@@ -275,12 +260,12 @@ static const struct _IO_jump_t _IO_old_cookie_jumps libio_vtable = {
   JUMP_INIT(imbue, _IO_default_imbue),
 };
 
-_IO_FILE *
+FILE *
 attribute_compat_text_section
 _IO_old_fopencookie (void *cookie, const char *mode,
-		     _IO_cookie_io_functions_t io_functions)
+		     cookie_io_functions_t io_functions)
 {
-  _IO_FILE *ret;
+  FILE *ret;
 
   ret = _IO_fopencookie (cookie, mode, io_functions);
   if (ret != NULL)
diff --git a/libio/iofputs.c b/libio/iofputs.c
index b4fbeb5e609..0a9685a228a 100644
--- a/libio/iofputs.c
+++ b/libio/iofputs.c
@@ -28,9 +28,9 @@
 #include <string.h>
 
 int
-_IO_fputs (const char *str, _IO_FILE *fp)
+_IO_fputs (const char *str, FILE *fp)
 {
-  _IO_size_t len = strlen (str);
+  size_t len = strlen (str);
   int result = EOF;
   CHECK_FILE (fp, EOF);
   _IO_acquire_lock (fp);
diff --git a/libio/iofputs_u.c b/libio/iofputs_u.c
index 7c7f6e8d2b0..94309b48a2d 100644
--- a/libio/iofputs_u.c
+++ b/libio/iofputs_u.c
@@ -29,9 +29,9 @@
 #include <string.h>
 
 int
-__fputs_unlocked (const char *str, _IO_FILE *fp)
+__fputs_unlocked (const char *str, FILE *fp)
 {
-  _IO_size_t len = strlen (str);
+  size_t len = strlen (str);
   int result = EOF;
   CHECK_FILE (fp, EOF);
   if (_IO_fwide (fp, -1) == -1 && _IO_sputn (fp, str, len) == len)
diff --git a/libio/iofputws.c b/libio/iofputws.c
index 47c8e03e26f..70b1f064d22 100644
--- a/libio/iofputws.c
+++ b/libio/iofputws.c
@@ -28,9 +28,9 @@
 #include <wchar.h>
 
 int
-fputws (const wchar_t *str, _IO_FILE *fp)
+fputws (const wchar_t *str, FILE *fp)
 {
-  _IO_size_t len = __wcslen (str);
+  size_t len = __wcslen (str);
   int result = EOF;
   CHECK_FILE (fp, EOF);
   _IO_acquire_lock (fp);
diff --git a/libio/iofputws_u.c b/libio/iofputws_u.c
index 3fb11ab5e7c..7d035751c73 100644
--- a/libio/iofputws_u.c
+++ b/libio/iofputws_u.c
@@ -29,9 +29,9 @@
 #include <wchar.h>
 
 int
-fputws_unlocked (const wchar_t *str, _IO_FILE *fp)
+fputws_unlocked (const wchar_t *str, FILE *fp)
 {
-  _IO_size_t len = __wcslen (str);
+  size_t len = __wcslen (str);
   int result = EOF;
   CHECK_FILE (fp, EOF);
   if (_IO_fwide (fp, 1) == 1
diff --git a/libio/iofread.c b/libio/iofread.c
index 0c00e321e0f..5ed05e9dbee 100644
--- a/libio/iofread.c
+++ b/libio/iofread.c
@@ -26,11 +26,11 @@
 
 #include "libioP.h"
 
-_IO_size_t
-_IO_fread (void *buf, _IO_size_t size, _IO_size_t count, _IO_FILE *fp)
+size_t
+_IO_fread (void *buf, size_t size, size_t count, FILE *fp)
 {
-  _IO_size_t bytes_requested = size * count;
-  _IO_size_t bytes_read;
+  size_t bytes_requested = size * count;
+  size_t bytes_read;
   CHECK_FILE (fp, 0);
   if (bytes_requested == 0)
     return 0;
diff --git a/libio/iofread_u.c b/libio/iofread_u.c
index 854bdfc329b..2c3baf99f31 100644
--- a/libio/iofread_u.c
+++ b/libio/iofread_u.c
@@ -29,11 +29,11 @@
 
 #undef fread_unlocked
 
-_IO_size_t
-__fread_unlocked (void *buf, _IO_size_t size, _IO_size_t count, _IO_FILE *fp)
+size_t
+__fread_unlocked (void *buf, size_t size, size_t count, FILE *fp)
 {
-  _IO_size_t bytes_requested = size * count;
-  _IO_size_t bytes_read;
+  size_t bytes_requested = size * count;
+  size_t bytes_read;
   CHECK_FILE (fp, 0);
   if (bytes_requested == 0)
     return 0;
diff --git a/libio/iofsetpos.c b/libio/iofsetpos.c
index b82cb22d10b..da48b27c3b9 100644
--- a/libio/iofsetpos.c
+++ b/libio/iofsetpos.c
@@ -41,7 +41,7 @@
 #include <shlib-compat.h>
 
 int
-_IO_new_fsetpos (_IO_FILE *fp, const _IO_fpos_t *posp)
+_IO_new_fsetpos (FILE *fp, const __fpos_t *posp)
 {
   int result;
   CHECK_FILE (fp, EOF);
diff --git a/libio/iofsetpos64.c b/libio/iofsetpos64.c
index 44e8c21d843..29da9814884 100644
--- a/libio/iofsetpos64.c
+++ b/libio/iofsetpos64.c
@@ -31,7 +31,7 @@
 #ifndef __OFF_T_MATCHES_OFF64_T
 
 int
-_IO_new_fsetpos64 (_IO_FILE *fp, const _IO_fpos64_t *posp)
+_IO_new_fsetpos64 (FILE *fp, const fpos64_t *posp)
 {
   int result;
   CHECK_FILE (fp, EOF);
diff --git a/libio/ioftell.c b/libio/ioftell.c
index 3f0501570f5..571a648788e 100644
--- a/libio/ioftell.c
+++ b/libio/ioftell.c
@@ -30,9 +30,9 @@
 /* ANSI explicily requires setting errno to a positive value on failure. */
 
 long int
-_IO_ftell (_IO_FILE *fp)
+_IO_ftell (FILE *fp)
 {
-  _IO_off64_t pos;
+  off64_t pos;
   CHECK_FILE (fp, -1L);
   _IO_acquire_lock (fp);
   pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
@@ -48,7 +48,7 @@ _IO_ftell (_IO_FILE *fp)
 	__set_errno (EIO);
       return -1L;
     }
-  if ((_IO_off64_t) (long int) pos != pos)
+  if ((off64_t) (long int) pos != pos)
     {
       __set_errno (EOVERFLOW);
       return -1L;
diff --git a/libio/iofwide.c b/libio/iofwide.c
index 96f41930e10..d8ec66428e6 100644
--- a/libio/iofwide.c
+++ b/libio/iofwide.c
@@ -58,7 +58,7 @@ static enum __codecvt_result do_in (struct _IO_codecvt *codecvt,
 static int do_encoding (struct _IO_codecvt *codecvt);
 static int do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
 		      const char *from_start,
-		      const char *from_end, _IO_size_t max);
+		      const char *from_end, size_t max);
 static int do_max_length (struct _IO_codecvt *codecvt);
 static int do_always_noconv (struct _IO_codecvt *codecvt);
 
@@ -81,7 +81,7 @@ const struct _IO_codecvt __libio_codecvt =
    the orientation first.  */
 #undef _IO_fwide
 int
-_IO_fwide (_IO_FILE *fp, int mode)
+_IO_fwide (FILE *fp, int mode)
 {
   /* Normalize the value.  */
   mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
@@ -327,7 +327,7 @@ do_always_noconv (struct _IO_codecvt *codecvt)
 
 static int
 do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
-	   const char *from_start, const char *from_end, _IO_size_t max)
+	   const char *from_start, const char *from_end, size_t max)
 {
   int result;
   const unsigned char *cp = (const unsigned char *) from_start;
diff --git a/libio/iofwrite.c b/libio/iofwrite.c
index 443c53517c4..800341b7da5 100644
--- a/libio/iofwrite.c
+++ b/libio/iofwrite.c
@@ -26,11 +26,11 @@
 
 #include "libioP.h"
 
-_IO_size_t
-_IO_fwrite (const void *buf, _IO_size_t size, _IO_size_t count, _IO_FILE *fp)
+size_t
+_IO_fwrite (const void *buf, size_t size, size_t count, FILE *fp)
 {
-  _IO_size_t request = size * count;
-  _IO_size_t written = 0;
+  size_t request = size * count;
+  size_t written = 0;
   CHECK_FILE (fp, 0);
   if (request == 0)
     return 0;
diff --git a/libio/iofwrite_u.c b/libio/iofwrite_u.c
index 67a01a01e65..71ac6266c0b 100644
--- a/libio/iofwrite_u.c
+++ b/libio/iofwrite_u.c
@@ -29,12 +29,11 @@
 
 #undef fwrite_unlocked
 
-_IO_size_t
-fwrite_unlocked (const void *buf, _IO_size_t size, _IO_size_t count,
-		 _IO_FILE *fp)
+size_t
+fwrite_unlocked (const void *buf, size_t size, size_t count, FILE *fp)
 {
-  _IO_size_t request = size * count;
-  _IO_size_t written = 0;
+  size_t request = size * count;
+  size_t written = 0;
   CHECK_FILE (fp, 0);
   if (request == 0)
     return 0;
diff --git a/libio/iogetdelim.c b/libio/iogetdelim.c
index 8d9cfa27c74..f5b0991be8c 100644
--- a/libio/iogetdelim.c
+++ b/libio/iogetdelim.c
@@ -36,12 +36,12 @@
    necessary.  Returns the number of characters read (not including the
    null terminator), or -1 on error or EOF.  */
 
-_IO_ssize_t
-_IO_getdelim (char **lineptr, _IO_size_t *n, int delimiter, _IO_FILE *fp)
+ssize_t
+_IO_getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
 {
-  _IO_ssize_t result;
-  _IO_ssize_t cur_len = 0;
-  _IO_ssize_t len;
+  ssize_t result;
+  ssize_t cur_len = 0;
+  ssize_t len;
 
   if (lineptr == NULL || n == NULL)
     {
@@ -80,7 +80,7 @@ _IO_getdelim (char **lineptr, _IO_size_t *n, int delimiter, _IO_FILE *fp)
 
   for (;;)
     {
-      _IO_size_t needed;
+      size_t needed;
       char *t;
       t = (char *) memchr ((void *) fp->_IO_read_ptr, delimiter, len);
       if (t != NULL)
diff --git a/libio/iogetline.c b/libio/iogetline.c
index 119b7862af3..8deeacee081 100644
--- a/libio/iogetline.c
+++ b/libio/iogetline.c
@@ -27,8 +27,8 @@
 #include "libioP.h"
 #include <string.h>
 
-_IO_size_t
-_IO_getline (_IO_FILE *fp, char *buf, _IO_size_t n, int delim,
+size_t
+_IO_getline (FILE *fp, char *buf, size_t n, int delim,
 	     int extract_delim)
 {
   return _IO_getline_info (fp, buf, n, delim, extract_delim, (int *) 0);
@@ -43,8 +43,8 @@ libc_hidden_def (_IO_getline)
    If extract_delim < 0, leave delimiter unread.
    If extract_delim > 0, insert delim in output. */
 
-_IO_size_t
-_IO_getline_info (_IO_FILE *fp, char *buf, _IO_size_t n, int delim,
+size_t
+_IO_getline_info (FILE *fp, char *buf, size_t n, int delim,
 		  int extract_delim, int *eof)
 {
   char *ptr = buf;
@@ -54,7 +54,7 @@ _IO_getline_info (_IO_FILE *fp, char *buf, _IO_size_t n, int delim,
     _IO_fwide (fp, -1);
   while (n != 0)
     {
-      _IO_ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr;
+      ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr;
       if (len <= 0)
 	{
 	  int c = __uflow (fp);
@@ -80,12 +80,12 @@ _IO_getline_info (_IO_FILE *fp, char *buf, _IO_size_t n, int delim,
       else
 	{
 	  char *t;
-	  if ((_IO_size_t) len >= n)
+	  if ((size_t) len >= n)
 	    len = n;
 	  t = (char *) memchr ((void *) fp->_IO_read_ptr, delim, len);
 	  if (t != NULL)
 	    {
-	      _IO_size_t old_len = ptr-buf;
+	      size_t old_len = ptr-buf;
 	      len = t - fp->_IO_read_ptr;
 	      if (extract_delim >= 0)
 		{
diff --git a/libio/iogets.c b/libio/iogets.c
index e1282a9a8f7..19048f6d03d 100644
--- a/libio/iogets.c
+++ b/libio/iogets.c
@@ -30,7 +30,7 @@
 char *
 _IO_gets (char *buf)
 {
-  _IO_size_t count;
+  size_t count;
   int ch;
   char *retval;
 
diff --git a/libio/iogetwline.c b/libio/iogetwline.c
index f87c43350f3..e5f0a63ab3e 100644
--- a/libio/iogetwline.c
+++ b/libio/iogetwline.c
@@ -28,8 +28,8 @@
 #include <string.h>
 #include <wchar.h>
 
-_IO_size_t
-_IO_getwline (_IO_FILE *fp, wchar_t *buf, _IO_size_t n, wint_t delim,
+size_t
+_IO_getwline (FILE *fp, wchar_t *buf, size_t n, wint_t delim,
 	      int extract_delim)
 {
   return _IO_getwline_info (fp, buf, n, delim, extract_delim, (wint_t *) 0);
@@ -43,8 +43,8 @@ _IO_getwline (_IO_FILE *fp, wchar_t *buf, _IO_size_t n, wint_t delim,
    If extract_delim < 0, leave delimiter unread.
    If extract_delim > 0, insert delim in output. */
 
-_IO_size_t
-_IO_getwline_info (_IO_FILE *fp, wchar_t *buf, _IO_size_t n, wint_t delim,
+size_t
+_IO_getwline_info (FILE *fp, wchar_t *buf, size_t n, wint_t delim,
 		   int extract_delim, wint_t *eof)
 {
   wchar_t *ptr = buf;
@@ -54,7 +54,7 @@ _IO_getwline_info (_IO_FILE *fp, wchar_t *buf, _IO_size_t n, wint_t delim,
     _IO_fwide (fp, 1);
   while (n != 0)
     {
-      _IO_ssize_t len = (fp->_wide_data->_IO_read_end
+      ssize_t len = (fp->_wide_data->_IO_read_end
 			 - fp->_wide_data->_IO_read_ptr);
       if (len <= 0)
 	{
@@ -81,12 +81,12 @@ _IO_getwline_info (_IO_FILE *fp, wchar_t *buf, _IO_size_t n, wint_t delim,
       else
 	{
 	  wchar_t *t;
-	  if ((_IO_size_t) len >= n)
+	  if ((size_t) len >= n)
 	    len = n;
 	  t = wmemchr ((void *) fp->_wide_data->_IO_read_ptr, delim, len);
 	  if (t != NULL)
 	    {
-	      _IO_size_t old_len = ptr - buf;
+	      size_t old_len = ptr - buf;
 	      len = t - fp->_wide_data->_IO_read_ptr;
 	      if (extract_delim >= 0)
 		{
diff --git a/libio/iolibio.h b/libio/iolibio.h
index 4d43d0e72db..ceaa33a44bb 100644
--- a/libio/iolibio.h
+++ b/libio/iolibio.h
@@ -4,63 +4,63 @@
 #include <stdio.h>
 #include <libio/libio.h>
 
-/* These emulate stdio functionality, but with a different name
-   (_IO_ungetc instead of ungetc), and using _IO_FILE instead of FILE. */
+/* Alternative names for many of the stdio.h functions, used
+   internally and exposed for backward compatibility's sake.  */
 
-extern int _IO_fclose (_IO_FILE*);
-extern int _IO_new_fclose (_IO_FILE*);
-extern int _IO_old_fclose (_IO_FILE*);
-extern _IO_FILE *_IO_fdopen (int, const char*) __THROW;
+extern int _IO_fclose (FILE*);
+extern int _IO_new_fclose (FILE*);
+extern int _IO_old_fclose (FILE*);
+extern FILE *_IO_fdopen (int, const char*) __THROW;
 libc_hidden_proto (_IO_fdopen)
-extern _IO_FILE *_IO_old_fdopen (int, const char*) __THROW;
-extern _IO_FILE *_IO_new_fdopen (int, const char*) __THROW;
-extern int _IO_fflush (_IO_FILE*);
+extern FILE *_IO_old_fdopen (int, const char*) __THROW;
+extern FILE *_IO_new_fdopen (int, const char*) __THROW;
+extern int _IO_fflush (FILE*);
 libc_hidden_proto (_IO_fflush)
-extern int _IO_fgetpos (_IO_FILE*, _IO_fpos_t*);
-extern int _IO_fgetpos64 (_IO_FILE*, _IO_fpos64_t*);
-extern char* _IO_fgets (char*, int, _IO_FILE*);
-extern _IO_FILE *_IO_fopen (const char*, const char*);
-extern _IO_FILE *_IO_old_fopen (const char*, const char*);
-extern _IO_FILE *_IO_new_fopen (const char*, const char*);
-extern _IO_FILE *_IO_fopen64 (const char*, const char*);
-extern _IO_FILE *__fopen_internal (const char*, const char*, int)
+extern int _IO_fgetpos (FILE*, __fpos_t*);
+extern int _IO_fgetpos64 (FILE*, __fpos64_t*);
+extern char* _IO_fgets (char*, int, FILE*);
+extern FILE *_IO_fopen (const char*, const char*);
+extern FILE *_IO_old_fopen (const char*, const char*);
+extern FILE *_IO_new_fopen (const char*, const char*);
+extern FILE *_IO_fopen64 (const char*, const char*);
+extern FILE *__fopen_internal (const char*, const char*, int)
 	attribute_hidden;
-extern _IO_FILE *__fopen_maybe_mmap (_IO_FILE *) __THROW attribute_hidden;
-extern int _IO_fprintf (_IO_FILE*, const char*, ...);
-extern int _IO_fputs (const char*, _IO_FILE*);
+extern FILE *__fopen_maybe_mmap (FILE *) __THROW attribute_hidden;
+extern int _IO_fprintf (FILE*, const char*, ...);
+extern int _IO_fputs (const char*, FILE*);
 libc_hidden_proto (_IO_fputs)
-extern int _IO_fsetpos (_IO_FILE*, const _IO_fpos_t *);
-extern int _IO_fsetpos64 (_IO_FILE*, const _IO_fpos64_t *);
-extern long int _IO_ftell (_IO_FILE*);
+extern int _IO_fsetpos (FILE*, const __fpos_t *);
+extern int _IO_fsetpos64 (FILE*, const __fpos64_t *);
+extern long int _IO_ftell (FILE*);
 libc_hidden_proto (_IO_ftell)
-extern _IO_size_t _IO_fread (void*, _IO_size_t, _IO_size_t, _IO_FILE*);
+extern size_t _IO_fread (void*, size_t, size_t, FILE*);
 libc_hidden_proto (_IO_fread)
-extern _IO_size_t _IO_fwrite (const void*, _IO_size_t, _IO_size_t, _IO_FILE*);
+extern size_t _IO_fwrite (const void*, size_t, size_t, FILE*);
 libc_hidden_proto (_IO_fwrite)
 extern char* _IO_gets (char*);
 extern void _IO_perror (const char*) __THROW;
 extern int _IO_printf (const char*, ...);
 extern int _IO_puts (const char*);
 extern int _IO_scanf (const char*, ...);
-extern void _IO_setbuffer (_IO_FILE *, char*, _IO_size_t) __THROW;
+extern void _IO_setbuffer (FILE *, char*, size_t) __THROW;
 libc_hidden_proto (_IO_setbuffer)
-extern int _IO_setvbuf (_IO_FILE*, char*, int, _IO_size_t) __THROW;
+extern int _IO_setvbuf (FILE*, char*, int, size_t) __THROW;
 libc_hidden_proto (_IO_setvbuf)
 extern int _IO_sscanf (const char*, const char*, ...) __THROW;
 extern int _IO_sprintf (char *, const char*, ...) __THROW;
-extern int _IO_ungetc (int, _IO_FILE*) __THROW;
-extern int _IO_vsscanf (const char *, const char *, _IO_va_list) __THROW;
-extern int _IO_vsprintf (char*, const char*, _IO_va_list) __THROW;
+extern int _IO_ungetc (int, FILE*) __THROW;
+extern int _IO_vsscanf (const char *, const char *, __gnuc_va_list) __THROW;
+extern int _IO_vsprintf (char*, const char*, __gnuc_va_list) __THROW;
 libc_hidden_proto (_IO_vsprintf)
-extern int _IO_vswprintf (wchar_t*, _IO_size_t, const wchar_t*, _IO_va_list)
+extern int _IO_vswprintf (wchar_t*, size_t, const wchar_t*, __gnuc_va_list)
        __THROW;
 
 struct obstack;
-extern int _IO_obstack_vprintf (struct obstack *, const char *, _IO_va_list)
+extern int _IO_obstack_vprintf (struct obstack *, const char *, __gnuc_va_list)
        __THROW;
 extern int _IO_obstack_printf (struct obstack *, const char *, ...) __THROW;
 #ifndef _IO_pos_BAD
-#define _IO_pos_BAD ((_IO_off64_t)(-1))
+#define _IO_pos_BAD ((off64_t)(-1))
 #endif
 #define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
 #define _IO_fseek(__fp, __offset, __whence) \
@@ -79,16 +79,16 @@ extern int _IO_obstack_printf (struct obstack *, const char *, ...) __THROW;
   (_IO_file_close_it (FP), \
    _IO_file_fopen (FP, FILENAME, MODE, 0))
 #define _IO_fileno(FP) ((FP)->_fileno)
-extern _IO_FILE* _IO_popen (const char*, const char*) __THROW;
-extern _IO_FILE* _IO_new_popen (const char*, const char*) __THROW;
-extern _IO_FILE* _IO_old_popen (const char*, const char*) __THROW;
-extern int __new_pclose (_IO_FILE *) __THROW;
-extern int __old_pclose (_IO_FILE *) __THROW;
+extern FILE* _IO_popen (const char*, const char*) __THROW;
+extern FILE* _IO_new_popen (const char*, const char*) __THROW;
+extern FILE* _IO_old_popen (const char*, const char*) __THROW;
+extern int __new_pclose (FILE *) __THROW;
+extern int __old_pclose (FILE *) __THROW;
 #define _IO_pclose _IO_fclose
-#define _IO_setbuf(_FP, _BUF) _IO_setbuffer (_FP, _BUF, _IO_BUFSIZ)
+#define _IO_setbuf(_FP, _BUF) _IO_setbuffer (_FP, _BUF, BUFSIZ)
 #define _IO_setlinebuf(_FP) _IO_setvbuf (_FP, NULL, 1, 0)
 
-_IO_FILE *__new_freopen (const char *, const char *, _IO_FILE *) __THROW;
-_IO_FILE *__old_freopen (const char *, const char *, _IO_FILE *) __THROW;
+FILE *__new_freopen (const char *, const char *, FILE *) __THROW;
+FILE *__old_freopen (const char *, const char *, FILE *) __THROW;
 
 #endif /* iolibio.h.  */
diff --git a/libio/iopadn.c b/libio/iopadn.c
index bcdc9d1567d..3e6e69aa893 100644
--- a/libio/iopadn.c
+++ b/libio/iopadn.c
@@ -32,14 +32,14 @@ static char const blanks[PADSIZE] =
 static char const zeroes[PADSIZE] =
 {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
 
-_IO_ssize_t
-_IO_padn (_IO_FILE *fp, int pad, _IO_ssize_t count)
+ssize_t
+_IO_padn (FILE *fp, int pad, ssize_t count)
 {
   char padbuf[PADSIZE];
   const char *padptr;
   int i;
-  _IO_size_t written = 0;
-  _IO_size_t w;
+  size_t written = 0;
+  size_t w;
 
   if (pad == ' ')
     padptr = blanks;
diff --git a/libio/iopopen.c b/libio/iopopen.c
index e7bffc42857..efdd0a6f586 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -40,7 +40,7 @@ struct _IO_proc_file
 {
   struct _IO_FILE_plus file;
   /* Following fields must match those in class procbuf (procbuf.h) */
-  _IO_pid_t pid;
+  pid_t pid;
   struct _IO_proc_file *next;
 };
 typedef struct _IO_proc_file _IO_proc_file;
@@ -59,13 +59,13 @@ unlock (void *not_used)
 }
 #endif
 
-_IO_FILE *
-_IO_new_proc_open (_IO_FILE *fp, const char *command, const char *mode)
+FILE *
+_IO_new_proc_open (FILE *fp, const char *command, const char *mode)
 {
   int read_or_write;
   int parent_end, child_end;
   int pipe_fds[2];
-  _IO_pid_t child_pid;
+  pid_t child_pid;
 
   int do_read = 0;
   int do_write = 0;
@@ -136,7 +136,7 @@ _IO_new_proc_open (_IO_FILE *fp, const char *command, const char *mode)
 	 in the new child process." */
       for (p = proc_file_chain; p; p = p->next)
 	{
-	  int fd = _IO_fileno ((_IO_FILE *) p);
+	  int fd = _IO_fileno ((FILE *) p);
 
 	  /* If any stream from previous popen() calls has fileno
 	     child_std_end, it has been already closed by the dup2 syscall
@@ -178,7 +178,7 @@ _IO_new_proc_open (_IO_FILE *fp, const char *command, const char *mode)
   return fp;
 }
 
-_IO_FILE *
+FILE *
 _IO_new_popen (const char *command, const char *mode)
 {
   struct locked_FILE
@@ -188,7 +188,7 @@ _IO_new_popen (const char *command, const char *mode)
     _IO_lock_t lock;
 #endif
   } *new_f;
-  _IO_FILE *fp;
+  FILE *fp;
 
   new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
   if (new_f == NULL)
@@ -204,19 +204,19 @@ _IO_new_popen (const char *command, const char *mode)
   new_f->fpx.file.vtable = NULL;
 #endif
   if (_IO_new_proc_open (fp, command, mode) != NULL)
-    return (_IO_FILE *) &new_f->fpx.file;
+    return (FILE *) &new_f->fpx.file;
   _IO_un_link (&new_f->fpx.file);
   free (new_f);
   return NULL;
 }
 
 int
-_IO_new_proc_close (_IO_FILE *fp)
+_IO_new_proc_close (FILE *fp)
 {
   /* This is not name-space clean. FIXME! */
   int wstatus;
   _IO_proc_file **ptr = &proc_file_chain;
-  _IO_pid_t wait_pid;
+  pid_t wait_pid;
   int status = -1;
 
   /* Unlink from proc_file_chain. */
diff --git a/libio/ioputs.c b/libio/ioputs.c
index 706b20b4921..0a80fb71484 100644
--- a/libio/ioputs.c
+++ b/libio/ioputs.c
@@ -32,7 +32,7 @@ int
 _IO_puts (const char *str)
 {
   int result = EOF;
-  _IO_size_t len = strlen (str);
+  size_t len = strlen (str);
   _IO_acquire_lock (_IO_stdout);
 
   if ((_IO_vtable_offset (_IO_stdout) != 0
diff --git a/libio/ioseekoff.c b/libio/ioseekoff.c
index 6179cd0c25c..773cdc672d9 100644
--- a/libio/ioseekoff.c
+++ b/libio/ioseekoff.c
@@ -28,8 +28,8 @@
 #include <libioP.h>
 #include <errno.h>
 
-_IO_off64_t
-_IO_seekoff_unlocked (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
+off64_t
+_IO_seekoff_unlocked (FILE *fp, off64_t offset, int dir, int mode)
 {
   if (dir != _IO_seek_cur && dir != _IO_seek_set && dir != _IO_seek_end)
     {
@@ -60,10 +60,10 @@ _IO_seekoff_unlocked (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
 }
 
 
-_IO_off64_t
-_IO_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
+off64_t
+_IO_seekoff (FILE *fp, off64_t offset, int dir, int mode)
 {
-  _IO_off64_t retval;
+  off64_t retval;
 
   _IO_acquire_lock (fp);
   retval = _IO_seekoff_unlocked (fp, offset, dir, mode);
diff --git a/libio/ioseekpos.c b/libio/ioseekpos.c
index 9863ece3af8..5e8b0ff2cc9 100644
--- a/libio/ioseekpos.c
+++ b/libio/ioseekpos.c
@@ -26,8 +26,8 @@
 
 #include <libioP.h>
 
-_IO_off64_t
-_IO_seekpos_unlocked (_IO_FILE *fp, _IO_off64_t pos, int mode)
+off64_t
+_IO_seekpos_unlocked (FILE *fp, off64_t pos, int mode)
 {
   /* If we have a backup buffer, get rid of it, since the __seekoff
      callback may not know to do the right thing about it.
@@ -47,10 +47,10 @@ _IO_seekpos_unlocked (_IO_FILE *fp, _IO_off64_t pos, int mode)
 }
 
 
-_IO_off64_t
-_IO_seekpos (_IO_FILE *fp, _IO_off64_t pos, int mode)
+off64_t
+_IO_seekpos (FILE *fp, off64_t pos, int mode)
 {
-  _IO_off64_t retval;
+  off64_t retval;
 
   _IO_acquire_lock (fp);
   retval = _IO_seekpos_unlocked (fp, pos, mode);
diff --git a/libio/iosetbuffer.c b/libio/iosetbuffer.c
index 7152e6e88e2..0419db3113d 100644
--- a/libio/iosetbuffer.c
+++ b/libio/iosetbuffer.c
@@ -27,7 +27,7 @@
 #include "libioP.h"
 
 void
-_IO_setbuffer (_IO_FILE *fp, char *buf, _IO_size_t size)
+_IO_setbuffer (FILE *fp, char *buf, size_t size)
 {
   CHECK_FILE (fp, );
   _IO_acquire_lock (fp);
diff --git a/libio/iosetvbuf.c b/libio/iosetvbuf.c
index 7d376476d3b..b29a93be548 100644
--- a/libio/iosetvbuf.c
+++ b/libio/iosetvbuf.c
@@ -31,7 +31,7 @@
 #define _IONBF 2 /* No buffering. */
 
 int
-_IO_setvbuf (_IO_FILE *fp, char *buf, int mode, _IO_size_t size)
+_IO_setvbuf (FILE *fp, char *buf, int mode, size_t size)
 {
   int result;
   CHECK_FILE (fp, EOF);
diff --git a/libio/ioungetc.c b/libio/ioungetc.c
index 165cb53dfec..59ebb061778 100644
--- a/libio/ioungetc.c
+++ b/libio/ioungetc.c
@@ -27,7 +27,7 @@
 #include "libioP.h"
 
 int
-_IO_ungetc (int c, _IO_FILE *fp)
+_IO_ungetc (int c, FILE *fp)
 {
   int result;
   CHECK_FILE (fp, EOF);
diff --git a/libio/ioungetwc.c b/libio/ioungetwc.c
index 70389b579d5..5f882f94364 100644
--- a/libio/ioungetwc.c
+++ b/libio/ioungetwc.c
@@ -28,7 +28,7 @@
 #include <wchar.h>
 
 wint_t
-ungetwc (wint_t c, _IO_FILE *fp)
+ungetwc (wint_t c, FILE *fp)
 {
   wint_t result;
   CHECK_FILE (fp, WEOF);
diff --git a/libio/iovdprintf.c b/libio/iovdprintf.c
index b5e87abb065..78df2fe559b 100644
--- a/libio/iovdprintf.c
+++ b/libio/iovdprintf.c
@@ -28,7 +28,7 @@
 #include <stdio_ext.h>
 
 int
-_IO_vdprintf (int d, const char *format, _IO_va_list arg)
+_IO_vdprintf (int d, const char *format, va_list arg)
 {
   struct _IO_FILE_plus tmpfil;
   struct _IO_wide_data wd;
diff --git a/libio/iovsprintf.c b/libio/iovsprintf.c
index 02be5e7c7ad..4def2517010 100644
--- a/libio/iovsprintf.c
+++ b/libio/iovsprintf.c
@@ -28,7 +28,7 @@
 #include "strfile.h"
 
 int
-__IO_vsprintf (char *string, const char *format, _IO_va_list args)
+__IO_vsprintf (char *string, const char *format, va_list args)
 {
   _IO_strfile sf;
   int ret;
diff --git a/libio/iovsscanf.c b/libio/iovsscanf.c
index b5514fc74ea..e56ab8bd7d5 100644
--- a/libio/iovsscanf.c
+++ b/libio/iovsscanf.c
@@ -28,7 +28,7 @@
 #include "strfile.h"
 
 int
-_IO_vsscanf (const char *string, const char *format, _IO_va_list args)
+_IO_vsscanf (const char *string, const char *format, va_list args)
 {
   int ret;
   _IO_strfile sf;
diff --git a/libio/iovswscanf.c b/libio/iovswscanf.c
index bcc27020679..5bd1c884121 100644
--- a/libio/iovswscanf.c
+++ b/libio/iovswscanf.c
@@ -29,7 +29,7 @@
 #include <wchar.h>
 
 int
-__vswscanf (const wchar_t *string, const wchar_t *format, _IO_va_list args)
+__vswscanf (const wchar_t *string, const wchar_t *format, va_list args)
 {
   int ret;
   _IO_strfile sf;
@@ -40,7 +40,7 @@ __vswscanf (const wchar_t *string, const wchar_t *format, _IO_va_list args)
   _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);
+  ret = _IO_vfwscanf ((FILE *) &sf._sbf, format, args, NULL);
   return ret;
 }
 libc_hidden_def (__vswscanf)
diff --git a/libio/iowpadn.c b/libio/iowpadn.c
index f4c17da6b38..47f74f20c47 100644
--- a/libio/iowpadn.c
+++ b/libio/iowpadn.c
@@ -38,14 +38,14 @@ static wchar_t const zeroes[PADSIZE] =
   L'0', L'0', L'0', L'0', L'0', L'0', L'0', L'0'
 };
 
-_IO_ssize_t
-_IO_wpadn (_IO_FILE *fp, wint_t pad, _IO_ssize_t count)
+ssize_t
+_IO_wpadn (FILE *fp, wint_t pad, ssize_t count)
 {
   wchar_t padbuf[PADSIZE];
   const wchar_t *padptr;
   int i;
-  _IO_size_t written = 0;
-  _IO_size_t w;
+  size_t written = 0;
+  size_t w;
 
   if (pad == L' ')
     padptr = blanks;
diff --git a/libio/libio.h b/libio/libio.h
index 7a68e1a3ae3..890b825ed86 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -58,19 +58,6 @@ typedef union
   } __combined;
 } _IO_iconv_t;
 
-/* Map the names used in libio to the names used in libc generally.  */
-#define _IO_fpos_t __fpos_t
-#define _IO_fpos64_t __fpos64_t
-#define _IO_size_t size_t
-#define _IO_ssize_t __ssize_t
-#define _IO_off_t __off_t
-#define _IO_off64_t __off64_t
-#define _IO_pid_t __pid_t
-#define _IO_uid_t __uid_t
-#define _IO_BUFSIZ BUFSIZ
-#define _IO_wint_t wint_t
-#define _IO_va_list __gnuc_va_list
-
 #include <shlib-compat.h>
 
 /* compatibility defines */
@@ -150,7 +137,7 @@ struct _IO_jump_t;
 
 struct _IO_marker {
   struct _IO_marker *_next;
-  struct _IO_FILE *_sbuf;
+  FILE *_sbuf;
   /* If _pos >= 0
  it points to _buf->Gbase()+_pos. FIXME comment */
   /* if _pos < 0, it points to _buf->eBptr()+_pos. FIXME comment */
@@ -188,7 +175,7 @@ struct _IO_codecvt
   int (*__codecvt_do_encoding) (struct _IO_codecvt *);
   int (*__codecvt_do_always_noconv) (struct _IO_codecvt *);
   int (*__codecvt_do_length) (struct _IO_codecvt *, __mbstate_t *,
-			      const char *, const char *, _IO_size_t);
+			      const char *, const char *, size_t);
   int (*__codecvt_do_max_length) (struct _IO_codecvt *);
 
   _IO_iconv_t __cd_in;
@@ -221,34 +208,25 @@ struct _IO_wide_data
   const struct _IO_jump_t *_wide_vtable;
 };
 
-typedef struct _IO_FILE _IO_FILE;
-
 struct _IO_FILE_plus;
 
 extern struct _IO_FILE_plus _IO_2_1_stdin_;
 extern struct _IO_FILE_plus _IO_2_1_stdout_;
 extern struct _IO_FILE_plus _IO_2_1_stderr_;
-extern _IO_FILE *_IO_stdin attribute_hidden;
-extern _IO_FILE *_IO_stdout attribute_hidden;
-extern _IO_FILE *_IO_stderr attribute_hidden;
-
-/* Compatibility names for cookie I/O functions.  */
-typedef cookie_read_function_t __io_read_fn;
-typedef cookie_write_function_t __io_write_fn;
-typedef cookie_seek_function_t __io_seek_fn;
-typedef cookie_close_function_t __io_close_fn;
-typedef cookie_io_functions_t _IO_cookie_io_functions_t;
+extern FILE *_IO_stdin attribute_hidden;
+extern FILE *_IO_stdout attribute_hidden;
+extern FILE *_IO_stderr attribute_hidden;
 
 struct _IO_cookie_file;
 
 /* Initialize one of those.  */
 extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
-			     void *__cookie, _IO_cookie_io_functions_t __fns);
+			     void *__cookie, cookie_io_functions_t __fns);
 
-extern int __underflow (_IO_FILE *);
-extern _IO_wint_t __wunderflow (_IO_FILE *);
-extern _IO_wint_t __wuflow (_IO_FILE *);
-extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t);
+extern int __underflow (FILE *);
+extern wint_t __wunderflow (FILE *);
+extern wint_t __wuflow (FILE *);
+extern wint_t __woverflow (FILE *, wint_t);
 
 #if  __GNUC__ >= 3
 # define _IO_BE(expr, res) __builtin_expect ((expr), res)
@@ -267,31 +245,31 @@ extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t);
   (_IO_BE ((_fp)->_wide_data == NULL					\
 	   || ((_fp)->_wide_data->_IO_read_ptr				\
 	       >= (_fp)->_wide_data->_IO_read_end), 0)			\
-   ? __wuflow (_fp) : (_IO_wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
+   ? __wuflow (_fp) : (wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
 # define _IO_putwc_unlocked(_wch, _fp) \
   (_IO_BE ((_fp)->_wide_data == NULL					\
 	   || ((_fp)->_wide_data->_IO_write_ptr				\
 	       >= (_fp)->_wide_data->_IO_write_end), 0)			\
    ? __woverflow (_fp, _wch)						\
-   : (_IO_wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
+   : (wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
 
 #define _IO_feof_unlocked(_fp) __feof_unlocked_body (_fp)
 #define _IO_ferror_unlocked(_fp) __ferror_unlocked_body (_fp)
 
-extern int _IO_getc (_IO_FILE *__fp);
-extern int _IO_putc (int __c, _IO_FILE *__fp);
-extern int _IO_feof (_IO_FILE *__fp) __THROW;
-extern int _IO_ferror (_IO_FILE *__fp) __THROW;
+extern int _IO_getc (FILE *__fp);
+extern int _IO_putc (int __c, FILE *__fp);
+extern int _IO_feof (FILE *__fp) __THROW;
+extern int _IO_ferror (FILE *__fp) __THROW;
 
-extern int _IO_peekc_locked (_IO_FILE *__fp);
+extern int _IO_peekc_locked (FILE *__fp);
 
 /* This one is for Emacs. */
 #define _IO_PENDING_OUTPUT_COUNT(_fp)	\
 	((_fp)->_IO_write_ptr - (_fp)->_IO_write_base)
 
-extern void _IO_flockfile (_IO_FILE *) __THROW;
-extern void _IO_funlockfile (_IO_FILE *) __THROW;
-extern int _IO_ftrylockfile (_IO_FILE *) __THROW;
+extern void _IO_flockfile (FILE *) __THROW;
+extern void _IO_funlockfile (FILE *) __THROW;
+extern int _IO_ftrylockfile (FILE *) __THROW;
 
 #define _IO_peekc(_fp) _IO_peekc_unlocked (_fp)
 #define _IO_flockfile(_fp) /**/
@@ -307,22 +285,22 @@ extern int _IO_ftrylockfile (_IO_FILE *) __THROW;
 #define _IO_need_lock(_fp) \
   (((_fp)->_flags2 & _IO_FLAGS2_NEED_LOCK) != 0)
 
-extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
-			_IO_va_list, int *__restrict);
-extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
-			 _IO_va_list);
-extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t);
-extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t);
+extern int _IO_vfscanf (FILE * __restrict, const char * __restrict,
+			__gnuc_va_list, int *__restrict);
+extern int _IO_vfprintf (FILE *__restrict, const char *__restrict,
+			 __gnuc_va_list);
+extern __ssize_t _IO_padn (FILE *, int, __ssize_t);
+extern size_t _IO_sgetn (FILE *, void *, size_t);
 
-extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int);
-extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int);
+extern off64_t _IO_seekoff (FILE *, off64_t, int, int);
+extern off64_t _IO_seekpos (FILE *, off64_t, int);
 
-extern void _IO_free_backup_area (_IO_FILE *) __THROW;
+extern void _IO_free_backup_area (FILE *) __THROW;
 
 
-extern _IO_wint_t _IO_getwc (_IO_FILE *__fp);
-extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp);
-extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW;
+extern wint_t _IO_getwc (FILE *__fp);
+extern wint_t _IO_putwc (wchar_t __wc, FILE *__fp);
+extern int _IO_fwide (FILE *__fp, int __mode) __THROW;
 
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
 #  define _IO_fwide_maybe_incompatible \
@@ -350,12 +328,12 @@ weak_extern (_IO_stdin_used);
        __result = _IO_fwide (__fp, __result);				      \
      __result; })
 
-extern int _IO_vfwscanf (_IO_FILE * __restrict, const wchar_t * __restrict,
-			 _IO_va_list, int *__restrict);
-extern int _IO_vfwprintf (_IO_FILE *__restrict, const wchar_t *__restrict,
-			  _IO_va_list);
-extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t);
-extern void _IO_free_wbackup_area (_IO_FILE *) __THROW;
+extern int _IO_vfwscanf (FILE * __restrict, const wchar_t * __restrict,
+			 __gnuc_va_list, int *__restrict);
+extern int _IO_vfwprintf (FILE *__restrict, const wchar_t *__restrict,
+			  __gnuc_va_list);
+extern __ssize_t _IO_wpadn (FILE *, wint_t, __ssize_t);
+extern void _IO_free_wbackup_area (FILE *) __THROW;
 
 #ifdef __LDBL_COMPAT
 __LDBL_REDIR_DECL (_IO_vfscanf)
diff --git a/libio/libioP.h b/libio/libioP.h
index abbf3316855..57fd60567c7 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -66,7 +66,7 @@
  * with the _IO_JUMPS macro.  The jump table has an eccentric format,
  * so as to be compatible with the layout of a C++ virtual function table.
  * (as implemented by g++).  When a pointer to a streambuf object is
- * coerced to an (_IO_FILE*), then _IO_JUMPS on the result just
+ * coerced to an (FILE*), then _IO_JUMPS on the result just
  * happens to point to the virtual function table of the streambuf.
  * Thus the _IO_JUMPS function table used for C stdio/libio does
  * double duty as the virtual function table for C++ streambuf.
@@ -130,14 +130,14 @@
 /* The 'finish' function does any final cleaning up of an _IO_FILE object.
    It does not delete (free) it, but does everything else to finalize it.
    It matches the streambuf::~streambuf virtual destructor.  */
-typedef void (*_IO_finish_t) (_IO_FILE *, int); /* finalize */
+typedef void (*_IO_finish_t) (FILE *, int); /* finalize */
 #define _IO_FINISH(FP) JUMP1 (__finish, FP, 0)
 #define _IO_WFINISH(FP) WJUMP1 (__finish, FP, 0)
 
 /* The 'overflow' hook flushes the buffer.
    The second argument is a character, or EOF.
    It matches the streambuf::overflow virtual function. */
-typedef int (*_IO_overflow_t) (_IO_FILE *, int);
+typedef int (*_IO_overflow_t) (FILE *, int);
 #define _IO_OVERFLOW(FP, CH) JUMP1 (__overflow, FP, CH)
 #define _IO_WOVERFLOW(FP, CH) WJUMP1 (__overflow, FP, CH)
 
@@ -145,7 +145,7 @@ typedef int (*_IO_overflow_t) (_IO_FILE *, int);
    It returns the next character (as an unsigned char) or EOF.  The next
    character remains in the get buffer, and the get position is not changed.
    It matches the streambuf::underflow virtual function. */
-typedef int (*_IO_underflow_t) (_IO_FILE *);
+typedef int (*_IO_underflow_t) (FILE *);
 #define _IO_UNDERFLOW(FP) JUMP0 (__underflow, FP)
 #define _IO_WUNDERFLOW(FP) WJUMP0 (__underflow, FP)
 
@@ -159,22 +159,22 @@ typedef int (*_IO_underflow_t) (_IO_FILE *);
 
 /* The 'pbackfail' hook handles backing up.
    It matches the streambuf::pbackfail virtual function. */
-typedef int (*_IO_pbackfail_t) (_IO_FILE *, int);
+typedef int (*_IO_pbackfail_t) (FILE *, int);
 #define _IO_PBACKFAIL(FP, CH) JUMP1 (__pbackfail, FP, CH)
 #define _IO_WPBACKFAIL(FP, CH) WJUMP1 (__pbackfail, FP, CH)
 
 /* The 'xsputn' hook writes upto N characters from buffer DATA.
    Returns EOF or the number of character actually written.
    It matches the streambuf::xsputn virtual function. */
-typedef _IO_size_t (*_IO_xsputn_t) (_IO_FILE *FP, const void *DATA,
-				    _IO_size_t N);
+typedef size_t (*_IO_xsputn_t) (FILE *FP, const void *DATA,
+				    size_t N);
 #define _IO_XSPUTN(FP, DATA, N) JUMP2 (__xsputn, FP, DATA, N)
 #define _IO_WXSPUTN(FP, DATA, N) WJUMP2 (__xsputn, FP, DATA, N)
 
 /* The 'xsgetn' hook reads upto N characters into buffer DATA.
    Returns the number of character actually read.
    It matches the streambuf::xsgetn virtual function. */
-typedef _IO_size_t (*_IO_xsgetn_t) (_IO_FILE *FP, void *DATA, _IO_size_t N);
+typedef size_t (*_IO_xsgetn_t) (FILE *FP, void *DATA, size_t N);
 #define _IO_XSGETN(FP, DATA, N) JUMP2 (__xsgetn, FP, DATA, N)
 #define _IO_WXSGETN(FP, DATA, N) WJUMP2 (__xsgetn, FP, DATA, N)
 
@@ -183,7 +183,7 @@ typedef _IO_size_t (*_IO_xsgetn_t) (_IO_FILE *FP, void *DATA, _IO_size_t N);
    (MODE==1), or the end of the file (MODE==2).
    It matches the streambuf::seekoff virtual function.
    It is also used for the ANSI fseek function. */
-typedef _IO_off64_t (*_IO_seekoff_t) (_IO_FILE *FP, _IO_off64_t OFF, int DIR,
+typedef off64_t (*_IO_seekoff_t) (FILE *FP, off64_t OFF, int DIR,
 				      int MODE);
 #define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE)
 #define _IO_WSEEKOFF(FP, OFF, DIR, MODE) WJUMP3 (__seekoff, FP, OFF, DIR, MODE)
@@ -193,27 +193,27 @@ typedef _IO_off64_t (*_IO_seekoff_t) (_IO_FILE *FP, _IO_off64_t OFF, int DIR,
    It matches the streambuf::seekpos virtual function.
    It is also used for the ANSI fgetpos and fsetpos functions.  */
 /* The _IO_seek_cur and _IO_seek_end options are not allowed. */
-typedef _IO_off64_t (*_IO_seekpos_t) (_IO_FILE *, _IO_off64_t, int);
+typedef off64_t (*_IO_seekpos_t) (FILE *, off64_t, int);
 #define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__seekpos, FP, POS, FLAGS)
 #define _IO_WSEEKPOS(FP, POS, FLAGS) WJUMP2 (__seekpos, FP, POS, FLAGS)
 
 /* The 'setbuf' hook gives a buffer to the file.
    It matches the streambuf::setbuf virtual function. */
-typedef _IO_FILE* (*_IO_setbuf_t) (_IO_FILE *, char *, _IO_ssize_t);
+typedef FILE* (*_IO_setbuf_t) (FILE *, char *, ssize_t);
 #define _IO_SETBUF(FP, BUFFER, LENGTH) JUMP2 (__setbuf, FP, BUFFER, LENGTH)
 #define _IO_WSETBUF(FP, BUFFER, LENGTH) WJUMP2 (__setbuf, FP, BUFFER, LENGTH)
 
 /* The 'sync' hook attempts to synchronize the internal data structures
    of the file with the external state.
    It matches the streambuf::sync virtual function. */
-typedef int (*_IO_sync_t) (_IO_FILE *);
+typedef int (*_IO_sync_t) (FILE *);
 #define _IO_SYNC(FP) JUMP0 (__sync, FP)
 #define _IO_WSYNC(FP) WJUMP0 (__sync, FP)
 
 /* The 'doallocate' hook is used to tell the file to allocate a buffer.
    It matches the streambuf::doallocate virtual function, which is not
    in the ANSI/ISO C++ standard, but is part traditional implementations. */
-typedef int (*_IO_doallocate_t) (_IO_FILE *);
+typedef int (*_IO_doallocate_t) (FILE *);
 #define _IO_DOALLOCATE(FP) JUMP0 (__doallocate, FP)
 #define _IO_WDOALLOCATE(FP) WJUMP0 (__doallocate, FP)
 
@@ -221,7 +221,7 @@ typedef int (*_IO_doallocate_t) (_IO_FILE *);
    sysstat) are low-level hooks specific to this implementation.
    There is no correspondence in the ANSI/ISO C++ standard library.
    The hooks basically correspond to the Unix system functions
-   (read, write, close, lseek, and stat) except that a _IO_FILE*
+   (read, write, close, lseek, and stat) except that a FILE*
    parameter is used instead of an integer file descriptor;  the default
    implementation used for normal files just calls those functions.
    The advantage of overriding these functions instead of the higher-level
@@ -232,7 +232,7 @@ typedef int (*_IO_doallocate_t) (_IO_FILE *);
    an existing buffer.  It generalizes the Unix read(2) function.
    It matches the streambuf::sys_read virtual function, which is
    specific to this implementation. */
-typedef _IO_ssize_t (*_IO_read_t) (_IO_FILE *, void *, _IO_ssize_t);
+typedef ssize_t (*_IO_read_t) (FILE *, void *, ssize_t);
 #define _IO_SYSREAD(FP, DATA, LEN) JUMP2 (__read, FP, DATA, LEN)
 #define _IO_WSYSREAD(FP, DATA, LEN) WJUMP2 (__read, FP, DATA, LEN)
 
@@ -240,7 +240,7 @@ typedef _IO_ssize_t (*_IO_read_t) (_IO_FILE *, void *, _IO_ssize_t);
    to an external file.  It generalizes the Unix write(2) function.
    It matches the streambuf::sys_write virtual function, which is
    specific to this implementation. */
-typedef _IO_ssize_t (*_IO_write_t) (_IO_FILE *, const void *, _IO_ssize_t);
+typedef ssize_t (*_IO_write_t) (FILE *, const void *, ssize_t);
 #define _IO_SYSWRITE(FP, DATA, LEN) JUMP2 (__write, FP, DATA, LEN)
 #define _IO_WSYSWRITE(FP, DATA, LEN) WJUMP2 (__write, FP, DATA, LEN)
 
@@ -248,7 +248,7 @@ typedef _IO_ssize_t (*_IO_write_t) (_IO_FILE *, const void *, _IO_ssize_t);
    It generalizes the Unix lseek(2) function.
    It matches the streambuf::sys_seek virtual function, which is
    specific to this implementation. */
-typedef _IO_off64_t (*_IO_seek_t) (_IO_FILE *, _IO_off64_t, int);
+typedef off64_t (*_IO_seek_t) (FILE *, off64_t, int);
 #define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__seek, FP, OFFSET, MODE)
 #define _IO_WSYSSEEK(FP, OFFSET, MODE) WJUMP2 (__seek, FP, OFFSET, MODE)
 
@@ -256,7 +256,7 @@ typedef _IO_off64_t (*_IO_seek_t) (_IO_FILE *, _IO_off64_t, int);
    external file.  It generalizes the Unix close(2) function.
    It matches the streambuf::sys_close virtual function, which is
    specific to this implementation. */
-typedef int (*_IO_close_t) (_IO_FILE *); /* finalize */
+typedef int (*_IO_close_t) (FILE *); /* finalize */
 #define _IO_SYSCLOSE(FP) JUMP0 (__close, FP)
 #define _IO_WSYSCLOSE(FP) WJUMP0 (__close, FP)
 
@@ -264,20 +264,20 @@ typedef int (*_IO_close_t) (_IO_FILE *); /* finalize */
    into a struct stat buffer.  It generalizes the Unix fstat(2) call.
    It matches the streambuf::sys_stat virtual function, which is
    specific to this implementation. */
-typedef int (*_IO_stat_t) (_IO_FILE *, void *);
+typedef int (*_IO_stat_t) (FILE *, void *);
 #define _IO_SYSSTAT(FP, BUF) JUMP1 (__stat, FP, BUF)
 #define _IO_WSYSSTAT(FP, BUF) WJUMP1 (__stat, FP, BUF)
 
 /* The 'showmany' hook can be used to get an image how much input is
    available.  In many cases the answer will be 0 which means unknown
    but some cases one can provide real information.  */
-typedef int (*_IO_showmanyc_t) (_IO_FILE *);
+typedef int (*_IO_showmanyc_t) (FILE *);
 #define _IO_SHOWMANYC(FP) JUMP0 (__showmanyc, FP)
 #define _IO_WSHOWMANYC(FP) WJUMP0 (__showmanyc, FP)
 
 /* The 'imbue' hook is used to get information about the currently
    installed locales.  */
-typedef void (*_IO_imbue_t) (_IO_FILE *, void *);
+typedef void (*_IO_imbue_t) (FILE *, void *);
 #define _IO_IMBUE(FP, LOCALE) JUMP1 (__imbue, FP, LOCALE)
 #define _IO_WIMBUE(FP, LOCALE) WJUMP1 (__imbue, FP, LOCALE)
 
@@ -322,7 +322,7 @@ struct _IO_jump_t
 
 struct _IO_FILE_plus
 {
-  _IO_FILE file;
+  FILE file;
   const struct _IO_jump_t *vtable;
 };
 
@@ -342,71 +342,71 @@ struct _IO_cookie_file
 {
   struct _IO_FILE_plus __fp;
   void *__cookie;
-  _IO_cookie_io_functions_t __io_functions;
+  cookie_io_functions_t __io_functions;
 };
 
-_IO_FILE *_IO_fopencookie (void *cookie, const char *mode,
-			   _IO_cookie_io_functions_t io_functions);
+FILE *_IO_fopencookie (void *cookie, const char *mode,
+                       cookie_io_functions_t io_functions);
 
 
 /* Iterator type for walking global linked list of _IO_FILE objects. */
 
-typedef struct _IO_FILE *_IO_ITER;
+typedef FILE *_IO_ITER;
 
 /* Generic functions */
 
-extern void _IO_switch_to_main_get_area (_IO_FILE *) __THROW;
-extern void _IO_switch_to_backup_area (_IO_FILE *) __THROW;
-extern int _IO_switch_to_get_mode (_IO_FILE *);
+extern void _IO_switch_to_main_get_area (FILE *) __THROW;
+extern void _IO_switch_to_backup_area (FILE *) __THROW;
+extern int _IO_switch_to_get_mode (FILE *);
 libc_hidden_proto (_IO_switch_to_get_mode)
-extern void _IO_init_internal (_IO_FILE *, int) attribute_hidden;
-extern int _IO_sputbackc (_IO_FILE *, int) __THROW;
+extern void _IO_init_internal (FILE *, int) attribute_hidden;
+extern int _IO_sputbackc (FILE *, int) __THROW;
 libc_hidden_proto (_IO_sputbackc)
-extern int _IO_sungetc (_IO_FILE *) __THROW;
+extern int _IO_sungetc (FILE *) __THROW;
 extern void _IO_un_link (struct _IO_FILE_plus *) __THROW;
 libc_hidden_proto (_IO_un_link)
 extern void _IO_link_in (struct _IO_FILE_plus *) __THROW;
 libc_hidden_proto (_IO_link_in)
-extern void _IO_doallocbuf (_IO_FILE *) __THROW;
+extern void _IO_doallocbuf (FILE *) __THROW;
 libc_hidden_proto (_IO_doallocbuf)
-extern void _IO_unsave_markers (_IO_FILE *) __THROW;
+extern void _IO_unsave_markers (FILE *) __THROW;
 libc_hidden_proto (_IO_unsave_markers)
-extern void _IO_setb (_IO_FILE *, char *, char *, int) __THROW;
+extern void _IO_setb (FILE *, char *, char *, int) __THROW;
 libc_hidden_proto (_IO_setb)
 extern unsigned _IO_adjust_column (unsigned, const char *, int) __THROW;
 libc_hidden_proto (_IO_adjust_column)
 #define _IO_sputn(__fp, __s, __n) _IO_XSPUTN (__fp, __s, __n)
 
-_IO_ssize_t _IO_least_wmarker (_IO_FILE *, wchar_t *) __THROW;
+ssize_t _IO_least_wmarker (FILE *, wchar_t *) __THROW;
 libc_hidden_proto (_IO_least_wmarker)
-extern void _IO_switch_to_main_wget_area (_IO_FILE *) __THROW;
+extern void _IO_switch_to_main_wget_area (FILE *) __THROW;
 libc_hidden_proto (_IO_switch_to_main_wget_area)
-extern void _IO_switch_to_wbackup_area (_IO_FILE *) __THROW;
+extern void _IO_switch_to_wbackup_area (FILE *) __THROW;
 libc_hidden_proto (_IO_switch_to_wbackup_area)
-extern int _IO_switch_to_wget_mode (_IO_FILE *);
+extern int _IO_switch_to_wget_mode (FILE *);
 libc_hidden_proto (_IO_switch_to_wget_mode)
-extern void _IO_wsetb (_IO_FILE *, wchar_t *, wchar_t *, int) __THROW;
+extern void _IO_wsetb (FILE *, wchar_t *, wchar_t *, int) __THROW;
 libc_hidden_proto (_IO_wsetb)
-extern wint_t _IO_sputbackwc (_IO_FILE *, wint_t) __THROW;
+extern wint_t _IO_sputbackwc (FILE *, wint_t) __THROW;
 libc_hidden_proto (_IO_sputbackwc)
-extern wint_t _IO_sungetwc (_IO_FILE *) __THROW;
-extern void _IO_wdoallocbuf (_IO_FILE *) __THROW;
+extern wint_t _IO_sungetwc (FILE *) __THROW;
+extern void _IO_wdoallocbuf (FILE *) __THROW;
 libc_hidden_proto (_IO_wdoallocbuf)
-extern void _IO_unsave_wmarkers (_IO_FILE *) __THROW;
+extern void _IO_unsave_wmarkers (FILE *) __THROW;
 extern unsigned _IO_adjust_wcolumn (unsigned, const wchar_t *, int) __THROW;
-extern _IO_off64_t get_file_offset (_IO_FILE *fp);
+extern off64_t get_file_offset (FILE *fp);
 
 /* Marker-related function. */
 
-extern void _IO_init_marker (struct _IO_marker *, _IO_FILE *);
-extern void _IO_init_wmarker (struct _IO_marker *, _IO_FILE *);
+extern void _IO_init_marker (struct _IO_marker *, FILE *);
+extern void _IO_init_wmarker (struct _IO_marker *, FILE *);
 extern void _IO_remove_marker (struct _IO_marker *) __THROW;
 extern int _IO_marker_difference (struct _IO_marker *, struct _IO_marker *)
      __THROW;
 extern int _IO_marker_delta (struct _IO_marker *) __THROW;
 extern int _IO_wmarker_delta (struct _IO_marker *) __THROW;
-extern int _IO_seekmark (_IO_FILE *, struct _IO_marker *, int) __THROW;
-extern int _IO_seekwmark (_IO_FILE *, struct _IO_marker *, int) __THROW;
+extern int _IO_seekmark (FILE *, struct _IO_marker *, int) __THROW;
+extern int _IO_seekwmark (FILE *, struct _IO_marker *, int) __THROW;
 
 /* Functions for iterating global list and dealing with its lock */
 
@@ -416,7 +416,7 @@ extern _IO_ITER _IO_iter_end (void) __THROW;
 libc_hidden_proto (_IO_iter_end)
 extern _IO_ITER _IO_iter_next (_IO_ITER) __THROW;
 libc_hidden_proto (_IO_iter_next)
-extern _IO_FILE *_IO_iter_file (_IO_ITER) __THROW;
+extern FILE *_IO_iter_file (_IO_ITER) __THROW;
 libc_hidden_proto (_IO_iter_file)
 extern void _IO_list_lock (void) __THROW;
 libc_hidden_proto (_IO_list_lock)
@@ -429,43 +429,43 @@ libc_hidden_proto (_IO_enable_locks)
 
 /* Default jumptable functions. */
 
-extern int _IO_default_underflow (_IO_FILE *) __THROW;
-extern int _IO_default_uflow (_IO_FILE *);
+extern int _IO_default_underflow (FILE *) __THROW;
+extern int _IO_default_uflow (FILE *);
 libc_hidden_proto (_IO_default_uflow)
-extern wint_t _IO_wdefault_uflow (_IO_FILE *);
+extern wint_t _IO_wdefault_uflow (FILE *);
 libc_hidden_proto (_IO_wdefault_uflow)
-extern int _IO_default_doallocate (_IO_FILE *) __THROW;
+extern int _IO_default_doallocate (FILE *) __THROW;
 libc_hidden_proto (_IO_default_doallocate)
-extern int _IO_wdefault_doallocate (_IO_FILE *) __THROW;
+extern int _IO_wdefault_doallocate (FILE *) __THROW;
 libc_hidden_proto (_IO_wdefault_doallocate)
-extern void _IO_default_finish (_IO_FILE *, int) __THROW;
+extern void _IO_default_finish (FILE *, int) __THROW;
 libc_hidden_proto (_IO_default_finish)
-extern void _IO_wdefault_finish (_IO_FILE *, int) __THROW;
+extern void _IO_wdefault_finish (FILE *, int) __THROW;
 libc_hidden_proto (_IO_wdefault_finish)
-extern int _IO_default_pbackfail (_IO_FILE *, int) __THROW;
+extern int _IO_default_pbackfail (FILE *, int) __THROW;
 libc_hidden_proto (_IO_default_pbackfail)
-extern wint_t _IO_wdefault_pbackfail (_IO_FILE *, wint_t) __THROW;
+extern wint_t _IO_wdefault_pbackfail (FILE *, wint_t) __THROW;
 libc_hidden_proto (_IO_wdefault_pbackfail)
-extern _IO_FILE* _IO_default_setbuf (_IO_FILE *, char *, _IO_ssize_t);
-extern _IO_size_t _IO_default_xsputn (_IO_FILE *, const void *, _IO_size_t);
+extern FILE* _IO_default_setbuf (FILE *, char *, ssize_t);
+extern size_t _IO_default_xsputn (FILE *, const void *, size_t);
 libc_hidden_proto (_IO_default_xsputn)
-extern _IO_size_t _IO_wdefault_xsputn (_IO_FILE *, const void *, _IO_size_t);
+extern size_t _IO_wdefault_xsputn (FILE *, const void *, size_t);
 libc_hidden_proto (_IO_wdefault_xsputn)
-extern _IO_size_t _IO_default_xsgetn (_IO_FILE *, void *, _IO_size_t);
+extern size_t _IO_default_xsgetn (FILE *, void *, size_t);
 libc_hidden_proto (_IO_default_xsgetn)
-extern _IO_size_t _IO_wdefault_xsgetn (_IO_FILE *, void *, _IO_size_t);
+extern size_t _IO_wdefault_xsgetn (FILE *, void *, size_t);
 libc_hidden_proto (_IO_wdefault_xsgetn)
-extern _IO_off64_t _IO_default_seekoff (_IO_FILE *, _IO_off64_t, int, int)
+extern off64_t _IO_default_seekoff (FILE *, off64_t, int, int)
      __THROW;
-extern _IO_off64_t _IO_default_seekpos (_IO_FILE *, _IO_off64_t, int);
-extern _IO_ssize_t _IO_default_write (_IO_FILE *, const void *, _IO_ssize_t);
-extern _IO_ssize_t _IO_default_read (_IO_FILE *, void *, _IO_ssize_t);
-extern int _IO_default_stat (_IO_FILE *, void *) __THROW;
-extern _IO_off64_t _IO_default_seek (_IO_FILE *, _IO_off64_t, int) __THROW;
-extern int _IO_default_sync (_IO_FILE *) __THROW;
+extern off64_t _IO_default_seekpos (FILE *, off64_t, int);
+extern ssize_t _IO_default_write (FILE *, const void *, ssize_t);
+extern ssize_t _IO_default_read (FILE *, void *, ssize_t);
+extern int _IO_default_stat (FILE *, void *) __THROW;
+extern off64_t _IO_default_seek (FILE *, off64_t, int) __THROW;
+extern int _IO_default_sync (FILE *) __THROW;
 #define _IO_default_close ((_IO_close_t) _IO_default_sync)
-extern int _IO_default_showmanyc (_IO_FILE *) __THROW;
-extern void _IO_default_imbue (_IO_FILE *, void *) __THROW;
+extern int _IO_default_showmanyc (FILE *) __THROW;
+extern void _IO_default_imbue (FILE *, void *) __THROW;
 
 extern const struct _IO_jump_t _IO_file_jumps;
 libc_hidden_proto (_IO_file_jumps)
@@ -481,11 +481,11 @@ extern const struct _IO_jump_t _IO_old_proc_jumps attribute_hidden;
 extern const struct _IO_jump_t _IO_str_jumps attribute_hidden;
 extern const struct _IO_jump_t _IO_wstr_jumps attribute_hidden;
 extern const struct _IO_codecvt __libio_codecvt attribute_hidden;
-extern int _IO_do_write (_IO_FILE *, const char *, _IO_size_t);
+extern int _IO_do_write (FILE *, const char *, size_t);
 libc_hidden_proto (_IO_do_write)
-extern int _IO_new_do_write (_IO_FILE *, const char *, _IO_size_t);
-extern int _IO_old_do_write (_IO_FILE *, const char *, _IO_size_t);
-extern int _IO_wdo_write (_IO_FILE *, const wchar_t *, _IO_size_t);
+extern int _IO_new_do_write (FILE *, const char *, size_t);
+extern int _IO_old_do_write (FILE *, const char *, size_t);
+extern int _IO_wdo_write (FILE *, const wchar_t *, size_t);
 libc_hidden_proto (_IO_wdo_write)
 extern int _IO_flush_all_lockp (int);
 extern int _IO_flush_all (void);
@@ -493,15 +493,15 @@ libc_hidden_proto (_IO_flush_all)
 extern int _IO_cleanup (void);
 extern void _IO_flush_all_linebuffered (void);
 libc_hidden_proto (_IO_flush_all_linebuffered)
-extern int _IO_new_fgetpos (_IO_FILE *, _IO_fpos_t *);
-extern int _IO_old_fgetpos (_IO_FILE *, _IO_fpos_t *);
-extern int _IO_new_fsetpos (_IO_FILE *, const _IO_fpos_t *);
-extern int _IO_old_fsetpos (_IO_FILE *, const _IO_fpos_t *);
-extern int _IO_new_fgetpos64 (_IO_FILE *, _IO_fpos64_t *);
-extern int _IO_old_fgetpos64 (_IO_FILE *, _IO_fpos64_t *);
-extern int _IO_new_fsetpos64 (_IO_FILE *, const _IO_fpos64_t *);
-extern int _IO_old_fsetpos64 (_IO_FILE *, const _IO_fpos64_t *);
-extern void _IO_old_init (_IO_FILE *fp, int flags) __THROW;
+extern int _IO_new_fgetpos (FILE *, __fpos_t *);
+extern int _IO_old_fgetpos (FILE *, __fpos_t *);
+extern int _IO_new_fsetpos (FILE *, const __fpos_t *);
+extern int _IO_old_fsetpos (FILE *, const __fpos_t *);
+extern int _IO_new_fgetpos64 (FILE *, __fpos64_t *);
+extern int _IO_old_fgetpos64 (FILE *, __fpos64_t *);
+extern int _IO_new_fsetpos64 (FILE *, const __fpos64_t *);
+extern int _IO_old_fsetpos64 (FILE *, const __fpos64_t *);
+extern void _IO_old_init (FILE *fp, int flags) __THROW;
 
 
 #define _IO_do_flush(_f) \
@@ -539,144 +539,144 @@ extern void _IO_old_init (_IO_FILE *fp, int flags) __THROW;
 
 /* Jumptable functions for files. */
 
-extern int _IO_file_doallocate (_IO_FILE *) __THROW;
+extern int _IO_file_doallocate (FILE *) __THROW;
 libc_hidden_proto (_IO_file_doallocate)
-extern _IO_FILE* _IO_file_setbuf (_IO_FILE *, char *, _IO_ssize_t);
+extern FILE* _IO_file_setbuf (FILE *, char *, ssize_t);
 libc_hidden_proto (_IO_file_setbuf)
-extern _IO_off64_t _IO_file_seekoff (_IO_FILE *, _IO_off64_t, int, int);
+extern off64_t _IO_file_seekoff (FILE *, off64_t, int, int);
 libc_hidden_proto (_IO_file_seekoff)
-extern _IO_off64_t _IO_file_seekoff_mmap (_IO_FILE *, _IO_off64_t, int, int)
+extern off64_t _IO_file_seekoff_mmap (FILE *, off64_t, int, int)
      __THROW;
-extern _IO_size_t _IO_file_xsputn (_IO_FILE *, const void *, _IO_size_t);
+extern size_t _IO_file_xsputn (FILE *, const void *, size_t);
 libc_hidden_proto (_IO_file_xsputn)
-extern _IO_size_t _IO_file_xsgetn (_IO_FILE *, void *, _IO_size_t);
+extern size_t _IO_file_xsgetn (FILE *, void *, size_t);
 libc_hidden_proto (_IO_file_xsgetn)
-extern int _IO_file_stat (_IO_FILE *, void *) __THROW;
+extern int _IO_file_stat (FILE *, void *) __THROW;
 libc_hidden_proto (_IO_file_stat)
-extern int _IO_file_close (_IO_FILE *) __THROW;
+extern int _IO_file_close (FILE *) __THROW;
 libc_hidden_proto (_IO_file_close)
-extern int _IO_file_close_mmap (_IO_FILE *) __THROW;
-extern int _IO_file_underflow (_IO_FILE *);
+extern int _IO_file_close_mmap (FILE *) __THROW;
+extern int _IO_file_underflow (FILE *);
 libc_hidden_proto (_IO_file_underflow)
-extern int _IO_file_underflow_mmap (_IO_FILE *);
-extern int _IO_file_underflow_maybe_mmap (_IO_FILE *);
-extern int _IO_file_overflow (_IO_FILE *, int);
+extern int _IO_file_underflow_mmap (FILE *);
+extern int _IO_file_underflow_maybe_mmap (FILE *);
+extern int _IO_file_overflow (FILE *, int);
 libc_hidden_proto (_IO_file_overflow)
 #define _IO_file_is_open(__fp) ((__fp)->_fileno != -1)
-extern _IO_FILE* _IO_file_attach (_IO_FILE *, int);
+extern FILE* _IO_file_attach (FILE *, int);
 libc_hidden_proto (_IO_file_attach)
-extern _IO_FILE* _IO_file_open (_IO_FILE *, const char *, int, int, int, int);
+extern FILE* _IO_file_open (FILE *, const char *, int, int, int, int);
 libc_hidden_proto (_IO_file_open)
-extern _IO_FILE* _IO_file_fopen (_IO_FILE *, const char *, const char *, int);
+extern FILE* _IO_file_fopen (FILE *, const char *, const char *, int);
 libc_hidden_proto (_IO_file_fopen)
-extern _IO_ssize_t _IO_file_write (_IO_FILE *, const void *, _IO_ssize_t);
-extern _IO_ssize_t _IO_file_read (_IO_FILE *, void *, _IO_ssize_t);
+extern ssize_t _IO_file_write (FILE *, const void *, ssize_t);
+extern ssize_t _IO_file_read (FILE *, void *, ssize_t);
 libc_hidden_proto (_IO_file_read)
-extern int _IO_file_sync (_IO_FILE *);
+extern int _IO_file_sync (FILE *);
 libc_hidden_proto (_IO_file_sync)
-extern int _IO_file_close_it (_IO_FILE *);
+extern int _IO_file_close_it (FILE *);
 libc_hidden_proto (_IO_file_close_it)
-extern _IO_off64_t _IO_file_seek (_IO_FILE *, _IO_off64_t, int) __THROW;
+extern off64_t _IO_file_seek (FILE *, off64_t, int) __THROW;
 libc_hidden_proto (_IO_file_seek)
-extern void _IO_file_finish (_IO_FILE *, int);
+extern void _IO_file_finish (FILE *, int);
 libc_hidden_proto (_IO_file_finish)
 
-extern _IO_FILE* _IO_new_file_attach (_IO_FILE *, int);
-extern int _IO_new_file_close_it (_IO_FILE *);
-extern void _IO_new_file_finish (_IO_FILE *, int);
-extern _IO_FILE* _IO_new_file_fopen (_IO_FILE *, const char *, const char *,
+extern FILE* _IO_new_file_attach (FILE *, int);
+extern int _IO_new_file_close_it (FILE *);
+extern void _IO_new_file_finish (FILE *, int);
+extern FILE* _IO_new_file_fopen (FILE *, const char *, const char *,
 				     int);
-extern void _IO_no_init (_IO_FILE *, int, int, struct _IO_wide_data *,
+extern void _IO_no_init (FILE *, int, int, struct _IO_wide_data *,
 			 const struct _IO_jump_t *) __THROW;
 extern void _IO_new_file_init_internal (struct _IO_FILE_plus *)
   __THROW attribute_hidden;
-extern _IO_FILE* _IO_new_file_setbuf (_IO_FILE *, char *, _IO_ssize_t);
-extern _IO_FILE* _IO_file_setbuf_mmap (_IO_FILE *, char *, _IO_ssize_t);
-extern int _IO_new_file_sync (_IO_FILE *);
-extern int _IO_new_file_underflow (_IO_FILE *);
-extern int _IO_new_file_overflow (_IO_FILE *, int);
-extern _IO_off64_t _IO_new_file_seekoff (_IO_FILE *, _IO_off64_t, int, int);
-extern _IO_ssize_t _IO_new_file_write (_IO_FILE *, const void *, _IO_ssize_t);
-extern _IO_size_t _IO_new_file_xsputn (_IO_FILE *, const void *, _IO_size_t);
-
-extern _IO_FILE* _IO_old_file_setbuf (_IO_FILE *, char *, _IO_ssize_t);
-extern _IO_off64_t _IO_old_file_seekoff (_IO_FILE *, _IO_off64_t, int, int);
-extern _IO_size_t _IO_old_file_xsputn (_IO_FILE *, const void *, _IO_size_t);
-extern int _IO_old_file_underflow (_IO_FILE *);
-extern int _IO_old_file_overflow (_IO_FILE *, int);
+extern FILE* _IO_new_file_setbuf (FILE *, char *, ssize_t);
+extern FILE* _IO_file_setbuf_mmap (FILE *, char *, ssize_t);
+extern int _IO_new_file_sync (FILE *);
+extern int _IO_new_file_underflow (FILE *);
+extern int _IO_new_file_overflow (FILE *, int);
+extern off64_t _IO_new_file_seekoff (FILE *, off64_t, int, int);
+extern ssize_t _IO_new_file_write (FILE *, const void *, ssize_t);
+extern size_t _IO_new_file_xsputn (FILE *, const void *, size_t);
+
+extern FILE* _IO_old_file_setbuf (FILE *, char *, ssize_t);
+extern off64_t _IO_old_file_seekoff (FILE *, off64_t, int, int);
+extern size_t _IO_old_file_xsputn (FILE *, const void *, size_t);
+extern int _IO_old_file_underflow (FILE *);
+extern int _IO_old_file_overflow (FILE *, int);
 extern void _IO_old_file_init_internal (struct _IO_FILE_plus *)
   __THROW attribute_hidden;
-extern _IO_FILE* _IO_old_file_attach (_IO_FILE *, int);
-extern _IO_FILE* _IO_old_file_fopen (_IO_FILE *, const char *, const char *);
-extern _IO_ssize_t _IO_old_file_write (_IO_FILE *, const void *, _IO_ssize_t);
-extern int _IO_old_file_sync (_IO_FILE *);
-extern int _IO_old_file_close_it (_IO_FILE *);
-extern void _IO_old_file_finish (_IO_FILE *, int);
-
-extern int _IO_wfile_doallocate (_IO_FILE *) __THROW;
-extern _IO_size_t _IO_wfile_xsputn (_IO_FILE *, const void *, _IO_size_t);
+extern FILE* _IO_old_file_attach (FILE *, int);
+extern FILE* _IO_old_file_fopen (FILE *, const char *, const char *);
+extern ssize_t _IO_old_file_write (FILE *, const void *, ssize_t);
+extern int _IO_old_file_sync (FILE *);
+extern int _IO_old_file_close_it (FILE *);
+extern void _IO_old_file_finish (FILE *, int);
+
+extern int _IO_wfile_doallocate (FILE *) __THROW;
+extern size_t _IO_wfile_xsputn (FILE *, const void *, size_t);
 libc_hidden_proto (_IO_wfile_xsputn)
-extern _IO_FILE* _IO_wfile_setbuf (_IO_FILE *, wchar_t *, _IO_ssize_t);
-extern wint_t _IO_wfile_sync (_IO_FILE *);
+extern FILE* _IO_wfile_setbuf (FILE *, wchar_t *, ssize_t);
+extern wint_t _IO_wfile_sync (FILE *);
 libc_hidden_proto (_IO_wfile_sync)
-extern wint_t _IO_wfile_underflow (_IO_FILE *);
+extern wint_t _IO_wfile_underflow (FILE *);
 libc_hidden_proto (_IO_wfile_underflow)
-extern wint_t _IO_wfile_overflow (_IO_FILE *, wint_t);
+extern wint_t _IO_wfile_overflow (FILE *, wint_t);
 libc_hidden_proto (_IO_wfile_overflow)
-extern _IO_off64_t _IO_wfile_seekoff (_IO_FILE *, _IO_off64_t, int, int);
+extern off64_t _IO_wfile_seekoff (FILE *, off64_t, int, int);
 libc_hidden_proto (_IO_wfile_seekoff)
 
 /* Jumptable functions for proc_files. */
-extern _IO_FILE* _IO_proc_open (_IO_FILE *, const char *, const char *)
+extern FILE* _IO_proc_open (FILE *, const char *, const char *)
      __THROW;
-extern _IO_FILE* _IO_new_proc_open (_IO_FILE *, const char *, const char *)
+extern FILE* _IO_new_proc_open (FILE *, const char *, const char *)
      __THROW;
-extern _IO_FILE* _IO_old_proc_open (_IO_FILE *, const char *, const char *);
-extern int _IO_proc_close (_IO_FILE *) __THROW;
-extern int _IO_new_proc_close (_IO_FILE *) __THROW;
-extern int _IO_old_proc_close (_IO_FILE *);
+extern FILE* _IO_old_proc_open (FILE *, const char *, const char *);
+extern int _IO_proc_close (FILE *) __THROW;
+extern int _IO_new_proc_close (FILE *) __THROW;
+extern int _IO_old_proc_close (FILE *);
 
 /* Jumptable functions for strfiles. */
-extern int _IO_str_underflow (_IO_FILE *) __THROW;
+extern int _IO_str_underflow (FILE *) __THROW;
 libc_hidden_proto (_IO_str_underflow)
-extern int _IO_str_overflow (_IO_FILE *, int) __THROW;
+extern int _IO_str_overflow (FILE *, int) __THROW;
 libc_hidden_proto (_IO_str_overflow)
-extern int _IO_str_pbackfail (_IO_FILE *, int) __THROW;
+extern int _IO_str_pbackfail (FILE *, int) __THROW;
 libc_hidden_proto (_IO_str_pbackfail)
-extern _IO_off64_t _IO_str_seekoff (_IO_FILE *, _IO_off64_t, int, int) __THROW;
+extern off64_t _IO_str_seekoff (FILE *, off64_t, int, int) __THROW;
 libc_hidden_proto (_IO_str_seekoff)
-extern void _IO_str_finish (_IO_FILE *, int) __THROW;
+extern void _IO_str_finish (FILE *, int) __THROW;
 
 /* Other strfile functions */
 struct _IO_strfile_;
-extern _IO_ssize_t _IO_str_count (_IO_FILE *) __THROW;
+extern ssize_t _IO_str_count (FILE *) __THROW;
 
 /* And the wide character versions.  */
-extern void _IO_wstr_init_static (_IO_FILE *, wchar_t *, _IO_size_t, wchar_t *)
+extern void _IO_wstr_init_static (FILE *, wchar_t *, size_t, wchar_t *)
      __THROW;
-extern _IO_ssize_t _IO_wstr_count (_IO_FILE *) __THROW;
-extern _IO_wint_t _IO_wstr_overflow (_IO_FILE *, _IO_wint_t) __THROW;
-extern _IO_wint_t _IO_wstr_underflow (_IO_FILE *) __THROW;
-extern _IO_off64_t _IO_wstr_seekoff (_IO_FILE *, _IO_off64_t, int, int)
+extern ssize_t _IO_wstr_count (FILE *) __THROW;
+extern wint_t _IO_wstr_overflow (FILE *, wint_t) __THROW;
+extern wint_t _IO_wstr_underflow (FILE *) __THROW;
+extern off64_t _IO_wstr_seekoff (FILE *, off64_t, int, int)
      __THROW;
-extern _IO_wint_t _IO_wstr_pbackfail (_IO_FILE *, _IO_wint_t) __THROW;
-extern void _IO_wstr_finish (_IO_FILE *, int) __THROW;
+extern wint_t _IO_wstr_pbackfail (FILE *, wint_t) __THROW;
+extern void _IO_wstr_finish (FILE *, int) __THROW;
 
 extern int _IO_vasprintf (char **result_ptr, const char *format,
-			  _IO_va_list args) __THROW;
-extern int _IO_vdprintf (int d, const char *format, _IO_va_list arg);
-extern int _IO_vsnprintf (char *string, _IO_size_t maxlen,
-			  const char *format, _IO_va_list args) __THROW;
+			  va_list args) __THROW;
+extern int _IO_vdprintf (int d, const char *format, va_list arg);
+extern int _IO_vsnprintf (char *string, size_t maxlen,
+			  const char *format, va_list args) __THROW;
 
 
-extern _IO_size_t _IO_getline (_IO_FILE *,char *, _IO_size_t, int, int);
+extern size_t _IO_getline (FILE *,char *, size_t, int, int);
 libc_hidden_proto (_IO_getline)
-extern _IO_size_t _IO_getline_info (_IO_FILE *,char *, _IO_size_t,
+extern size_t _IO_getline_info (FILE *,char *, size_t,
 				    int, int, int *);
 libc_hidden_proto (_IO_getline_info)
-extern _IO_ssize_t _IO_getdelim (char **, _IO_size_t *, int, _IO_FILE *);
-extern _IO_size_t _IO_getwline (_IO_FILE *,wchar_t *, _IO_size_t, wint_t, int);
-extern _IO_size_t _IO_getwline_info (_IO_FILE *,wchar_t *, _IO_size_t,
+extern ssize_t _IO_getdelim (char **, size_t *, int, FILE *);
+extern size_t _IO_getwline (FILE *,wchar_t *, size_t, wint_t, int);
+extern size_t _IO_getwline_info (FILE *,wchar_t *, size_t,
 				     wint_t, int, wint_t *);
 
 extern struct _IO_FILE_plus *_IO_list_all;
@@ -684,10 +684,10 @@ libc_hidden_proto (_IO_list_all)
 extern void (*_IO_cleanup_registration_needed) (void);
 
 extern void _IO_str_init_static_internal (struct _IO_strfile_ *, char *,
-					  _IO_size_t, char *) __THROW;
-extern _IO_off64_t _IO_seekoff_unlocked (_IO_FILE *, _IO_off64_t, int, int)
+					  size_t, char *) __THROW;
+extern off64_t _IO_seekoff_unlocked (FILE *, off64_t, int, int)
      attribute_hidden;
-extern _IO_off64_t _IO_seekpos_unlocked (_IO_FILE *, _IO_off64_t, int)
+extern off64_t _IO_seekpos_unlocked (FILE *, off64_t, int)
      attribute_hidden;
 
 #ifndef EOF
@@ -712,19 +712,19 @@ extern _IO_off64_t _IO_seekpos_unlocked (_IO_FILE *, _IO_off64_t, int)
 
 #endif /* _G_HAVE_MMAP */
 
-extern int _IO_vscanf (const char *, _IO_va_list) __THROW;
+extern int _IO_vscanf (const char *, va_list) __THROW;
 
-/* _IO_pos_BAD is an _IO_off64_t value indicating error, unknown, or EOF. */
+/* _IO_pos_BAD is an off64_t value indicating error, unknown, or EOF. */
 #ifndef _IO_pos_BAD
-# define _IO_pos_BAD ((_IO_off64_t) -1)
+# define _IO_pos_BAD ((off64_t) -1)
 #endif
-/* _IO_pos_adjust adjust an _IO_off64_t by some number of bytes. */
+/* _IO_pos_adjust adjust an off64_t by some number of bytes. */
 #ifndef _IO_pos_adjust
 # define _IO_pos_adjust(pos, delta) ((pos) += (delta))
 #endif
-/* _IO_pos_0 is an _IO_off64_t value indicating beginning of file. */
+/* _IO_pos_0 is an off64_t value indicating beginning of file. */
 #ifndef _IO_pos_0
-# define _IO_pos_0 ((_IO_off64_t) 0)
+# define _IO_pos_0 ((off64_t) 0)
 #endif
 
 #ifdef _IO_MTSAFE_IO
@@ -732,12 +732,12 @@ extern int _IO_vscanf (const char *, _IO_va_list) __THROW;
 # ifdef _IO_USE_OLD_IO_FILE
 #  define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
        { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (FILE *) CHAIN, FD, \
 	 0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
 # else
 #  define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
        { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (FILE *) CHAIN, FD, \
 	 0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
 	 NULL, WDP, 0 }
 # endif
@@ -745,12 +745,12 @@ extern int _IO_vscanf (const char *, _IO_va_list) __THROW;
 # ifdef _IO_USE_OLD_IO_FILE
 #  define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
        { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (FILE *) CHAIN, FD, \
 	 0, _IO_pos_BAD }
 # else
 #  define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
        { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (FILE *) CHAIN, FD, \
 	 0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
 	 NULL, WDP, 0 }
 # endif
@@ -787,18 +787,18 @@ extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
 
 static inline void
 __attribute__ ((__always_inline__))
-_IO_acquire_lock_fct (_IO_FILE **p)
+_IO_acquire_lock_fct (FILE **p)
 {
-  _IO_FILE *fp = *p;
+  FILE *fp = *p;
   if ((fp->_flags & _IO_USER_LOCK) == 0)
     _IO_funlockfile (fp);
 }
 
 static inline void
 __attribute__ ((__always_inline__))
-_IO_acquire_lock_clear_flags2_fct (_IO_FILE **p)
+_IO_acquire_lock_clear_flags2_fct (FILE **p)
 {
-  _IO_FILE *fp = *p;
+  FILE *fp = *p;
   fp->_flags2 &= ~(_IO_FLAGS2_FORTIFY | _IO_FLAGS2_SCANF_STD);
   if ((fp->_flags & _IO_USER_LOCK) == 0)
     _IO_funlockfile (fp);
@@ -807,10 +807,10 @@ _IO_acquire_lock_clear_flags2_fct (_IO_FILE **p)
 #if !defined _IO_MTSAFE_IO && IS_IN (libc)
 # define _IO_acquire_lock(_fp)						      \
   do {									      \
-    _IO_FILE *_IO_acquire_lock_file = NULL
+    FILE *_IO_acquire_lock_file = NULL
 # define _IO_acquire_lock_clear_flags2(_fp)				      \
   do {									      \
-    _IO_FILE *_IO_acquire_lock_file = (_fp)
+    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		      \
diff --git a/libio/memstream.c b/libio/memstream.c
index d86befcc02e..8d2726dea32 100644
--- a/libio/memstream.c
+++ b/libio/memstream.c
@@ -25,12 +25,12 @@ struct _IO_FILE_memstream
 {
   _IO_strfile _sf;
   char **bufloc;
-  _IO_size_t *sizeloc;
+  size_t *sizeloc;
 };
 
 
-static int _IO_mem_sync (_IO_FILE* fp) __THROW;
-static void _IO_mem_finish (_IO_FILE* fp, int) __THROW;
+static int _IO_mem_sync (FILE* fp) __THROW;
+static void _IO_mem_finish (FILE* fp, int) __THROW;
 
 
 static const struct _IO_jump_t _IO_mem_jumps libio_vtable =
@@ -60,8 +60,8 @@ static const struct _IO_jump_t _IO_mem_jumps libio_vtable =
 /* Open a stream that writes into a malloc'd buffer that is expanded as
    necessary.  *BUFLOC and *SIZELOC are updated with the buffer's location
    and the number of characters written on fflush or fclose.  */
-_IO_FILE *
-__open_memstream (char **bufloc, _IO_size_t *sizeloc)
+FILE *
+__open_memstream (char **bufloc, size_t *sizeloc)
 {
   struct locked_FILE
   {
@@ -80,7 +80,7 @@ __open_memstream (char **bufloc, _IO_size_t *sizeloc)
   new_f->fp._sf._sbf._f._lock = &new_f->lock;
 #endif
 
-  buf = calloc (1, _IO_BUFSIZ);
+  buf = calloc (1, BUFSIZ);
   if (buf == NULL)
     {
       free (new_f);
@@ -88,7 +88,7 @@ __open_memstream (char **bufloc, _IO_size_t *sizeloc)
     }
   _IO_init_internal (&new_f->fp._sf._sbf._f, 0);
   _IO_JUMPS_FILE_plus (&new_f->fp._sf._sbf) = &_IO_mem_jumps;
-  _IO_str_init_static_internal (&new_f->fp._sf, buf, _IO_BUFSIZ, buf);
+  _IO_str_init_static_internal (&new_f->fp._sf, buf, BUFSIZ, buf);
   new_f->fp._sf._sbf._f._flags &= ~_IO_USER_BUF;
   new_f->fp._sf._s._allocate_buffer = (_IO_alloc_type) malloc;
   new_f->fp._sf._s._free_buffer = (_IO_free_type) free;
@@ -99,14 +99,14 @@ __open_memstream (char **bufloc, _IO_size_t *sizeloc)
   /* Disable single thread optimization.  BZ 21735.  */
   new_f->fp._sf._sbf._f._flags2 |= _IO_FLAGS2_NEED_LOCK;
 
-  return (_IO_FILE *) &new_f->fp._sf._sbf;
+  return (FILE *) &new_f->fp._sf._sbf;
 }
 libc_hidden_def (__open_memstream)
 weak_alias (__open_memstream, open_memstream)
 
 
 static int
-_IO_mem_sync (_IO_FILE *fp)
+_IO_mem_sync (FILE *fp)
 {
   struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
 
@@ -124,7 +124,7 @@ _IO_mem_sync (_IO_FILE *fp)
 
 
 static void
-_IO_mem_finish (_IO_FILE *fp, int dummy)
+_IO_mem_finish (FILE *fp, int dummy)
 {
   struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
 
diff --git a/libio/obprintf.c b/libio/obprintf.c
index 4adafc9f2cd..a74f9467a26 100644
--- a/libio/obprintf.c
+++ b/libio/obprintf.c
@@ -37,7 +37,7 @@ struct _IO_obstack_file
 
 
 static int
-_IO_obstack_overflow (_IO_FILE *fp, int c)
+_IO_obstack_overflow (FILE *fp, int c)
 {
   struct obstack *obstack = ((struct _IO_obstack_file *) fp)->obstack;
   int size;
@@ -59,8 +59,8 @@ _IO_obstack_overflow (_IO_FILE *fp, int c)
 }
 
 
-static _IO_size_t
-_IO_obstack_xsputn (_IO_FILE *fp, const void *data, _IO_size_t n)
+static size_t
+_IO_obstack_xsputn (FILE *fp, const void *data, size_t n)
 {
   struct obstack *obstack = ((struct _IO_obstack_file *) fp)->obstack;
 
diff --git a/libio/oldfileops.c b/libio/oldfileops.c
index f00f6cb9792..5b6e81c4967 100644
--- a/libio/oldfileops.c
+++ b/libio/oldfileops.c
@@ -128,7 +128,7 @@ _IO_old_file_init (struct _IO_FILE_plus *fp)
 
 int
 attribute_compat_text_section
-_IO_old_file_close_it (_IO_FILE *fp)
+_IO_old_file_close_it (FILE *fp)
 {
   int write_status, close_status;
   if (!_IO_file_is_open (fp))
@@ -156,7 +156,7 @@ _IO_old_file_close_it (_IO_FILE *fp)
 
 void
 attribute_compat_text_section
-_IO_old_file_finish (_IO_FILE *fp, int dummy)
+_IO_old_file_finish (FILE *fp, int dummy)
 {
   if (_IO_file_is_open (fp))
     {
@@ -167,9 +167,9 @@ _IO_old_file_finish (_IO_FILE *fp, int dummy)
   _IO_default_finish (fp, 0);
 }
 
-_IO_FILE *
+FILE *
 attribute_compat_text_section
-_IO_old_file_fopen (_IO_FILE *fp, const char *filename, const char *mode)
+_IO_old_file_fopen (FILE *fp, const char *filename, const char *mode)
 {
   int oflags = 0, omode;
   int read_write, fdesc;
@@ -207,16 +207,16 @@ _IO_old_file_fopen (_IO_FILE *fp, const char *filename, const char *mode)
   fp->_fileno = fdesc;
   _IO_mask_flags (fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
   if (read_write & _IO_IS_APPENDING)
-    if (_IO_SEEKOFF (fp, (_IO_off_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
+    if (_IO_SEEKOFF (fp, (off_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
 	== _IO_pos_BAD && errno != ESPIPE)
       return NULL;
   _IO_link_in ((struct _IO_FILE_plus *) fp);
   return fp;
 }
 
-_IO_FILE *
+FILE *
 attribute_compat_text_section
-_IO_old_file_attach (_IO_FILE *fp, int fd)
+_IO_old_file_attach (FILE *fp, int fd)
 {
   if (_IO_file_is_open (fp))
     return NULL;
@@ -226,15 +226,15 @@ _IO_old_file_attach (_IO_FILE *fp, int fd)
   /* Get the current position of the file. */
   /* We have to do that since that may be junk. */
   fp->_old_offset = _IO_pos_BAD;
-  if (_IO_SEEKOFF (fp, (_IO_off_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
+  if (_IO_SEEKOFF (fp, (off_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
       == _IO_pos_BAD && errno != ESPIPE)
     return NULL;
   return fp;
 }
 
-_IO_FILE *
+FILE *
 attribute_compat_text_section
-_IO_old_file_setbuf (_IO_FILE *fp, char *p, _IO_ssize_t len)
+_IO_old_file_setbuf (FILE *fp, char *p, ssize_t len)
 {
     if (_IO_default_setbuf (fp, p, len) == NULL)
       return NULL;
@@ -246,24 +246,24 @@ _IO_old_file_setbuf (_IO_FILE *fp, char *p, _IO_ssize_t len)
     return fp;
 }
 
-static int old_do_write (_IO_FILE *, const char *, _IO_size_t);
+static int old_do_write (FILE *, const char *, size_t);
 
 /* Write TO_DO bytes from DATA to FP.
    Then mark FP as having empty buffers. */
 
 int
 attribute_compat_text_section
-_IO_old_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do)
+_IO_old_do_write (FILE *fp, const char *data, size_t to_do)
 {
-  return (to_do == 0 || (_IO_size_t) old_do_write (fp, data, to_do) == to_do)
+  return (to_do == 0 || (size_t) old_do_write (fp, data, to_do) == to_do)
 	 ? 0 : EOF;
 }
 
 static int
 attribute_compat_text_section
-old_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do)
+old_do_write (FILE *fp, const char *data, size_t to_do)
 {
-  _IO_size_t count;
+  size_t count;
   if (fp->_flags & _IO_IS_APPENDING)
     /* On a system without a proper O_APPEND implementation,
        you would need to sys_seek(0, SEEK_END) here, but is
@@ -273,7 +273,7 @@ old_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do)
     fp->_old_offset = _IO_pos_BAD;
   else if (fp->_IO_read_end != fp->_IO_write_base)
     {
-      _IO_off_t new_pos
+      off_t new_pos
 	= _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
       if (new_pos == _IO_pos_BAD)
 	return 0;
@@ -291,9 +291,9 @@ old_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do)
 
 int
 attribute_compat_text_section
-_IO_old_file_underflow (_IO_FILE *fp)
+_IO_old_file_underflow (FILE *fp)
 {
-  _IO_ssize_t count;
+  ssize_t count;
 #if 0
   /* SysV does not make this test; take it out for compatibility */
   if (fp->_flags & _IO_EOF_SEEN)
@@ -355,7 +355,7 @@ _IO_old_file_underflow (_IO_FILE *fp)
 
 int
 attribute_compat_text_section
-_IO_old_file_overflow (_IO_FILE *f, int ch)
+_IO_old_file_overflow (FILE *f, int ch)
 {
   if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
     {
@@ -405,9 +405,9 @@ _IO_old_file_overflow (_IO_FILE *f, int ch)
 
 int
 attribute_compat_text_section
-_IO_old_file_sync (_IO_FILE *fp)
+_IO_old_file_sync (FILE *fp)
 {
-  _IO_ssize_t delta;
+  ssize_t delta;
   int retval = 0;
 
   /*    char* ptr = cur_ptr(); */
@@ -420,8 +420,8 @@ _IO_old_file_sync (_IO_FILE *fp)
       if (_IO_in_backup (fp))
 	delta -= eGptr () - Gbase ();
 #endif
-      _IO_off_t new_pos = _IO_SYSSEEK (fp, delta, 1);
-      if (new_pos != (_IO_off_t) EOF)
+      off_t new_pos = _IO_SYSSEEK (fp, delta, 1);
+      if (new_pos != (off_t) EOF)
 	fp->_IO_read_end = fp->_IO_read_ptr;
       else if (errno == ESPIPE)
 	; /* Ignore error from unseekable devices. */
@@ -435,12 +435,12 @@ _IO_old_file_sync (_IO_FILE *fp)
   return retval;
 }
 
-_IO_off64_t
+off64_t
 attribute_compat_text_section
-_IO_old_file_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
+_IO_old_file_seekoff (FILE *fp, off64_t offset, int dir, int mode)
 {
-  _IO_off_t result;
-  _IO_off64_t delta, new_offset;
+  off_t result;
+  off64_t delta, new_offset;
   long count;
   /* POSIX.1 8.2.3.7 says that after a call the fflush() the file
      offset of the underlying file must be exact.  */
@@ -512,7 +512,7 @@ _IO_old_file_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
       && !_IO_in_backup (fp))
     {
       /* Offset relative to start of main get area. */
-      _IO_off_t rel_offset = (offset - fp->_old_offset
+      off_t rel_offset = (offset - fp->_old_offset
 			      + (fp->_IO_read_end - fp->_IO_read_base));
       if (rel_offset >= 0)
 	{
@@ -618,14 +618,14 @@ resync:
   return offset;
 }
 
-_IO_ssize_t
+ssize_t
 attribute_compat_text_section
-_IO_old_file_write (_IO_FILE *f, const void *data, _IO_ssize_t n)
+_IO_old_file_write (FILE *f, const void *data, ssize_t n)
 {
-  _IO_ssize_t to_do = n;
+  ssize_t to_do = n;
   while (to_do > 0)
     {
-      _IO_ssize_t count = __write (f->_fileno, data, to_do);
+      ssize_t count = __write (f->_fileno, data, to_do);
       if (count == EOF)
 	{
 	  f->_flags |= _IO_ERR_SEEN;
@@ -640,14 +640,14 @@ _IO_old_file_write (_IO_FILE *f, const void *data, _IO_ssize_t n)
   return n;
 }
 
-_IO_size_t
+size_t
 attribute_compat_text_section
-_IO_old_file_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
+_IO_old_file_xsputn (FILE *f, const void *data, size_t n)
 {
   const char *s = (char *) data;
-  _IO_size_t to_do = n;
+  size_t to_do = n;
   int must_flush = 0;
-  _IO_size_t count = 0;
+  size_t count = 0;
 
   if (n <= 0)
     return 0;
@@ -698,7 +698,7 @@ _IO_old_file_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
     }
   if (to_do + must_flush > 0)
     {
-      _IO_size_t block_size, do_write;
+      size_t block_size, do_write;
       /* Next flush the (full) buffer. */
       if (__overflow (f, EOF) == EOF)
 	return to_do == 0 ? EOF : n - to_do;
diff --git a/libio/oldfmemopen.c b/libio/oldfmemopen.c
index e111c160f9b..d7f0db34235 100644
--- a/libio/oldfmemopen.c
+++ b/libio/oldfmemopen.c
@@ -85,7 +85,7 @@ struct fmemopen_cookie_struct
   int mybuffer;
   int binmode;
   size_t size;
-  _IO_off64_t pos;
+  off64_t pos;
   size_t maxpos;
 };
 
@@ -149,9 +149,9 @@ fmemopen_write (void *cookie, const char *b, size_t s)
 
 
 static int
-fmemopen_seek (void *cookie, _IO_off64_t *p, int w)
+fmemopen_seek (void *cookie, off64_t *p, int w)
 {
-  _IO_off64_t np;
+  off64_t np;
   fmemopen_cookie_t *c;
 
   c = (fmemopen_cookie_t *) cookie;
diff --git a/libio/oldiofclose.c b/libio/oldiofclose.c
index b67d7caf2fb..432a7dd89a4 100644
--- a/libio/oldiofclose.c
+++ b/libio/oldiofclose.c
@@ -33,7 +33,7 @@
 
 int
 attribute_compat_text_section
-_IO_old_fclose (_IO_FILE *fp)
+_IO_old_fclose (FILE *fp)
 {
   int status;
 
diff --git a/libio/oldiofdopen.c b/libio/oldiofdopen.c
index 4e6da06975e..be670e8da4d 100644
--- a/libio/oldiofdopen.c
+++ b/libio/oldiofdopen.c
@@ -32,7 +32,7 @@
 #include "libioP.h"
 #include <fcntl.h>
 
-_IO_FILE *
+FILE *
 attribute_compat_text_section
 _IO_old_fdopen (int fd, const char *mode)
 {
@@ -116,7 +116,7 @@ _IO_old_fdopen (int fd, const char *mode)
   _IO_mask_flags (&new_f->fp.file._file, read_write,
 		  _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
 
-  return (_IO_FILE *) &new_f->fp;
+  return (FILE *) &new_f->fp;
 }
 
 strong_alias (_IO_old_fdopen, __old_fdopen)
diff --git a/libio/oldiofgetpos.c b/libio/oldiofgetpos.c
index 19422f464df..bf3753f86c5 100644
--- a/libio/oldiofgetpos.c
+++ b/libio/oldiofgetpos.c
@@ -32,9 +32,9 @@
 
 int
 attribute_compat_text_section
-_IO_old_fgetpos (_IO_FILE *fp, _IO_fpos_t *posp)
+_IO_old_fgetpos (FILE *fp, __fpos_t *posp)
 {
-  _IO_off_t pos;
+  off_t pos;
   CHECK_FILE (fp, EOF);
   _IO_acquire_lock (fp);
   pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
diff --git a/libio/oldiofgetpos64.c b/libio/oldiofgetpos64.c
index c4311f91713..e542dbfd52d 100644
--- a/libio/oldiofgetpos64.c
+++ b/libio/oldiofgetpos64.c
@@ -32,9 +32,9 @@
 
 int
 attribute_compat_text_section
-_IO_old_fgetpos64 (_IO_FILE *fp, _IO_fpos64_t *posp)
+_IO_old_fgetpos64 (FILE *fp, __fpos64_t *posp)
 {
-  _IO_off64_t pos;
+  off64_t pos;
   CHECK_FILE (fp, EOF);
   _IO_acquire_lock (fp);
   pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
diff --git a/libio/oldiofopen.c b/libio/oldiofopen.c
index 6e201f8c952..f4ead0c1299 100644
--- a/libio/oldiofopen.c
+++ b/libio/oldiofopen.c
@@ -32,7 +32,7 @@
 #include <stdlib.h>
 
 
-_IO_FILE *
+FILE *
 attribute_compat_text_section
 _IO_old_fopen (const char *filename, const char *mode)
 {
@@ -55,8 +55,8 @@ _IO_old_fopen (const char *filename, const char *mode)
 #if  !_IO_UNIFIED_JUMPTABLES
   new_f->fp.vtable = NULL;
 #endif
-  if (_IO_old_file_fopen ((_IO_FILE *) &new_f->fp, filename, mode) != NULL)
-    return (_IO_FILE *) &new_f->fp;
+  if (_IO_old_file_fopen ((FILE *) &new_f->fp, filename, mode) != NULL)
+    return (FILE *) &new_f->fp;
   _IO_un_link ((struct _IO_FILE_plus *) &new_f->fp);
   free (new_f);
   return NULL;
diff --git a/libio/oldiofsetpos.c b/libio/oldiofsetpos.c
index ee634bcac46..6e80522b4a0 100644
--- a/libio/oldiofsetpos.c
+++ b/libio/oldiofsetpos.c
@@ -31,7 +31,7 @@
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
 int
 attribute_compat_text_section
-_IO_old_fsetpos (_IO_FILE *fp, const _IO_fpos_t *posp)
+_IO_old_fsetpos (FILE *fp, const __fpos_t *posp)
 {
   int result;
   CHECK_FILE (fp, EOF);
diff --git a/libio/oldiofsetpos64.c b/libio/oldiofsetpos64.c
index e1e41101bad..c00931fdba7 100644
--- a/libio/oldiofsetpos64.c
+++ b/libio/oldiofsetpos64.c
@@ -32,7 +32,7 @@
 
 int
 attribute_compat_text_section
-_IO_old_fsetpos64 (_IO_FILE *fp, const _IO_fpos64_t *posp)
+_IO_old_fsetpos64 (FILE *fp, const __fpos64_t *posp)
 {
   int result;
   CHECK_FILE (fp, EOF);
diff --git a/libio/oldiopopen.c b/libio/oldiopopen.c
index 59d404bfa9e..42cab4e8f77 100644
--- a/libio/oldiopopen.c
+++ b/libio/oldiopopen.c
@@ -41,7 +41,7 @@ struct _IO_proc_file
 {
   struct _IO_FILE_complete_plus file;
   /* Following fields must match those in class procbuf (procbuf.h) */
-  _IO_pid_t pid;
+  pid_t pid;
   struct _IO_proc_file *next;
 };
 typedef struct _IO_proc_file _IO_proc_file;
@@ -58,14 +58,14 @@ unlock (void *not_used)
 }
 #endif
 
-_IO_FILE *
+FILE *
 attribute_compat_text_section
-_IO_old_proc_open (_IO_FILE *fp, const char *command, const char *mode)
+_IO_old_proc_open (FILE *fp, const char *command, const char *mode)
 {
   volatile int read_or_write;
   volatile int parent_end, child_end;
   int pipe_fds[2];
-  _IO_pid_t child_pid;
+  pid_t child_pid;
   if (_IO_file_is_open (fp))
     return NULL;
   if (__pipe (pipe_fds) < 0)
@@ -105,7 +105,7 @@ _IO_old_proc_open (_IO_FILE *fp, const char *command, const char *mode)
          popen() calls that remain open in the parent process are closed
 	 in the new child process." */
       for (p = old_proc_file_chain; p; p = p->next)
-	__close (_IO_fileno ((_IO_FILE *) p));
+	__close (_IO_fileno ((FILE *) p));
 
       execl ("/bin/sh", "sh", "-c", command, (char *) 0);
       _exit (127);
@@ -134,7 +134,7 @@ _IO_old_proc_open (_IO_FILE *fp, const char *command, const char *mode)
   return fp;
 }
 
-_IO_FILE *
+FILE *
 attribute_compat_text_section
 _IO_old_popen (const char *command, const char *mode)
 {
@@ -145,7 +145,7 @@ _IO_old_popen (const char *command, const char *mode)
     _IO_lock_t lock;
 #endif
   } *new_f;
-  _IO_FILE *fp;
+  FILE *fp;
 
   new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
   if (new_f == NULL)
@@ -169,12 +169,12 @@ _IO_old_popen (const char *command, const char *mode)
 
 int
 attribute_compat_text_section
-_IO_old_proc_close (_IO_FILE *fp)
+_IO_old_proc_close (FILE *fp)
 {
   /* This is not name-space clean. FIXME! */
   int wstatus;
   _IO_proc_file **ptr = &old_proc_file_chain;
-  _IO_pid_t wait_pid;
+  pid_t wait_pid;
   int status = -1;
 
   /* Unlink from old_proc_file_chain. */
diff --git a/libio/oldstdfiles.c b/libio/oldstdfiles.c
index 92d0f4a0d3a..f3dda890042 100644
--- a/libio/oldstdfiles.c
+++ b/libio/oldstdfiles.c
@@ -78,9 +78,9 @@ _IO_check_libio (void)
   if (&_IO_stdin_used == NULL)
     {
       /* We are using the old one. */
-      _IO_stdin = stdin = (_IO_FILE *) &_IO_stdin_;
-      _IO_stdout = stdout = (_IO_FILE *) &_IO_stdout_;
-      _IO_stderr = stderr = (_IO_FILE *) &_IO_stderr_;
+      _IO_stdin = stdin = (FILE *) &_IO_stdin_;
+      _IO_stdout = stdout = (FILE *) &_IO_stdout_;
+      _IO_stderr = stderr = (FILE *) &_IO_stderr_;
       _IO_list_all = &_IO_stderr_;
       _IO_stdin->_vtable_offset = _IO_stdout->_vtable_offset =
 	_IO_stderr->_vtable_offset = stdin->_vtable_offset =
diff --git a/libio/peekc.c b/libio/peekc.c
index fbe2ad68857..7de76a7cea6 100644
--- a/libio/peekc.c
+++ b/libio/peekc.c
@@ -30,7 +30,7 @@
 #undef _IO_peekc
 
 int
-_IO_peekc_locked (_IO_FILE *fp)
+_IO_peekc_locked (FILE *fp)
 {
   int result;
   CHECK_FILE (fp, EOF);
diff --git a/libio/putc.c b/libio/putc.c
index 9cd6c610291..13570f579b1 100644
--- a/libio/putc.c
+++ b/libio/putc.c
@@ -21,7 +21,7 @@
 #undef _IO_putc
 
 int
-_IO_putc (int c, _IO_FILE *fp)
+_IO_putc (int c, FILE *fp)
 {
   int result;
   CHECK_FILE (fp, EOF);
diff --git a/libio/putc_u.c b/libio/putc_u.c
index 61ca95bedaa..e1e0c8ee5f4 100644
--- a/libio/putc_u.c
+++ b/libio/putc_u.c
@@ -21,7 +21,7 @@
 #undef putc_unlocked
 
 int
-putc_unlocked (int c, _IO_FILE *fp)
+putc_unlocked (int c, FILE *fp)
 {
   CHECK_FILE (fp, EOF);
   return _IO_putc_unlocked (c, fp);
diff --git a/libio/putwc.c b/libio/putwc.c
index a7dae613314..f74346f3dc2 100644
--- a/libio/putwc.c
+++ b/libio/putwc.c
@@ -19,7 +19,7 @@
 #include <wchar.h>
 
 wint_t
-putwc (wchar_t wc, _IO_FILE *fp)
+putwc (wchar_t wc, FILE *fp)
 {
   wint_t result;
   CHECK_FILE (fp, WEOF);
diff --git a/libio/putwc_u.c b/libio/putwc_u.c
index 6a6ad554910..e73421f6928 100644
--- a/libio/putwc_u.c
+++ b/libio/putwc_u.c
@@ -19,7 +19,7 @@
 #include <wchar.h>
 
 wint_t
-putwc_unlocked (wchar_t wc, _IO_FILE *fp)
+putwc_unlocked (wchar_t wc, FILE *fp)
 {
   CHECK_FILE (fp, WEOF);
   return _IO_putwc_unlocked (wc, fp);
diff --git a/libio/rewind.c b/libio/rewind.c
index 9d3150e19cb..bfb73f1cd75 100644
--- a/libio/rewind.c
+++ b/libio/rewind.c
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 void
-rewind (_IO_FILE *fp)
+rewind (FILE *fp)
 {
   CHECK_FILE (fp, );
   _IO_acquire_lock (fp);
diff --git a/libio/setbuf.c b/libio/setbuf.c
index 88e563b8ee8..fa65e26ef05 100644
--- a/libio/setbuf.c
+++ b/libio/setbuf.c
@@ -28,7 +28,7 @@
 #include "stdio.h"
 
 void
-setbuf (_IO_FILE *fp, char *buf)
+setbuf (FILE *fp, char *buf)
 {
-  _IO_setbuffer (fp, buf, _IO_BUFSIZ);
+  _IO_setbuffer (fp, buf, BUFSIZ);
 }
diff --git a/libio/setlinebuf.c b/libio/setlinebuf.c
index ef7d2cf4571..a6035b808de 100644
--- a/libio/setlinebuf.c
+++ b/libio/setlinebuf.c
@@ -30,7 +30,7 @@
 #undef setlinebuf
 
 void
-setlinebuf (_IO_FILE *stream)
+setlinebuf (FILE *stream)
 {
   _IO_setvbuf (stream, NULL, 1, 0);
 }
diff --git a/libio/stdio.c b/libio/stdio.c
index adcef35b65d..1b7a1bc2e0a 100644
--- a/libio/stdio.c
+++ b/libio/stdio.c
@@ -30,9 +30,9 @@
 #undef stdin
 #undef stdout
 #undef stderr
-_IO_FILE *stdin = (FILE *) &_IO_2_1_stdin_;
-_IO_FILE *stdout = (FILE *) &_IO_2_1_stdout_;
-_IO_FILE *stderr = (FILE *) &_IO_2_1_stderr_;
+FILE *stdin = (FILE *) &_IO_2_1_stdin_;
+FILE *stdout = (FILE *) &_IO_2_1_stdout_;
+FILE *stderr = (FILE *) &_IO_2_1_stderr_;
 
 #undef _IO_stdin
 #undef _IO_stdout
diff --git a/libio/strfile.h b/libio/strfile.h
index 68dfcbfe835..b96fd0fb0ae 100644
--- a/libio/strfile.h
+++ b/libio/strfile.h
@@ -25,8 +25,9 @@
    in files containing the exception.  */
 
 #include <stdio.h>
+#include "libioP.h"
 
-typedef void *(*_IO_alloc_type) (_IO_size_t);
+typedef void *(*_IO_alloc_type) (size_t);
 typedef void (*_IO_free_type) (void*);
 
 struct _IO_str_fields
@@ -42,7 +43,7 @@ struct _IO_str_fields
 
 struct _IO_streambuf
 {
-  struct _IO_FILE _f;
+  FILE _f;
   const struct _IO_jump_t *vtable;
 };
 
diff --git a/libio/strops.c b/libio/strops.c
index ac995c830e8..adfa80749c1 100644
--- a/libio/strops.c
+++ b/libio/strops.c
@@ -31,15 +31,15 @@
 #include <stdio_ext.h>
 
 void
-_IO_str_init_static_internal (_IO_strfile *sf, char *ptr, _IO_size_t size,
+_IO_str_init_static_internal (_IO_strfile *sf, char *ptr, size_t size,
 			      char *pstart)
 {
-  _IO_FILE *fp = &sf->_sbf._f;
+  FILE *fp = &sf->_sbf._f;
   char *end;
 
   if (size == 0)
     end = __rawmemchr (ptr, '\0');
-  else if ((_IO_size_t) ptr + size > (_IO_size_t) ptr)
+  else if ((size_t) ptr + size > (size_t) ptr)
     end = ptr + size;
   else
     end = (char *) -1;
@@ -78,10 +78,10 @@ _IO_str_init_readonly (_IO_strfile *sf, const char *ptr, int size)
 }
 
 int
-_IO_str_overflow (_IO_FILE *fp, int c)
+_IO_str_overflow (FILE *fp, int c)
 {
   int flush_only = c == EOF;
-  _IO_size_t pos;
+  size_t pos;
   if (fp->_flags & _IO_NO_WRITES)
       return flush_only ? 0 : EOF;
   if ((fp->_flags & _IO_TIED_PUT_GET) && !(fp->_flags & _IO_CURRENTLY_PUTTING))
@@ -91,7 +91,7 @@ _IO_str_overflow (_IO_FILE *fp, int c)
       fp->_IO_read_ptr = fp->_IO_read_end;
     }
   pos = fp->_IO_write_ptr - fp->_IO_write_base;
-  if (pos >= (_IO_size_t) (_IO_blen (fp) + flush_only))
+  if (pos >= (size_t) (_IO_blen (fp) + flush_only))
     {
       if (fp->_flags & _IO_USER_BUF) /* not allowed to enlarge */
 	return EOF;
@@ -100,7 +100,7 @@ _IO_str_overflow (_IO_FILE *fp, int c)
 	  char *new_buf;
 	  char *old_buf = fp->_IO_buf_base;
 	  size_t old_blen = _IO_blen (fp);
-	  _IO_size_t new_size = 2 * old_blen + 100;
+	  size_t new_size = 2 * old_blen + 100;
 	  if (new_size < old_blen)
 	    return EOF;
 	  new_buf
@@ -139,7 +139,7 @@ _IO_str_overflow (_IO_FILE *fp, int c)
 libc_hidden_def (_IO_str_overflow)
 
 int
-_IO_str_underflow (_IO_FILE *fp)
+_IO_str_underflow (FILE *fp)
 {
   if (fp->_IO_write_ptr > fp->_IO_read_end)
     fp->_IO_read_end = fp->_IO_write_ptr;
@@ -158,8 +158,8 @@ libc_hidden_def (_IO_str_underflow)
 
 /* The size of the valid part of the buffer.  */
 
-_IO_ssize_t
-_IO_str_count (_IO_FILE *fp)
+ssize_t
+_IO_str_count (FILE *fp)
 {
   return ((fp->_IO_write_ptr > fp->_IO_read_end
 	   ? fp->_IO_write_ptr : fp->_IO_read_end)
@@ -168,19 +168,19 @@ _IO_str_count (_IO_FILE *fp)
 
 
 static int
-enlarge_userbuf (_IO_FILE *fp, _IO_off64_t offset, int reading)
+enlarge_userbuf (FILE *fp, off64_t offset, int reading)
 {
-  if ((_IO_ssize_t) offset <= _IO_blen (fp))
+  if ((ssize_t) offset <= _IO_blen (fp))
     return 0;
 
-  _IO_ssize_t oldend = fp->_IO_write_end - fp->_IO_write_base;
+  ssize_t oldend = fp->_IO_write_end - fp->_IO_write_base;
 
   /* Try to enlarge the buffer.  */
   if (fp->_flags & _IO_USER_BUF)
     /* User-provided buffer.  */
     return 1;
 
-  _IO_size_t newsize = offset + 100;
+  size_t newsize = offset + 100;
   char *oldbuf = fp->_IO_buf_base;
   char *newbuf
     = (char *) (*((_IO_strfile *) fp)->_s._allocate_buffer) (newsize);
@@ -231,7 +231,7 @@ enlarge_userbuf (_IO_FILE *fp, _IO_off64_t offset, int reading)
 }
 
 static void
-_IO_str_switch_to_get_mode (_IO_FILE *fp)
+_IO_str_switch_to_get_mode (FILE *fp)
 {
   if (_IO_in_backup (fp))
     fp->_IO_read_base = fp->_IO_backup_base;
@@ -246,10 +246,10 @@ _IO_str_switch_to_get_mode (_IO_FILE *fp)
   fp->_flags &= ~_IO_CURRENTLY_PUTTING;
 }
 
-_IO_off64_t
-_IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
+off64_t
+_IO_str_seekoff (FILE *fp, off64_t offset, int dir, int mode)
 {
-  _IO_off64_t new_pos;
+  off64_t new_pos;
 
   if (mode == 0 && (fp->_flags & _IO_TIED_PUT_GET))
     mode = (fp->_flags & _IO_CURRENTLY_PUTTING ? _IOS_OUTPUT : _IOS_INPUT);
@@ -265,13 +265,13 @@ _IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
     }
   else
     {
-      _IO_ssize_t cur_size = _IO_str_count(fp);
+      ssize_t cur_size = _IO_str_count(fp);
       new_pos = EOF;
 
       /* Move the get pointer, if requested. */
       if (mode & _IOS_INPUT)
 	{
-	  _IO_ssize_t base;
+	  ssize_t base;
 	  switch (dir)
 	    {
 	    case _IO_seek_set:
@@ -284,7 +284,7 @@ _IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
 	      base = cur_size;
 	      break;
 	    }
-	  _IO_ssize_t maxval = SSIZE_MAX - base;
+	  ssize_t maxval = SSIZE_MAX - base;
 	  if (offset < -base || offset > maxval)
 	    {
 	      __set_errno (EINVAL);
@@ -302,7 +302,7 @@ _IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
       /* Move the put pointer, if requested. */
       if (mode & _IOS_OUTPUT)
 	{
-	  _IO_ssize_t base;
+	  ssize_t base;
 	  switch (dir)
 	    {
 	    case _IO_seek_set:
@@ -315,7 +315,7 @@ _IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
 	      base = cur_size;
 	      break;
 	    }
-	  _IO_ssize_t maxval = SSIZE_MAX - base;
+	  ssize_t maxval = SSIZE_MAX - base;
 	  if (offset < -base || offset > maxval)
 	    {
 	      __set_errno (EINVAL);
@@ -334,7 +334,7 @@ _IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
 libc_hidden_def (_IO_str_seekoff)
 
 int
-_IO_str_pbackfail (_IO_FILE *fp, int c)
+_IO_str_pbackfail (FILE *fp, int c)
 {
   if ((fp->_flags & _IO_NO_WRITES) && c != EOF)
     return EOF;
@@ -343,7 +343,7 @@ _IO_str_pbackfail (_IO_FILE *fp, int c)
 libc_hidden_def (_IO_str_pbackfail)
 
 void
-_IO_str_finish (_IO_FILE *fp, int dummy)
+_IO_str_finish (FILE *fp, int dummy)
 {
   if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
     (((_IO_strfile *) fp)->_s._free_buffer) (fp->_IO_buf_base);
diff --git a/libio/vasprintf.c b/libio/vasprintf.c
index 390a63d1241..08218ddbe76 100644
--- a/libio/vasprintf.c
+++ b/libio/vasprintf.c
@@ -32,16 +32,16 @@
 #include "strfile.h"
 
 int
-_IO_vasprintf (char **result_ptr, const char *format, _IO_va_list args)
+_IO_vasprintf (char **result_ptr, const char *format, va_list args)
 {
   /* Initial size of the buffer to be used.  Will be doubled each time an
      overflow occurs.  */
-  const _IO_size_t init_string_size = 100;
+  const size_t init_string_size = 100;
   char *string;
   _IO_strfile sf;
   int ret;
-  _IO_size_t needed;
-  _IO_size_t allocated;
+  size_t needed;
+  size_t allocated;
   /* No need to clear the memory here (unlike for open_memstream) since
      we know we will never seek on the stream.  */
   string = (char *) malloc (init_string_size);
diff --git a/libio/vscanf.c b/libio/vscanf.c
index a74e5418261..9c27122c276 100644
--- a/libio/vscanf.c
+++ b/libio/vscanf.c
@@ -30,7 +30,7 @@
 #undef vscanf
 
 int
-_IO_vscanf (const char *format, _IO_va_list args)
+_IO_vscanf (const char *format, va_list args)
 {
   return _IO_vfscanf (_IO_stdin, format, args, NULL);
 }
diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c
index 7e67a0a2c84..39b55005280 100644
--- a/libio/vsnprintf.c
+++ b/libio/vsnprintf.c
@@ -27,10 +27,10 @@
 #include "libioP.h"
 #include "strfile.h"
 
-static int _IO_strn_overflow (_IO_FILE *fp, int c) __THROW;
+static int _IO_strn_overflow (FILE *fp, int c) __THROW;
 
 static int
-_IO_strn_overflow (_IO_FILE *fp, int c)
+_IO_strn_overflow (FILE *fp, int c)
 {
   /* When we come to here this means the user supplied buffer is
      filled.  But since we must return the number of characters which
@@ -90,8 +90,8 @@ const struct _IO_jump_t _IO_strn_jumps libio_vtable attribute_hidden =
 
 
 int
-_IO_vsnprintf (char *string, _IO_size_t maxlen, const char *format,
-	       _IO_va_list args)
+_IO_vsnprintf (char *string, size_t maxlen, const char *format,
+	       va_list args)
 {
   _IO_strnfile sf;
   int ret;
diff --git a/libio/vswprintf.c b/libio/vswprintf.c
index bf23a0d6654..bcc473d1157 100644
--- a/libio/vswprintf.c
+++ b/libio/vswprintf.c
@@ -28,10 +28,10 @@
 #include "strfile.h"
 
 
-static wint_t _IO_wstrn_overflow (_IO_FILE *fp, wint_t c) __THROW;
+static wint_t _IO_wstrn_overflow (FILE *fp, wint_t c) __THROW;
 
 static wint_t
-_IO_wstrn_overflow (_IO_FILE *fp, wint_t c)
+_IO_wstrn_overflow (FILE *fp, wint_t c)
 {
   /* When we come to here this means the user supplied buffer is
      filled.  But since we must return the number of characters which
@@ -89,8 +89,8 @@ const struct _IO_jump_t _IO_wstrn_jumps libio_vtable attribute_hidden =
 
 
 int
-_IO_vswprintf (wchar_t *string, _IO_size_t maxlen, const wchar_t *format,
-	       _IO_va_list args)
+_IO_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *format,
+	       va_list args)
 {
   _IO_wstrnfile sf;
   int ret;
@@ -108,7 +108,7 @@ _IO_vswprintf (wchar_t *string, _IO_size_t maxlen, const wchar_t *format,
   _IO_fwide (&sf.f._sbf._f, 1);
   string[0] = L'\0';
   _IO_wstr_init_static (&sf.f._sbf._f, string, maxlen - 1, string);
-  ret = _IO_vfwprintf ((_IO_FILE *) &sf.f._sbf, format, args);
+  ret = _IO_vfwprintf ((FILE *) &sf.f._sbf, format, args);
 
   if (sf.f._sbf._f._wide_data->_IO_buf_base == sf.overflow_buf)
     /* ISO C99 requires swprintf/vswprintf to return an error if the
diff --git a/libio/vwscanf.c b/libio/vwscanf.c
index a9704d0d89c..0d5f5587589 100644
--- a/libio/vwscanf.c
+++ b/libio/vwscanf.c
@@ -28,7 +28,7 @@
 #include <wchar.h>
 
 int
-__vwscanf (const wchar_t *format, _IO_va_list args)
+__vwscanf (const wchar_t *format, va_list args)
 {
   return _IO_vfwscanf (_IO_stdin, format, args, NULL);
 }
diff --git a/libio/wfiledoalloc.c b/libio/wfiledoalloc.c
index c60d875cbb0..c3f4ba8cd4b 100644
--- a/libio/wfiledoalloc.c
+++ b/libio/wfiledoalloc.c
@@ -60,9 +60,9 @@
 
 /* Allocate a file buffer, or switch to unbuffered I/O.  */
 int
-_IO_wfile_doallocate (_IO_FILE *fp)
+_IO_wfile_doallocate (FILE *fp)
 {
-  _IO_size_t size;
+  size_t size;
   wchar_t *p;
 
   /* Allocate room for the external buffer.  */
diff --git a/libio/wfileops.c b/libio/wfileops.c
index 2488821d54e..aecbf0d86d7 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -36,7 +36,7 @@
 /* Convert TO_DO wide character from DATA to FP.
    Then mark FP as having empty buffers. */
 int
-_IO_wdo_write (_IO_FILE *fp, const wchar_t *data, _IO_size_t to_do)
+_IO_wdo_write (FILE *fp, const wchar_t *data, size_t to_do)
 {
   struct _IO_codecvt *cc = fp->_codecvt;
 
@@ -110,11 +110,11 @@ libc_hidden_def (_IO_wdo_write)
 
 
 wint_t
-_IO_wfile_underflow (_IO_FILE *fp)
+_IO_wfile_underflow (FILE *fp)
 {
   struct _IO_codecvt *cd;
   enum __codecvt_result status;
-  _IO_ssize_t count;
+  ssize_t count;
 
   if (__glibc_unlikely (fp->_flags & _IO_NO_READS))
     {
@@ -332,7 +332,7 @@ libc_hidden_def (_IO_wfile_underflow)
 
 
 static wint_t
-_IO_wfile_underflow_mmap (_IO_FILE *fp)
+_IO_wfile_underflow_mmap (FILE *fp)
 {
   struct _IO_codecvt *cd;
   const char *read_stop;
@@ -393,7 +393,7 @@ _IO_wfile_underflow_mmap (_IO_FILE *fp)
 }
 
 static wint_t
-_IO_wfile_underflow_maybe_mmap (_IO_FILE *fp)
+_IO_wfile_underflow_maybe_mmap (FILE *fp)
 {
   /* This is the first read attempt.  Doing the underflow will choose mmap
      or vanilla operations and then punt to the chosen underflow routine.
@@ -406,7 +406,7 @@ _IO_wfile_underflow_maybe_mmap (_IO_FILE *fp)
 
 
 wint_t
-_IO_wfile_overflow (_IO_FILE *f, wint_t wch)
+_IO_wfile_overflow (FILE *f, wint_t wch)
 {
   if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
     {
@@ -479,9 +479,9 @@ _IO_wfile_overflow (_IO_FILE *f, wint_t wch)
 libc_hidden_def (_IO_wfile_overflow)
 
 wint_t
-_IO_wfile_sync (_IO_FILE *fp)
+_IO_wfile_sync (FILE *fp)
 {
-  _IO_ssize_t delta;
+  ssize_t delta;
   wint_t retval = 0;
 
   /*    char* ptr = cur_ptr(); */
@@ -494,7 +494,7 @@ _IO_wfile_sync (_IO_FILE *fp)
       /* We have to find out how many bytes we have to go back in the
 	 external buffer.  */
       struct _IO_codecvt *cv = fp->_codecvt;
-      _IO_off64_t new_pos;
+      off64_t new_pos;
 
       int clen = (*cv->__codecvt_do_encoding) (cv);
 
@@ -519,7 +519,7 @@ _IO_wfile_sync (_IO_FILE *fp)
 	}
 
       new_pos = _IO_SYSSEEK (fp, delta, 1);
-      if (new_pos != (_IO_off64_t) EOF)
+      if (new_pos != (off64_t) EOF)
 	{
 	  fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_read_ptr;
 	  fp->_IO_read_end = fp->_IO_read_ptr;
@@ -544,7 +544,7 @@ libc_hidden_def (_IO_wfile_sync)
 
    Returns 0 on success and -1 on error with the _IO_ERR_SEEN flag set.  */
 static int
-adjust_wide_data (_IO_FILE *fp, bool do_convert)
+adjust_wide_data (FILE *fp, bool do_convert)
 {
   struct _IO_codecvt *cv = fp->_codecvt;
 
@@ -591,10 +591,10 @@ done:
 /* ftell{,o} implementation for wide mode.  Don't modify any state of the file
    pointer while we try to get the current state of the stream except in one
    case, which is when we have unflushed writes in append mode.  */
-static _IO_off64_t
-do_ftell_wide (_IO_FILE *fp)
+static off64_t
+do_ftell_wide (FILE *fp)
 {
-  _IO_off64_t result, offset = 0;
+  off64_t result, offset = 0;
 
   /* No point looking for offsets in the buffer if it hasn't even been
      allocated.  */
@@ -740,11 +740,11 @@ do_ftell_wide (_IO_FILE *fp)
   return result;
 }
 
-_IO_off64_t
-_IO_wfile_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
+off64_t
+_IO_wfile_seekoff (FILE *fp, off64_t offset, int dir, int mode)
 {
-  _IO_off64_t result;
-  _IO_off64_t delta, new_offset;
+  off64_t result;
+  off64_t delta, new_offset;
   long int count;
 
   /* Short-circuit into a separate function.  We don't want to mix any
@@ -860,7 +860,7 @@ _IO_wfile_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
   if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
       && !_IO_in_backup (fp))
     {
-      _IO_off64_t start_offset = (fp->_offset
+      off64_t start_offset = (fp->_offset
 				  - (fp->_IO_read_end - fp->_IO_buf_base));
       if (offset >= start_offset && offset < fp->_offset)
 	{
@@ -954,13 +954,13 @@ resync:
 libc_hidden_def (_IO_wfile_seekoff)
 
 
-_IO_size_t
-_IO_wfile_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
+size_t
+_IO_wfile_xsputn (FILE *f, const void *data, size_t n)
 {
   const wchar_t *s = (const wchar_t *) data;
-  _IO_size_t to_do = n;
+  size_t to_do = n;
   int must_flush = 0;
-  _IO_size_t count;
+  size_t count;
 
   if (n <= 0)
     return 0;
diff --git a/libio/wgenops.c b/libio/wgenops.c
index 5ae699c9412..2d61bc96524 100644
--- a/libio/wgenops.c
+++ b/libio/wgenops.c
@@ -34,14 +34,14 @@
 #include <wchar.h>
 
 
-static int save_for_wbackup (_IO_FILE *fp, wchar_t *end_p) __THROW;
+static int save_for_wbackup (FILE *fp, wchar_t *end_p) __THROW;
 
 /* Return minimum _pos markers
    Assumes the current get area is the main get area. */
-_IO_ssize_t
-_IO_least_wmarker (_IO_FILE *fp, wchar_t *end_p)
+ssize_t
+_IO_least_wmarker (FILE *fp, wchar_t *end_p)
 {
-  _IO_ssize_t least_so_far = end_p - fp->_wide_data->_IO_read_base;
+  ssize_t least_so_far = end_p - fp->_wide_data->_IO_read_base;
   struct _IO_marker *mark;
   for (mark = fp->_markers; mark != NULL; mark = mark->_next)
     if (mark->_pos < least_so_far)
@@ -52,7 +52,7 @@ libc_hidden_def (_IO_least_wmarker)
 
 /* Switch current get area from backup buffer to (start of) main get area. */
 void
-_IO_switch_to_main_wget_area (_IO_FILE *fp)
+_IO_switch_to_main_wget_area (FILE *fp)
 {
   wchar_t *tmp;
   fp->_flags &= ~_IO_IN_BACKUP;
@@ -72,7 +72,7 @@ libc_hidden_def (_IO_switch_to_main_wget_area)
 
 /* Switch current get area from main get area to (end of) backup area. */
 void
-_IO_switch_to_wbackup_area (_IO_FILE *fp)
+_IO_switch_to_wbackup_area (FILE *fp)
 {
   wchar_t *tmp;
   fp->_flags |= _IO_IN_BACKUP;
@@ -91,7 +91,7 @@ libc_hidden_def (_IO_switch_to_wbackup_area)
 
 
 void
-_IO_wsetb (_IO_FILE *f, wchar_t *b, wchar_t *eb, int a)
+_IO_wsetb (FILE *f, wchar_t *b, wchar_t *eb, int a)
 {
   if (f->_wide_data->_IO_buf_base && !(f->_flags2 & _IO_FLAGS2_USER_WBUF))
     free (f->_wide_data->_IO_buf_base);
@@ -106,7 +106,7 @@ libc_hidden_def (_IO_wsetb)
 
 
 wint_t
-_IO_wdefault_pbackfail (_IO_FILE *fp, wint_t c)
+_IO_wdefault_pbackfail (FILE *fp, wint_t c)
 {
   if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
       && !_IO_in_backup (fp)
@@ -145,9 +145,9 @@ _IO_wdefault_pbackfail (_IO_FILE *fp, wint_t c)
       else if (fp->_wide_data->_IO_read_ptr <= fp->_wide_data->_IO_read_base)
 	{
 	  /* Increase size of existing backup buffer. */
-	  _IO_size_t new_size;
-	  _IO_size_t old_size = (fp->_wide_data->_IO_read_end
-				 - fp->_wide_data->_IO_read_base);
+	  size_t new_size;
+	  size_t old_size = (fp->_wide_data->_IO_read_end
+                             - fp->_wide_data->_IO_read_base);
 	  wchar_t *new_buf;
 	  new_size = 2 * old_size;
 	  new_buf = (wchar_t *) malloc (new_size * sizeof (wchar_t));
@@ -169,7 +169,7 @@ libc_hidden_def (_IO_wdefault_pbackfail)
 
 
 void
-_IO_wdefault_finish (_IO_FILE *fp, int dummy)
+_IO_wdefault_finish (FILE *fp, int dummy)
 {
   struct _IO_marker *mark;
   if (fp->_wide_data->_IO_buf_base && !(fp->_flags2 & _IO_FLAGS2_USER_WBUF))
@@ -198,7 +198,7 @@ libc_hidden_def (_IO_wdefault_finish)
 
 
 wint_t
-_IO_wdefault_uflow (_IO_FILE *fp)
+_IO_wdefault_uflow (FILE *fp)
 {
   wint_t wch;
   wch = _IO_UNDERFLOW (fp);
@@ -210,7 +210,7 @@ libc_hidden_def (_IO_wdefault_uflow)
 
 
 wint_t
-__woverflow (_IO_FILE *f, wint_t wch)
+__woverflow (FILE *f, wint_t wch)
 {
   if (f->_mode == 0)
     _IO_fwide (f, 1);
@@ -220,7 +220,7 @@ libc_hidden_def (__woverflow)
 
 
 wint_t
-__wuflow (_IO_FILE *fp)
+__wuflow (FILE *fp)
 {
   if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
     return WEOF;
@@ -250,7 +250,7 @@ __wuflow (_IO_FILE *fp)
 libc_hidden_def (__wuflow)
 
 wint_t
-__wunderflow (_IO_FILE *fp)
+__wunderflow (FILE *fp)
 {
   if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
     return WEOF;
@@ -280,21 +280,21 @@ __wunderflow (_IO_FILE *fp)
 libc_hidden_def (__wunderflow)
 
 
-_IO_size_t
-_IO_wdefault_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
+size_t
+_IO_wdefault_xsputn (FILE *f, const void *data, size_t n)
 {
   const wchar_t *s = (const wchar_t *) data;
-  _IO_size_t more = n;
+  size_t more = n;
   if (more <= 0)
     return 0;
   for (;;)
     {
       /* Space available. */
-      _IO_ssize_t count = (f->_wide_data->_IO_write_end
+      ssize_t count = (f->_wide_data->_IO_write_end
 			   - f->_wide_data->_IO_write_ptr);
       if (count > 0)
 	{
-	  if ((_IO_size_t) count > more)
+	  if ((size_t) count > more)
 	    count = more;
 	  if (count > 20)
 	    {
@@ -307,7 +307,7 @@ _IO_wdefault_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
 	  else
 	    {
 	      wchar_t *p = f->_wide_data->_IO_write_ptr;
-	      _IO_ssize_t i;
+	      ssize_t i;
 	      for (i = count; --i >= 0; )
 		*p++ = *s++;
 	      f->_wide_data->_IO_write_ptr = p;
@@ -323,19 +323,19 @@ _IO_wdefault_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
 libc_hidden_def (_IO_wdefault_xsputn)
 
 
-_IO_size_t
-_IO_wdefault_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
+size_t
+_IO_wdefault_xsgetn (FILE *fp, void *data, size_t n)
 {
-  _IO_size_t more = n;
+  size_t more = n;
   wchar_t *s = (wchar_t*) data;
   for (;;)
     {
       /* Data available. */
-      _IO_ssize_t count = (fp->_wide_data->_IO_read_end
-			   - fp->_wide_data->_IO_read_ptr);
+      ssize_t count = (fp->_wide_data->_IO_read_end
+                       - fp->_wide_data->_IO_read_ptr);
       if (count > 0)
 	{
-	  if ((_IO_size_t) count > more)
+	  if ((size_t) count > more)
 	    count = more;
 	  if (count > 20)
 	    {
@@ -363,7 +363,7 @@ libc_hidden_def (_IO_wdefault_xsgetn)
 
 
 void
-_IO_wdoallocbuf (_IO_FILE *fp)
+_IO_wdoallocbuf (FILE *fp)
 {
   if (fp->_wide_data->_IO_buf_base)
     return;
@@ -377,21 +377,21 @@ libc_hidden_def (_IO_wdoallocbuf)
 
 
 int
-_IO_wdefault_doallocate (_IO_FILE *fp)
+_IO_wdefault_doallocate (FILE *fp)
 {
   wchar_t *buf;
 
-  buf = malloc (_IO_BUFSIZ);
+  buf = malloc (BUFSIZ);
   if (__glibc_unlikely (buf == NULL))
     return EOF;
-  _IO_wsetb (fp, buf, buf + _IO_BUFSIZ, 1);
+  _IO_wsetb (fp, buf, buf + BUFSIZ, 1);
   return 1;
 }
 libc_hidden_def (_IO_wdefault_doallocate)
 
 
 int
-_IO_switch_to_wget_mode (_IO_FILE *fp)
+_IO_switch_to_wget_mode (FILE *fp)
 {
   if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base)
     if ((wint_t)_IO_WOVERFLOW (fp, WEOF) == WEOF)
@@ -415,7 +415,7 @@ _IO_switch_to_wget_mode (_IO_FILE *fp)
 libc_hidden_def (_IO_switch_to_wget_mode)
 
 void
-_IO_free_wbackup_area (_IO_FILE *fp)
+_IO_free_wbackup_area (FILE *fp)
 {
   if (_IO_in_backup (fp))
     _IO_switch_to_main_wget_area (fp);  /* Just in case. */
@@ -428,7 +428,7 @@ libc_hidden_def (_IO_free_wbackup_area)
 
 #if 0
 int
-_IO_switch_to_wput_mode (_IO_FILE *fp)
+_IO_switch_to_wput_mode (FILE *fp)
 {
   fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_read_ptr;
   fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_read_ptr;
@@ -447,18 +447,18 @@ _IO_switch_to_wput_mode (_IO_FILE *fp)
 
 
 static int
-save_for_wbackup (_IO_FILE *fp, wchar_t *end_p)
+save_for_wbackup (FILE *fp, wchar_t *end_p)
 {
   /* Append [_IO_read_base..end_p] to backup area. */
-  _IO_ssize_t least_mark = _IO_least_wmarker (fp, end_p);
+  ssize_t least_mark = _IO_least_wmarker (fp, end_p);
   /* needed_size is how much space we need in the backup area. */
-  _IO_size_t needed_size = ((end_p - fp->_wide_data->_IO_read_base)
-			    - least_mark);
+  size_t needed_size = ((end_p - fp->_wide_data->_IO_read_base)
+                        - least_mark);
   /* FIXME: Dubious arithmetic if pointers are NULL */
-  _IO_size_t current_Bsize = (fp->_wide_data->_IO_save_end
-			      - fp->_wide_data->_IO_save_base);
-  _IO_size_t avail; /* Extra space available for future expansion. */
-  _IO_ssize_t delta;
+  size_t current_Bsize = (fp->_wide_data->_IO_save_end
+                          - fp->_wide_data->_IO_save_base);
+  size_t avail; /* Extra space available for future expansion. */
+  ssize_t delta;
   struct _IO_marker *mark;
   if (needed_size > current_Bsize)
     {
@@ -512,7 +512,7 @@ save_for_wbackup (_IO_FILE *fp, wchar_t *end_p)
 }
 
 wint_t
-_IO_sputbackwc (_IO_FILE *fp, wint_t c)
+_IO_sputbackwc (FILE *fp, wint_t c)
 {
   wint_t result;
 
@@ -533,7 +533,7 @@ _IO_sputbackwc (_IO_FILE *fp, wint_t c)
 libc_hidden_def (_IO_sputbackwc)
 
 wint_t
-_IO_sungetwc (_IO_FILE *fp)
+_IO_sungetwc (FILE *fp)
 {
   wint_t result;
 
@@ -563,7 +563,7 @@ _IO_adjust_wcolumn (unsigned start, const wchar_t *line, int count)
 }
 
 void
-_IO_init_wmarker (struct _IO_marker *marker, _IO_FILE *fp)
+_IO_init_wmarker (struct _IO_marker *marker, FILE *fp)
 {
   marker->_sbuf = fp;
   if (_IO_in_put_mode (fp))
@@ -598,7 +598,7 @@ _IO_wmarker_delta (struct _IO_marker *mark)
 }
 
 int
-_IO_seekwmark (_IO_FILE *fp, struct _IO_marker *mark, int delta)
+_IO_seekwmark (FILE *fp, struct _IO_marker *mark, int delta)
 {
   if (mark->_sbuf != fp)
     return EOF;
@@ -619,7 +619,7 @@ _IO_seekwmark (_IO_FILE *fp, struct _IO_marker *mark, int delta)
 }
 
 void
-_IO_unsave_wmarkers (_IO_FILE *fp)
+_IO_unsave_wmarkers (FILE *fp)
 {
   struct _IO_marker *mark = fp->_markers;
   if (mark)
diff --git a/libio/wmemstream.c b/libio/wmemstream.c
index c962071d26e..88044f31500 100644
--- a/libio/wmemstream.c
+++ b/libio/wmemstream.c
@@ -26,12 +26,12 @@ struct _IO_FILE_wmemstream
 {
   _IO_strfile _sf;
   wchar_t **bufloc;
-  _IO_size_t *sizeloc;
+  size_t *sizeloc;
 };
 
 
-static int _IO_wmem_sync (_IO_FILE* fp) __THROW;
-static void _IO_wmem_finish (_IO_FILE* fp, int) __THROW;
+static int _IO_wmem_sync (FILE* fp) __THROW;
+static void _IO_wmem_finish (FILE* fp, int) __THROW;
 
 
 static const struct _IO_jump_t _IO_wmem_jumps libio_vtable =
@@ -61,8 +61,8 @@ static const struct _IO_jump_t _IO_wmem_jumps libio_vtable =
 /* Open a stream that writes into a malloc'd buffer that is expanded as
    necessary.  *BUFLOC and *SIZELOC are updated with the buffer's location
    and the number of characters written on fflush or fclose.  */
-_IO_FILE *
-open_wmemstream (wchar_t **bufloc, _IO_size_t *sizeloc)
+FILE *
+open_wmemstream (wchar_t **bufloc, size_t *sizeloc)
 {
   struct locked_FILE
   {
@@ -81,7 +81,7 @@ open_wmemstream (wchar_t **bufloc, _IO_size_t *sizeloc)
   new_f->fp._sf._sbf._f._lock = &new_f->lock;
 #endif
 
-  buf = calloc (1, _IO_BUFSIZ);
+  buf = calloc (1, BUFSIZ);
   if (buf == NULL)
     {
       free (new_f);
@@ -90,7 +90,7 @@ open_wmemstream (wchar_t **bufloc, _IO_size_t *sizeloc)
   _IO_no_init (&new_f->fp._sf._sbf._f, 0, 0, &new_f->wd, &_IO_wmem_jumps);
   _IO_fwide (&new_f->fp._sf._sbf._f, 1);
   _IO_wstr_init_static (&new_f->fp._sf._sbf._f, buf,
-			_IO_BUFSIZ / sizeof (wchar_t), buf);
+			BUFSIZ / sizeof (wchar_t), buf);
   new_f->fp._sf._sbf._f._flags2 &= ~_IO_FLAGS2_USER_WBUF;
   new_f->fp._sf._s._allocate_buffer = (_IO_alloc_type) malloc;
   new_f->fp._sf._s._free_buffer = (_IO_free_type) free;
@@ -101,12 +101,12 @@ open_wmemstream (wchar_t **bufloc, _IO_size_t *sizeloc)
   /* Disable single thread optimization.  BZ 21735.  */
   new_f->fp._sf._sbf._f._flags2 |= _IO_FLAGS2_NEED_LOCK;
 
-  return (_IO_FILE *) &new_f->fp._sf._sbf;
+  return (FILE *) &new_f->fp._sf._sbf;
 }
 
 
 static int
-_IO_wmem_sync (_IO_FILE *fp)
+_IO_wmem_sync (FILE *fp)
 {
   struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp;
 
@@ -125,7 +125,7 @@ _IO_wmem_sync (_IO_FILE *fp)
 
 
 static void
-_IO_wmem_finish (_IO_FILE *fp, int dummy)
+_IO_wmem_finish (FILE *fp, int dummy)
 {
   struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp;
 
diff --git a/libio/wstrops.c b/libio/wstrops.c
index a3374a7b159..36e8b20fefc 100644
--- a/libio/wstrops.c
+++ b/libio/wstrops.c
@@ -32,19 +32,19 @@
 #include <stdio_ext.h>
 
 void
-_IO_wstr_init_static (_IO_FILE *fp, wchar_t *ptr, _IO_size_t size,
+_IO_wstr_init_static (FILE *fp, wchar_t *ptr, size_t size,
 		      wchar_t *pstart)
 {
   wchar_t *end;
 
   if (size == 0)
     end = ptr + __wcslen (ptr);
-  else if ((_IO_size_t) ptr + size * sizeof (wchar_t) > (_IO_size_t) ptr)
+  else if ((size_t) ptr + size * sizeof (wchar_t) > (size_t) ptr)
     end = ptr + size;
   else
     /* Even for misaligned ptr make sure there is integral number of wide
        characters.  */
-    end = ptr + (-1 - (_IO_size_t) ptr) / sizeof (wchar_t);
+    end = ptr + (-1 - (size_t) ptr) / sizeof (wchar_t);
   _IO_wsetb (fp, ptr, end, 0);
 
   fp->_wide_data->_IO_write_base = ptr;
@@ -66,11 +66,11 @@ _IO_wstr_init_static (_IO_FILE *fp, wchar_t *ptr, _IO_size_t size,
   (((_IO_strfile *) fp)->_s._allocate_buffer) = (_IO_alloc_type)0;
 }
 
-_IO_wint_t
-_IO_wstr_overflow (_IO_FILE *fp, _IO_wint_t c)
+wint_t
+_IO_wstr_overflow (FILE *fp, wint_t c)
 {
   int flush_only = c == WEOF;
-  _IO_size_t pos;
+  size_t pos;
   if (fp->_flags & _IO_NO_WRITES)
       return flush_only ? 0 : WEOF;
   if ((fp->_flags & _IO_TIED_PUT_GET) && !(fp->_flags & _IO_CURRENTLY_PUTTING))
@@ -80,7 +80,7 @@ _IO_wstr_overflow (_IO_FILE *fp, _IO_wint_t c)
       fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
     }
   pos = fp->_wide_data->_IO_write_ptr - fp->_wide_data->_IO_write_base;
-  if (pos >= (_IO_size_t) (_IO_wblen (fp) + flush_only))
+  if (pos >= (size_t) (_IO_wblen (fp) + flush_only))
     {
       if (fp->_flags2 & _IO_FLAGS2_USER_WBUF) /* not allowed to enlarge */
 	return WEOF;
@@ -89,7 +89,7 @@ _IO_wstr_overflow (_IO_FILE *fp, _IO_wint_t c)
 	  wchar_t *new_buf;
 	  wchar_t *old_buf = fp->_wide_data->_IO_buf_base;
 	  size_t old_wblen = _IO_wblen (fp);
-	  _IO_size_t new_size = 2 * old_wblen + 100;
+	  size_t new_size = 2 * old_wblen + 100;
 
 	  if (__glibc_unlikely (new_size < old_wblen)
 	      || __glibc_unlikely (new_size > SIZE_MAX / sizeof (wchar_t)))
@@ -136,8 +136,8 @@ _IO_wstr_overflow (_IO_FILE *fp, _IO_wint_t c)
 }
 
 
-_IO_wint_t
-_IO_wstr_underflow (_IO_FILE *fp)
+wint_t
+_IO_wstr_underflow (FILE *fp)
 {
   if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_read_end)
     fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_write_ptr;
@@ -155,8 +155,8 @@ _IO_wstr_underflow (_IO_FILE *fp)
 
 
 /* The size of the valid part of the buffer.  */
-_IO_ssize_t
-_IO_wstr_count (_IO_FILE *fp)
+ssize_t
+_IO_wstr_count (FILE *fp)
 {
   struct _IO_wide_data *wd = fp->_wide_data;
 
@@ -167,21 +167,21 @@ _IO_wstr_count (_IO_FILE *fp)
 
 
 static int
-enlarge_userbuf (_IO_FILE *fp, _IO_off64_t offset, int reading)
+enlarge_userbuf (FILE *fp, off64_t offset, int reading)
 {
-  if ((_IO_ssize_t) offset <= _IO_wblen (fp))
+  if ((ssize_t) offset <= _IO_wblen (fp))
     return 0;
 
   struct _IO_wide_data *wd = fp->_wide_data;
 
-  _IO_ssize_t oldend = wd->_IO_write_end - wd->_IO_write_base;
+  ssize_t oldend = wd->_IO_write_end - wd->_IO_write_base;
 
   /* Try to enlarge the buffer.  */
   if (fp->_flags2 & _IO_FLAGS2_USER_WBUF)
     /* User-provided buffer.  */
     return 1;
 
-  _IO_size_t newsize = offset + 100;
+  size_t newsize = offset + 100;
   if (__glibc_unlikely (newsize > SIZE_MAX / sizeof (wchar_t)))
     return 1;
 
@@ -236,7 +236,7 @@ enlarge_userbuf (_IO_FILE *fp, _IO_off64_t offset, int reading)
 }
 
 static void
-_IO_wstr_switch_to_get_mode (_IO_FILE *fp)
+_IO_wstr_switch_to_get_mode (FILE *fp)
 {
   if (_IO_in_backup (fp))
     fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_backup_base;
@@ -252,10 +252,10 @@ _IO_wstr_switch_to_get_mode (_IO_FILE *fp)
   fp->_flags &= ~_IO_CURRENTLY_PUTTING;
 }
 
-_IO_off64_t
-_IO_wstr_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
+off64_t
+_IO_wstr_seekoff (FILE *fp, off64_t offset, int dir, int mode)
 {
-  _IO_off64_t new_pos;
+  off64_t new_pos;
 
   if (mode == 0 && (fp->_flags & _IO_TIED_PUT_GET))
     mode = (fp->_flags & _IO_CURRENTLY_PUTTING ? _IOS_OUTPUT : _IOS_INPUT);
@@ -273,13 +273,13 @@ _IO_wstr_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
     }
   else
     {
-      _IO_ssize_t cur_size = _IO_wstr_count (fp);
+      ssize_t cur_size = _IO_wstr_count (fp);
       new_pos = EOF;
 
       /* Move the get pointer, if requested. */
       if (mode & _IOS_INPUT)
 	{
-	  _IO_ssize_t base;
+	  ssize_t base;
 	  switch (dir)
 	    {
 	    case _IO_seek_set:
@@ -293,7 +293,7 @@ _IO_wstr_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
 	      base = cur_size;
 	      break;
 	    }
-	  _IO_ssize_t maxval = SSIZE_MAX/sizeof (wchar_t) - base;
+	  ssize_t maxval = SSIZE_MAX/sizeof (wchar_t) - base;
 	  if (offset < -base || offset > maxval)
 	    {
 	      __set_errno (EINVAL);
@@ -313,7 +313,7 @@ _IO_wstr_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
       /* Move the put pointer, if requested. */
       if (mode & _IOS_OUTPUT)
 	{
-	  _IO_ssize_t base;
+	  ssize_t base;
 	  switch (dir)
 	    {
 	    case _IO_seek_set:
@@ -327,7 +327,7 @@ _IO_wstr_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
 	      base = cur_size;
 	      break;
 	    }
-	  _IO_ssize_t maxval = SSIZE_MAX/sizeof (wchar_t) - base;
+	  ssize_t maxval = SSIZE_MAX/sizeof (wchar_t) - base;
 	  if (offset < -base || offset > maxval)
 	    {
 	      __set_errno (EINVAL);
@@ -345,8 +345,8 @@ _IO_wstr_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
   return new_pos;
 }
 
-_IO_wint_t
-_IO_wstr_pbackfail (_IO_FILE *fp, _IO_wint_t c)
+wint_t
+_IO_wstr_pbackfail (FILE *fp, wint_t c)
 {
   if ((fp->_flags & _IO_NO_WRITES) && c != WEOF)
     return WEOF;
@@ -354,7 +354,7 @@ _IO_wstr_pbackfail (_IO_FILE *fp, _IO_wint_t c)
 }
 
 void
-_IO_wstr_finish (_IO_FILE *fp, int dummy)
+_IO_wstr_finish (FILE *fp, int dummy)
 {
   if (fp->_wide_data->_IO_buf_base && !(fp->_flags2 & _IO_FLAGS2_USER_WBUF))
     (((_IO_strfile *) fp)->_s._free_buffer) (fp->_wide_data->_IO_buf_base);
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 3224b3a899f..58f9acd4d13 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4980,8 +4980,8 @@ __malloc_stats (void)
   if (__malloc_initialized < 0)
     ptmalloc_init ();
   _IO_flockfile (stderr);
-  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-  ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+  int old_flags2 = stderr->_flags2;
+  stderr->_flags2 |= _IO_FLAGS2_NOTCANCEL;
   for (i = 0, ar_ptr = &main_arena;; i++)
     {
       struct mallinfo mi;
@@ -5009,7 +5009,7 @@ __malloc_stats (void)
   fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
   fprintf (stderr, "max mmap bytes   = %10lu\n",
            (unsigned long) mp_.max_mmapped_mem);
-  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+  stderr->_flags2 = old_flags2;
   _IO_funlockfile (stderr);
 }
 
diff --git a/stdio-common/fxprintf.c b/stdio-common/fxprintf.c
index c1f02925fb3..c4a1146b205 100644
--- a/stdio-common/fxprintf.c
+++ b/stdio-common/fxprintf.c
@@ -87,12 +87,12 @@ __fxprintf_nocancel (FILE *fp, const char *fmt, ...)
   va_list ap;
   va_start (ap, fmt);
   _IO_flockfile (fp);
-  int save_flags2 = ((_IO_FILE *)fp)->_flags2;
-  ((_IO_FILE *)fp)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+  int save_flags2 = fp->_flags2;
+  fp->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
   int res = locked_vfxprintf (fp, fmt, ap);
 
-  ((_IO_FILE *)fp)->_flags2 = save_flags2;
+  fp->_flags2 = save_flags2;
   _IO_funlockfile (fp);
   va_end (ap);
   return res;
diff --git a/stdio-common/getline.c b/stdio-common/getline.c
index a8b91ec62a6..77f77c24007 100644
--- a/stdio-common/getline.c
+++ b/stdio-common/getline.c
@@ -17,19 +17,15 @@
 
 #include <stddef.h>
 #include <stdio.h>
+#include "../libio/libioP.h"
 
 #undef __getline
 
-#include "../libio/libioP.h"
-#undef ssize_t
-#define ssize_t _IO_ssize_t
-#define __getdelim _IO_getdelim
-
 /* Like getdelim, but always looks for a newline.  */
 ssize_t
 __getline (char **lineptr, size_t *n, FILE *stream)
 {
-  return __getdelim (lineptr, n, '\n', stream);
+  return _IO_getdelim (lineptr, n, '\n', stream);
 }
 
 weak_alias (__getline, getline)
diff --git a/stdio-common/isoc99_vfscanf.c b/stdio-common/isoc99_vfscanf.c
index 5d4389abdbb..b80e05f8db1 100644
--- a/stdio-common/isoc99_vfscanf.c
+++ b/stdio-common/isoc99_vfscanf.c
@@ -21,7 +21,7 @@
 /* Read formatted input from STREAM according to the format string FORMAT.  */
 /* VARARGS2 */
 int
-__isoc99_vfscanf (FILE *stream, const char *format, _IO_va_list args)
+__isoc99_vfscanf (FILE *stream, const char *format, va_list args)
 {
   int done;
 
diff --git a/stdio-common/isoc99_vscanf.c b/stdio-common/isoc99_vscanf.c
index 8b2b8af0b5a..0b747f85bad 100644
--- a/stdio-common/isoc99_vscanf.c
+++ b/stdio-common/isoc99_vscanf.c
@@ -21,7 +21,7 @@
 /* Read formatted input from STDIN according to the format string FORMAT.  */
 /* VARARGS2 */
 int
-__isoc99_vscanf (const char *format, _IO_va_list args)
+__isoc99_vscanf (const char *format, va_list args)
 {
   int done;
 
diff --git a/stdio-common/isoc99_vsscanf.c b/stdio-common/isoc99_vsscanf.c
index ead4e551be7..ac85ef2d0dc 100644
--- a/stdio-common/isoc99_vsscanf.c
+++ b/stdio-common/isoc99_vsscanf.c
@@ -29,7 +29,7 @@
 #include "../libio/strfile.h"
 
 int
-__isoc99_vsscanf (const char *string, const char *format, _IO_va_list args)
+__isoc99_vsscanf (const char *string, const char *format, va_list args)
 {
   int ret;
   _IO_strfile sf;
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 97f643af249..66ab59bad29 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -56,17 +56,12 @@
 #endif
 #include <assert.h>
 
-/* This defines make it possible to use the same code for GNU C library and
-   the GNU I/O library.	 */
 #define PUT(f, s, n) _IO_sputn (f, s, n)
 #define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : _IO_padn (f, c, n))
-/* We use this file GNU C library and GNU I/O library.	So make
-   names equal.	 */
 #undef putc
 #define putc(c, f) (wide \
 		    ? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f))
-#define size_t     _IO_size_t
-#define FILE	     _IO_FILE
+
 \f
 /* Macros for doing the actual output.  */
 
diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c
index 002a7e1fecf..df3956316de 100644
--- a/stdio-common/printf_fphex.c
+++ b/stdio-common/printf_fphex.c
@@ -43,18 +43,13 @@
 /* #define NDEBUG 1*/		/* Undefine this for debugging assertions.  */
 #include <assert.h>
 
-/* This defines make it possible to use the same code for GNU C library and
-   the GNU I/O library.	 */
 #include <libioP.h>
 #define PUT(f, s, n) _IO_sputn (f, s, n)
 #define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : _IO_padn (f, c, n))
-/* We use this file GNU C library and GNU I/O library.	So make
-   names equal.	 */
 #undef putc
 #define putc(c, f) (wide \
 		     ? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f))
-#define size_t     _IO_size_t
-#define FILE	     _IO_FILE
+
 \f
 /* Macros for doing the actual output.  */
 
diff --git a/stdio-common/printf_size.c b/stdio-common/printf_size.c
index 520b6b1e9a0..7e073c50d4b 100644
--- a/stdio-common/printf_size.c
+++ b/stdio-common/printf_size.c
@@ -24,18 +24,12 @@
 #include <printf.h>
 #include <libioP.h>
 
-
-/* This defines make it possible to use the same code for GNU C library and
-   the GNU I/O library.	 */
 #define PUT(f, s, n) _IO_sputn (f, s, n)
 #define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : _IO_padn (f, c, n))
-/* We use this file GNU C library and GNU I/O library.	So make
-   names equal.	 */
 #undef putc
 #define putc(c, f) (wide \
 		    ? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f))
-#define size_t	_IO_size_t
-#define FILE	_IO_FILE
+
 \f
 /* Macros for doing the actual output.  */
 
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index a2cab306855..27d3a2c1bf7 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -92,7 +92,7 @@ typedef const char *THOUSANDS_SEP_T;
   do {									      \
     if (width > 0)							      \
       {									      \
-	_IO_ssize_t written = _IO_padn (s, (Padchar), width);		      \
+	ssize_t written = _IO_padn (s, (Padchar), width);		      \
 	if (__glibc_unlikely (written != width))			      \
 	  {								      \
 	    done = -1;							      \
@@ -122,7 +122,7 @@ typedef wchar_t THOUSANDS_SEP_T;
   do {									      \
     if (width > 0)							      \
       {									      \
-	_IO_ssize_t written = _IO_wpadn (s, (Padchar), width);		      \
+	ssize_t written = _IO_wpadn (s, (Padchar), width);		      \
 	if (__glibc_unlikely (written != width))			      \
 	  {								      \
 	    done = -1;							      \
@@ -1218,7 +1218,7 @@ static int buffered_vfprintf (FILE *stream, const CHAR_T *fmt, va_list)
      __THROW __attribute__ ((noinline));
 
 /* Handle positional format specifiers.  */
-static int printf_positional (_IO_FILE *s,
+static int printf_positional (FILE *s,
 			      const CHAR_T *format, int readonly_format,
 			      va_list ap, va_list *ap_savep, int done,
 			      int nspecs_done, const UCHAR_T *lead_str_end,
@@ -1695,7 +1695,7 @@ do_positional:
 }
 \f
 static int
-printf_positional (_IO_FILE *s, const CHAR_T *format, int readonly_format,
+printf_positional (FILE *s, const CHAR_T *format, int readonly_format,
 		   va_list ap, va_list *ap_savep, int done, int nspecs_done,
 		   const UCHAR_T *lead_str_end,
 		   CHAR_T *work_buffer, int save_errno,
@@ -2201,22 +2201,21 @@ struct helper_file
 #ifdef COMPILE_WPRINTF
     struct _IO_wide_data _wide_data;
 #endif
-    _IO_FILE *_put_stream;
+    FILE *_put_stream;
 #ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
 #endif
   };
 
 static int
-_IO_helper_overflow (_IO_FILE *s, int c)
+_IO_helper_overflow (FILE *s, int c)
 {
-  _IO_FILE *target = ((struct helper_file*) s)->_put_stream;
+  FILE *target = ((struct helper_file*) s)->_put_stream;
 #ifdef COMPILE_WPRINTF
   int used = s->_wide_data->_IO_write_ptr - s->_wide_data->_IO_write_base;
   if (used)
     {
-      _IO_size_t written = _IO_sputn (target, s->_wide_data->_IO_write_base,
-				      used);
+      size_t written = _IO_sputn (target, s->_wide_data->_IO_write_base, used);
       if (written == 0 || written == WEOF)
 	return WEOF;
       __wmemmove (s->_wide_data->_IO_write_base,
@@ -2228,7 +2227,7 @@ _IO_helper_overflow (_IO_FILE *s, int c)
   int used = s->_IO_write_ptr - s->_IO_write_base;
   if (used)
     {
-      _IO_size_t written = _IO_sputn (target, s->_IO_write_base, used);
+      size_t written = _IO_sputn (target, s->_IO_write_base, used);
       if (written == 0 || written == EOF)
 	return EOF;
       memmove (s->_IO_write_base, s->_IO_write_base + written,
@@ -2286,12 +2285,11 @@ static const struct _IO_jump_t _IO_helper_jumps libio_vtable =
 #endif
 
 static int
-buffered_vfprintf (_IO_FILE *s, const CHAR_T *format,
-		   _IO_va_list args)
+buffered_vfprintf (FILE *s, const CHAR_T *format, va_list args)
 {
-  CHAR_T buf[_IO_BUFSIZ];
+  CHAR_T buf[BUFSIZ];
   struct helper_file helper;
-  _IO_FILE *hp = (_IO_FILE *) &helper._f;
+  FILE *hp = (FILE *) &helper._f;
   int result, to_flush;
 
   /* Orient the stream.  */
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 099dfeac9e6..a519a57b8fd 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -73,9 +73,6 @@
 #include <locale/localeinfo.h>
 #include <libioP.h>
 
-#undef va_list
-#define va_list	_IO_va_list
-
 #ifdef COMPILE_WSCANF
 # define ungetc(c, s)	((void) (c == WEOF				      \
 				 || (--read_in,				      \
@@ -270,11 +267,11 @@ char_buffer_add (struct char_buffer *buffer, CHAR_T ch)
    Return the number of assignments made, or -1 for an input error.  */
 #ifdef COMPILE_WSCANF
 int
-_IO_vfwscanf (_IO_FILE *s, const wchar_t *format, _IO_va_list argptr,
+_IO_vfwscanf (FILE *s, const wchar_t *format, va_list argptr,
 	      int *errp)
 #else
 int
-_IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
+_IO_vfscanf_internal (FILE *s, const char *format, va_list argptr,
 		      int *errp)
 #endif
 {
diff --git a/sysdeps/generic/stdio-lock.h b/sysdeps/generic/stdio-lock.h
index 2c7a1a48b0f..4a406185456 100644
--- a/sysdeps/generic/stdio-lock.h
+++ b/sysdeps/generic/stdio-lock.h
@@ -50,13 +50,13 @@ __libc_lock_define_recursive (typedef, _IO_lock_t)
 # ifdef __EXCEPTIONS
 # define _IO_acquire_lock(_fp) \
   do {									      \
-    _IO_FILE *_IO_acquire_lock_file					      \
+    FILE *_IO_acquire_lock_file						      \
 	__attribute__((cleanup (_IO_acquire_lock_fct)))			      \
 	= (_fp);							      \
     _IO_flockfile (_IO_acquire_lock_file);
 #  define _IO_acquire_lock_clear_flags2(_fp) \
   do {									      \
-    _IO_FILE *_IO_acquire_lock_file					      \
+    FILE *_IO_acquire_lock_file						      \
 	__attribute__((cleanup (_IO_acquire_lock_clear_flags2_fct)))	      \
 	= (_fp);							      \
     _IO_flockfile (_IO_acquire_lock_file);
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
index 7280d48ac5c..bf54090d4fb 100644
--- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
@@ -333,8 +333,7 @@ __nldbl_wprintf (const wchar_t *fmt, ...)
 
 int
 attribute_compat_text_section
-__nldbl__IO_vfscanf (FILE *s, const char *fmt, _IO_va_list ap,
-		    int *errp)
+__nldbl__IO_vfscanf (FILE *s, const char *fmt, va_list ap, int *errp)
 {
   int res;
   set_no_long_double ();
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c
index 05581c03548..442c11c2037 100644
--- a/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c
@@ -2,7 +2,7 @@
 
 int
 attribute_hidden
-_IO_vfscanf (FILE *s, const char *fmt, _IO_va_list ap, int *errp)
+_IO_vfscanf (FILE *s, const char *fmt, va_list ap, int *errp)
 {
   return __nldbl__IO_vfscanf (s, fmt, ap, errp);
 }
diff --git a/sysdeps/nptl/stdio-lock.h b/sysdeps/nptl/stdio-lock.h
index 518b9063276..5b9782452f3 100644
--- a/sysdeps/nptl/stdio-lock.h
+++ b/sysdeps/nptl/stdio-lock.h
@@ -90,13 +90,13 @@ typedef struct { int lock; int cnt; void *owner; } _IO_lock_t;
 # ifdef __EXCEPTIONS
 #  define _IO_acquire_lock(_fp) \
   do {									      \
-    _IO_FILE *_IO_acquire_lock_file					      \
+    FILE *_IO_acquire_lock_file						      \
 	__attribute__((cleanup (_IO_acquire_lock_fct)))			      \
 	= (_fp);							      \
     _IO_flockfile (_IO_acquire_lock_file);
 #  define _IO_acquire_lock_clear_flags2(_fp) \
   do {									      \
-    _IO_FILE *_IO_acquire_lock_file					      \
+    FILE *_IO_acquire_lock_file						      \
 	__attribute__((cleanup (_IO_acquire_lock_clear_flags2_fct)))	      \
 	= (_fp);							      \
     _IO_flockfile (_IO_acquire_lock_file);
diff --git a/wcsmbs/isoc99_vfwscanf.c b/wcsmbs/isoc99_vfwscanf.c
index 5e6d91fb213..7beb45b4d3b 100644
--- a/wcsmbs/isoc99_vfwscanf.c
+++ b/wcsmbs/isoc99_vfwscanf.c
@@ -22,7 +22,7 @@
 /* Read formatted input from STREAM according to the format string FORMAT.  */
 /* VARARGS2 */
 int
-__isoc99_vfwscanf (FILE *stream, const wchar_t *format, _IO_va_list args)
+__isoc99_vfwscanf (FILE *stream, const wchar_t *format, va_list args)
 {
   int done;
 
diff --git a/wcsmbs/isoc99_vswscanf.c b/wcsmbs/isoc99_vswscanf.c
index 3cea62e741d..130769154d9 100644
--- a/wcsmbs/isoc99_vswscanf.c
+++ b/wcsmbs/isoc99_vswscanf.c
@@ -29,8 +29,7 @@
 #include "../libio/strfile.h"
 
 int
-__isoc99_vswscanf (const wchar_t *string, const wchar_t *format,
-		   _IO_va_list args)
+__isoc99_vswscanf (const wchar_t *string, const wchar_t *format, va_list args)
 {
   int ret;
   _IO_strfile sf;
@@ -42,7 +41,7 @@ __isoc99_vswscanf (const wchar_t *string, const wchar_t *format,
   _IO_fwide (&sf._sbf._f, 1);
   _IO_wstr_init_static (&sf._sbf._f, (wchar_t *)string, 0, NULL);
   sf._sbf._f._flags2 |= _IO_FLAGS2_SCANF_STD;
-  ret = _IO_vfwscanf ((_IO_FILE *) &sf._sbf, format, args, NULL);
+  ret = _IO_vfwscanf ((FILE *) &sf._sbf, format, args, NULL);
   return ret;
 }
 libc_hidden_def (__isoc99_vswscanf)
diff --git a/wcsmbs/isoc99_vwscanf.c b/wcsmbs/isoc99_vwscanf.c
index d8e229247cd..049521b964f 100644
--- a/wcsmbs/isoc99_vwscanf.c
+++ b/wcsmbs/isoc99_vwscanf.c
@@ -22,7 +22,7 @@
 /* Read formatted input from STDIN according to the format string FORMAT.  */
 /* VARARGS2 */
 int
-__isoc99_vwscanf (const wchar_t *format, _IO_va_list args)
+__isoc99_vwscanf (const wchar_t *format, va_list args)
 {
   int done;
 
-- 
2.16.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH 0/6] Mostly mechanical libio decrufting.
@ 2018-02-11 16:36 Zack Weinberg
  2018-02-11 16:36 ` [PATCH 1/6] Remove vestiges of external build support from libio headers Zack Weinberg
                   ` (6 more replies)
  0 siblings, 7 replies; 29+ messages in thread
From: Zack Weinberg @ 2018-02-11 16:36 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, adhemerval.zanella

This patch set performs a number of largely search-and-replace
cleanups to libio enabled by libio.h no longer being a public header.
It includes all of the follow-up changes requested by Adhemerval for
the patchset that stopped installing libio.h.

Every patch in this series meets the "installed stripped binaries are
unchanged" criterion, except for a handful of assertions whose line
numbers change.

Zack Weinberg (6):
  Remove vestiges of external build support from libio headers.
  Mechanically remove _IO_ name aliases for types and constants.
  Remove legacy configuration knobs from libio.
  Remove _IO_file_flags define.
  Remove miscellaneous debris from libio.
  Remove completely unused libio flag bits.

 debug/fgets_chk.c                          |  12 +-
 debug/fgets_u_chk.c                        |  13 +-
 debug/fgetws_chk.c                         |  10 +-
 debug/fgetws_u_chk.c                       |  13 +-
 debug/gets_chk.c                           |  10 +-
 debug/vasprintf_chk.c                      |   6 +-
 debug/vdprintf_chk.c                       |   3 -
 debug/vsprintf_chk.c                       |   4 +-
 debug/vswprintf_chk.c                      |   2 +-
 hurd/fopenport.c                           |   2 +-
 include/stdio.h                            |  16 +-
 libio/bits/types/struct_FILE.h             |   4 +-
 libio/clearerr.c                           |   2 +-
 libio/feof.c                               |   2 +-
 libio/feof_u.c                             |   2 +-
 libio/ferror.c                             |   2 +-
 libio/ferror_u.c                           |   2 +-
 libio/filedoalloc.c                        |   8 +-
 libio/fileno.c                             |   2 +-
 libio/fileops.c                            | 171 +++++-------
 libio/fmemopen.c                           |   8 +-
 libio/fputc.c                              |   4 +-
 libio/fputc_u.c                            |   2 +-
 libio/fputwc.c                             |   2 +-
 libio/fputwc_u.c                           |   2 +-
 libio/fseek.c                              |   2 +-
 libio/fseeko.c                             |   2 +-
 libio/fseeko64.c                           |   2 +-
 libio/ftello.c                             |   6 +-
 libio/ftello64.c                           |   4 +-
 libio/fwide.c                              |   2 +-
 libio/genops.c                             | 280 ++++++-------------
 libio/getchar.c                            |   2 +-
 libio/iofclose.c                           |   8 +-
 libio/iofdopen.c                           |  11 +-
 libio/iofflush.c                           |   2 +-
 libio/iofflush_u.c                         |   2 +-
 libio/iofgetpos.c                          |   6 +-
 libio/iofgetpos64.c                        |   4 +-
 libio/iofgets.c                            |  13 +-
 libio/iofgets_u.c                          |  13 +-
 libio/iofgetws.c                           |  10 +-
 libio/iofgetws_u.c                         |  13 +-
 libio/iofopen.c                            |  13 +-
 libio/iofopen64.c                          |   2 +-
 libio/iofopncook.c                         |  63 ++---
 libio/iofputs.c                            |   4 +-
 libio/iofputs_u.c                          |   4 +-
 libio/iofputws.c                           |   4 +-
 libio/iofputws_u.c                         |   4 +-
 libio/iofread.c                            |   8 +-
 libio/iofread_u.c                          |   8 +-
 libio/iofsetpos.c                          |   2 +-
 libio/iofsetpos64.c                        |   2 +-
 libio/ioftell.c                            |   6 +-
 libio/iofwide.c                            |   6 +-
 libio/iofwrite.c                           |   8 +-
 libio/iofwrite_u.c                         |   9 +-
 libio/iogetdelim.c                         |  14 +-
 libio/iogetline.c                          |  14 +-
 libio/iogets.c                             |  10 +-
 libio/iogetwline.c                         |  14 +-
 libio/iolibio.h                            |  91 +++---
 libio/iopadn.c                             |   8 +-
 libio/iopopen.c                            |  23 +-
 libio/ioputs.c                             |   2 +-
 libio/ioseekoff.c                          |  10 +-
 libio/ioseekpos.c                          |  10 +-
 libio/iosetbuffer.c                        |   2 +-
 libio/iosetvbuf.c                          |  14 +-
 libio/ioungetc.c                           |   2 +-
 libio/ioungetwc.c                          |   2 +-
 libio/iovdprintf.c                         |   5 +-
 libio/iovsprintf.c                         |   2 +-
 libio/iovsscanf.c                          |   2 +-
 libio/iovswscanf.c                         |   4 +-
 libio/iowpadn.c                            |   8 +-
 libio/libio.h                              | 252 ++++++-----------
 libio/libioP.h                             | 427 +++++++++++++----------------
 libio/memstream.c                          |  20 +-
 libio/obprintf.c                           |   6 +-
 libio/oldfileops.c                         |  85 +++---
 libio/oldfmemopen.c                        |   6 +-
 libio/oldiofclose.c                        |   8 +-
 libio/oldiofdopen.c                        |   9 +-
 libio/oldiofgetpos.c                       |   4 +-
 libio/oldiofgetpos64.c                     |   4 +-
 libio/oldiofopen.c                         |   9 +-
 libio/oldiofsetpos.c                       |   2 +-
 libio/oldiofsetpos64.c                     |   2 +-
 libio/oldiopopen.c                         |  21 +-
 libio/oldpclose.c                          |   8 +-
 libio/oldstdfiles.c                        |   6 +-
 libio/pclose.c                             |   8 +-
 libio/peekc.c                              |   2 +-
 libio/putc.c                               |   2 +-
 libio/putc_u.c                             |   2 +-
 libio/putwc.c                              |   2 +-
 libio/putwc_u.c                            |   2 +-
 libio/rewind.c                             |   2 +-
 libio/setbuf.c                             |   4 +-
 libio/setlinebuf.c                         |   2 +-
 libio/stdio.c                              |   6 +-
 libio/strfile.h                            |   7 +-
 libio/strops.c                             |  52 ++--
 libio/tst-mmap-eofsync.c                   |   2 -
 libio/vasprintf.c                          |   8 +-
 libio/vscanf.c                             |   2 +-
 libio/vsnprintf.c                          |   8 +-
 libio/vswprintf.c                          |  10 +-
 libio/vwscanf.c                            |   2 +-
 libio/wfiledoalloc.c                       |   4 +-
 libio/wfileops.c                           |  51 ++--
 libio/wgenops.c                            | 128 ++++-----
 libio/wmemstream.c                         |  20 +-
 libio/wstrops.c                            |  56 ++--
 malloc/malloc.c                            |   6 +-
 stdio-common/fxprintf.c                    |   6 +-
 stdio-common/getline.c                     |   8 +-
 stdio-common/isoc99_vfscanf.c              |   2 +-
 stdio-common/isoc99_vscanf.c               |   2 +-
 stdio-common/isoc99_vsscanf.c              |   2 +-
 stdio-common/printf_fp.c                   |   7 +-
 stdio-common/printf_fphex.c                |   7 +-
 stdio-common/printf_size.c                 |   8 +-
 stdio-common/scanf15.c                     |   7 -
 stdio-common/scanf17.c                     |   7 -
 stdio-common/vfprintf.c                    |  32 +--
 stdio-common/vfscanf.c                     |   9 +-
 sysdeps/generic/stdio-lock.h               |   4 +-
 sysdeps/ieee754/ldbl-opt/nldbl-compat.c    |   3 +-
 sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c |   2 +-
 sysdeps/nptl/stdio-lock.h                  |   4 +-
 wcsmbs/isoc99_vfwscanf.c                   |   2 +-
 wcsmbs/isoc99_vswscanf.c                   |   5 +-
 wcsmbs/isoc99_vwscanf.c                    |   2 +-
 136 files changed, 1020 insertions(+), 1422 deletions(-)

-- 
2.16.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH 1/6] Remove vestiges of external build support from libio headers.
  2018-02-11 16:36 [PATCH 0/6] Mostly mechanical libio decrufting Zack Weinberg
@ 2018-02-11 16:36 ` Zack Weinberg
  2018-02-11 17:54   ` Andreas Schwab
  2018-02-11 16:36 ` [PATCH 5/6] Remove miscellaneous debris from libio Zack Weinberg
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 29+ messages in thread
From: Zack Weinberg @ 2018-02-11 16:36 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, adhemerval.zanella

As requested by Adhemerval, this patch removes some preprocessor
conditionals from the libio headers that were only relevant when
building libio outside glibc.

	* libio/iolibio.h, libio/libioP.h: Remove extern "C".
        * libio/libio.h: Remove __BEGIN_DECLS and __END_DECLS.
	Remove preprocessor conditionals on _LIBC and __USE_GNU,
	which are always true, and __cplusplus, which is always false.

---
 libio/iolibio.h        |  8 --------
 libio/libio.h          | 32 +++++---------------------------
 libio/libioP.h         |  8 --------
 3 files changed, 5 insertions(+), 43 deletions(-)

diff --git a/libio/iolibio.h b/libio/iolibio.h
index 52731b65f91..4d43d0e72db 100644
--- a/libio/iolibio.h
+++ b/libio/iolibio.h
@@ -7,10 +7,6 @@
 /* These emulate stdio functionality, but with a different name
    (_IO_ungetc instead of ungetc), and using _IO_FILE instead of FILE. */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 extern int _IO_fclose (_IO_FILE*);
 extern int _IO_new_fclose (_IO_FILE*);
 extern int _IO_old_fclose (_IO_FILE*);
@@ -95,8 +91,4 @@ extern int __old_pclose (_IO_FILE *) __THROW;
 _IO_FILE *__new_freopen (const char *, const char *, _IO_FILE *) __THROW;
 _IO_FILE *__old_freopen (const char *, const char *, _IO_FILE *) __THROW;
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* iolibio.h.  */
diff --git a/libio/libio.h b/libio/libio.h
index 09531202472..7a68e1a3ae3 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -73,8 +73,6 @@ typedef union
 
 #include <shlib-compat.h>
 
-__BEGIN_DECLS
-
 /* compatibility defines */
 #define _STDIO_USES_IOSTREAM
 #define _IO_UNIFIED_JUMPTABLES 1
@@ -119,16 +117,12 @@ __BEGIN_DECLS
 
 #define _IO_FLAGS2_MMAP 1
 #define _IO_FLAGS2_NOTCANCEL 2
-#ifdef _LIBC
-# define _IO_FLAGS2_FORTIFY 4
-#endif
+#define _IO_FLAGS2_FORTIFY 4
 #define _IO_FLAGS2_USER_WBUF 8
-#ifdef _LIBC
-# define _IO_FLAGS2_SCANF_STD 16
-# define _IO_FLAGS2_NOCLOSE 32
-# define _IO_FLAGS2_CLOEXEC 64
-# define _IO_FLAGS2_NEED_LOCK 128
-#endif
+#define _IO_FLAGS2_SCANF_STD 16
+#define _IO_FLAGS2_NOCLOSE 32
+#define _IO_FLAGS2_CLOEXEC 64
+#define _IO_FLAGS2_NEED_LOCK 128
 
 /* These are "formatting flags" matching the iostream fmtflags enum values. */
 #define _IO_SKIPWS 01
@@ -227,29 +221,18 @@ struct _IO_wide_data
   const struct _IO_jump_t *_wide_vtable;
 };
 
-
-#ifndef __cplusplus
 typedef struct _IO_FILE _IO_FILE;
-#endif
 
 struct _IO_FILE_plus;
 
 extern struct _IO_FILE_plus _IO_2_1_stdin_;
 extern struct _IO_FILE_plus _IO_2_1_stdout_;
 extern struct _IO_FILE_plus _IO_2_1_stderr_;
-#ifndef _LIBC
-#define _IO_stdin ((_IO_FILE*)(&_IO_2_1_stdin_))
-#define _IO_stdout ((_IO_FILE*)(&_IO_2_1_stdout_))
-#define _IO_stderr ((_IO_FILE*)(&_IO_2_1_stderr_))
-#else
 extern _IO_FILE *_IO_stdin attribute_hidden;
 extern _IO_FILE *_IO_stdout attribute_hidden;
 extern _IO_FILE *_IO_stderr attribute_hidden;
-#endif
-
 
 /* Compatibility names for cookie I/O functions.  */
-#ifdef __USE_GNU
 typedef cookie_read_function_t __io_read_fn;
 typedef cookie_write_function_t __io_write_fn;
 typedef cookie_seek_function_t __io_seek_fn;
@@ -261,7 +244,6 @@ struct _IO_cookie_file;
 /* Initialize one of those.  */
 extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
 			     void *__cookie, _IO_cookie_io_functions_t __fns);
-#endif
 
 extern int __underflow (_IO_FILE *);
 extern _IO_wint_t __wunderflow (_IO_FILE *);
@@ -342,8 +324,6 @@ extern _IO_wint_t _IO_getwc (_IO_FILE *__fp);
 extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp);
 extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW;
 
-/* While compiling glibc we have to handle compatibility with very old
-   versions.  */
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
 #  define _IO_fwide_maybe_incompatible \
   (__builtin_expect (&_IO_stdin_used == NULL, 0))
@@ -416,6 +396,4 @@ libc_hidden_proto (_IO_vfscanf)
 # endif
 #endif /* _IO_MTSAFE_IO */
 
-__END_DECLS
-
 #endif /* _LIBIO_H */
diff --git a/libio/libioP.h b/libio/libioP.h
index 58cc9de094b..abbf3316855 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -52,10 +52,6 @@
    adjusts the libio configuration.  */
 #include <_G_config.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #define _IO_seek_set 0
 #define _IO_seek_cur 1
 #define _IO_seek_end 2
@@ -731,10 +727,6 @@ extern int _IO_vscanf (const char *, _IO_va_list) __THROW;
 # define _IO_pos_0 ((_IO_off64_t) 0)
 #endif
 
-#ifdef __cplusplus
-}
-#endif
-
 #ifdef _IO_MTSAFE_IO
 /* check following! */
 # ifdef _IO_USE_OLD_IO_FILE
-- 
2.16.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH 6/6] Remove completely unused libio flag bits.
  2018-02-11 16:36 [PATCH 0/6] Mostly mechanical libio decrufting Zack Weinberg
  2018-02-11 16:36 ` [PATCH 1/6] Remove vestiges of external build support from libio headers Zack Weinberg
  2018-02-11 16:36 ` [PATCH 5/6] Remove miscellaneous debris from libio Zack Weinberg
@ 2018-02-11 16:36 ` Zack Weinberg
  2018-02-12 12:42   ` Adhemerval Zanella
  2018-02-11 16:36 ` [PATCH 2/6] Mechanically remove _IO_ name aliases for types and constants Zack Weinberg
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 29+ messages in thread
From: Zack Weinberg @ 2018-02-11 16:36 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, adhemerval.zanella

These macros are used literally nowhere in the source tree, and all
of them appear to relate to the C++ functionality of the original
libio that never got taken into glibc in the first place.  I also
reformatted the first set of flags to make it really obvious which
bits are not used (there's one bit that never gets set by current
code but might get set by old code).

This is as far as I propose to go in this patchset.  The next most
pressing changes are to eliminate _IO_MTSAFE_IO and to start removing
support for deprecated-but-exported _IO_ symbols, and both of those I
believe Florian has already been working on, so I'll leave them to
him.

	* libio/libio.h (_IOS_ATEND, _IOS_APPEND, _IOS_TRUNC)
	(_IOS_NOCREATE, _IOS_NOREPLACE, _IOS_BIN, _OLD_STDIO_MAGIC)
	(_IO_SKIPWS, _IO_LEFT, _IO_RIGHT, _IO_INTERNAL, _IO_DEC)
	(_IO_OCT, _IO_HEX, _IO_SHOWBASE, _IO_SHOWPOINT, _IO_UPPERCASE)
	(_IO_SHOWPOS, _IO_SCIENTIFIC, _IO_FIXED, _IO_UNITBUF, _IO_STDIO)
	(_IO_DONT_CLOSE, _IO_BOOLALPHA): Remove, unused.
	(_IO_BAD_SEEN): Comment out but leave as documentation.
	Reformat bit flags for _flags field to make occupancy clearer.
	Update commentary.
	* libio/bits/types/struct_FILE.h (_IO_EOF_SEEN, _IO_ERR_SEEN):
	Keep definitions consistent with those in libio/libio.h.
---
 libio/bits/types/struct_FILE.h |  4 +--
 libio/libio.h                  | 77 ++++++++++++++----------------------------
 2 files changed, 27 insertions(+), 54 deletions(-)

diff --git a/libio/bits/types/struct_FILE.h b/libio/bits/types/struct_FILE.h
index a120c762685..359f9494534 100644
--- a/libio/bits/types/struct_FILE.h
+++ b/libio/bits/types/struct_FILE.h
@@ -108,10 +108,10 @@ struct _IO_FILE_complete
    ? __overflow (_fp, (unsigned char) (_ch))				\
    : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))
 
-#define _IO_EOF_SEEN 0x10
+#define _IO_EOF_SEEN 0x0010
 #define __feof_unlocked_body(_fp) (((_fp)->_flags & _IO_EOF_SEEN) != 0)
 
-#define _IO_ERR_SEEN 0x20
+#define _IO_ERR_SEEN 0x0020
 #define __ferror_unlocked_body(_fp) (((_fp)->_flags & _IO_ERR_SEEN) != 0)
 
 #define _IO_USER_LOCK 0x8000
diff --git a/libio/libio.h b/libio/libio.h
index 1371161e025..b25e583a794 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -60,42 +60,34 @@ typedef union
 
 #include <shlib-compat.h>
 
-/* open modes */
+/* _IO_seekoff modes */
 #define _IOS_INPUT	1
 #define _IOS_OUTPUT	2
-#define _IOS_ATEND	4
-#define _IOS_APPEND	8
-#define _IOS_TRUNC	16
-#define _IOS_NOCREATE	32
-#define _IOS_NOREPLACE	64
-#define _IOS_BIN	128
-
-/* Magic numbers and bits for the _flags field.
-   The magic numbers use the high-order bits of _flags;
-   the remaining bits are available for variable flags.
-   Note: The magic numbers must all be negative if stdio
-   emulation is desired. */
-
-#define _IO_MAGIC 0xFBAD0000 /* Magic number */
-#define _OLD_STDIO_MAGIC 0xFABC0000 /* Emulate old stdio. */
-#define _IO_MAGIC_MASK 0xFFFF0000
-#define _IO_USER_BUF 1 /* User owns buffer; don't delete it on close. */
-#define _IO_UNBUFFERED 2
-#define _IO_NO_READS 4 /* Reading not allowed */
-#define _IO_NO_WRITES 8 /* Writing not allowd */
-#define _IO_EOF_SEEN 0x10
-#define _IO_ERR_SEEN 0x20
-#define _IO_DELETE_DONT_CLOSE 0x40 /* Don't call close(_fileno) on cleanup. */
-#define _IO_LINKED 0x80 /* Set if linked (using _chain) to streambuf::_list_all.*/
-#define _IO_IN_BACKUP 0x100
-#define _IO_LINE_BUF 0x200
-#define _IO_TIED_PUT_GET 0x400 /* Set if put and get pointer logicly tied. */
-#define _IO_CURRENTLY_PUTTING 0x800
-#define _IO_IS_APPENDING 0x1000
-#define _IO_IS_FILEBUF 0x2000
-#define _IO_BAD_SEEN 0x4000
-#define _IO_USER_LOCK 0x8000
 
+/* Magic number and bits for the _flags field.  The magic number is
+   mostly vestigial, but preserved for compatibility.  It occupies the
+   high 16 bits of _flags; the low 16 bits are actual flag bits.  */
+
+#define _IO_MAGIC         0xFBAD0000 /* Magic number */
+#define _IO_MAGIC_MASK    0xFFFF0000
+#define _IO_USER_BUF          0x0001 /* Don't deallocate buffer on close. */
+#define _IO_UNBUFFERED        0x0002
+#define _IO_NO_READS          0x0004 /* Reading not allowed.  */
+#define _IO_NO_WRITES         0x0008 /* Writing not allowed.  */
+#define _IO_EOF_SEEN          0x0010
+#define _IO_ERR_SEEN          0x0020
+#define _IO_DELETE_DONT_CLOSE 0x0040 /* Don't call close(_fileno) on close.  */
+#define _IO_LINKED            0x0080 /* In the list of all open files.  */
+#define _IO_IN_BACKUP         0x0100
+#define _IO_LINE_BUF          0x0200
+#define _IO_TIED_PUT_GET      0x0400 /* Put and get pointer move in unison.  */
+#define _IO_CURRENTLY_PUTTING 0x0800
+#define _IO_IS_APPENDING      0x1000
+#define _IO_IS_FILEBUF        0x2000
+/*#define _IO_BAD_SEEN        0x4000  No longer used, reserved for compat.  */
+#define _IO_USER_LOCK         0x8000
+
+/* Bits for the _flags2 field.  */
 #define _IO_FLAGS2_MMAP 1
 #define _IO_FLAGS2_NOTCANCEL 2
 #define _IO_FLAGS2_FORTIFY 4
@@ -105,25 +97,6 @@ typedef union
 #define _IO_FLAGS2_CLOEXEC 64
 #define _IO_FLAGS2_NEED_LOCK 128
 
-/* These are "formatting flags" matching the iostream fmtflags enum values. */
-#define _IO_SKIPWS 01
-#define _IO_LEFT 02
-#define _IO_RIGHT 04
-#define _IO_INTERNAL 010
-#define _IO_DEC 020
-#define _IO_OCT 040
-#define _IO_HEX 0100
-#define _IO_SHOWBASE 0200
-#define _IO_SHOWPOINT 0400
-#define _IO_UPPERCASE 01000
-#define _IO_SHOWPOS 02000
-#define _IO_SCIENTIFIC 04000
-#define _IO_FIXED 010000
-#define _IO_UNITBUF 020000
-#define _IO_STDIO 040000
-#define _IO_DONT_CLOSE 0100000
-#define _IO_BOOLALPHA 0200000
-
 /* _IO_pos_BAD is an off64_t value indicating error, unknown, or EOF. */
 #define _IO_pos_BAD ((off64_t) -1)
 
-- 
2.16.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH 3/6] Remove legacy configuration knobs from libio.
  2018-02-11 16:36 [PATCH 0/6] Mostly mechanical libio decrufting Zack Weinberg
                   ` (3 preceding siblings ...)
  2018-02-11 16:36 ` [PATCH 2/6] Mechanically remove _IO_ name aliases for types and constants Zack Weinberg
@ 2018-02-11 17:45 ` Zack Weinberg
  2018-02-11 18:07   ` Andreas Schwab
  2018-02-12 11:41   ` Adhemerval Zanella
  2018-02-11 17:52 ` [PATCH 4/6] Remove _IO_file_flags define Zack Weinberg
  2018-02-21 21:25 ` [PATCH 0/6] Mostly mechanical libio decrufting Zack Weinberg
  6 siblings, 2 replies; 29+ messages in thread
From: Zack Weinberg @ 2018-02-11 17:45 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, adhemerval.zanella

This patch eliminates the "compatibility defines"
_IO_UNIFIED_JUMPTABLES (always defined to 1, used in a number of #ifs
which are therefore always false), _STDIO_USES_IOSTREAM (unused),
__HAVE_COLUMN (unused), _IO_BE (replaced with __glibc_unlikely), and
yet another redundant definition of EOF.

	* libio/libio.h (_IO_UNIFIED_JUMPTABLES, _STDIO_USES_IOSTREAM)
	(__HAVE_COLUMN, _IO_BE): Don't define.
	(_IO_peekc_unlocked, _IO_getwc_unlocked, _IO_putwc_unlocked)
	(_IO_fwide_maybe_incompatible): Use __glibc_unlikely.
	* libio/libioP.h (EOF): Don't define.
	* libio/iofdopen.c, libio/iofopen.c, libio/iopopen.c
	* libio/iovdprintf.c, libio/oldiofdopen.c, libio/oldiofopen.c
	* libio/oldiopopen.c, debug/vdprintf_chk.c: Remove #if block
        testing _IO_UNIFIED_JUMPTABLES.
---
 debug/vdprintf_chk.c |  3 ---
 libio/iofdopen.c     |  3 ---
 libio/iofopen.c      |  3 ---
 libio/iopopen.c      |  3 ---
 libio/iovdprintf.c   |  3 ---
 libio/libio.h        | 36 ++++++++++++++----------------------
 libio/libioP.h       |  4 ----
 libio/oldiofdopen.c  |  3 ---
 libio/oldiofopen.c   |  3 ---
 libio/oldiopopen.c   |  3 ---
 10 files changed, 14 insertions(+), 50 deletions(-)

diff --git a/debug/vdprintf_chk.c b/debug/vdprintf_chk.c
index c195a7951e0..bc713b49628 100644
--- a/debug/vdprintf_chk.c
+++ b/debug/vdprintf_chk.c
@@ -40,9 +40,6 @@ __vdprintf_chk (int d, int flags, const char *format, va_list arg)
   _IO_no_init (&tmpfil.file, _IO_USER_LOCK, 0, &wd, &_IO_wfile_jumps);
   _IO_JUMPS (&tmpfil) = &_IO_file_jumps;
   _IO_new_file_init_internal (&tmpfil);
-#if  !_IO_UNIFIED_JUMPTABLES
-  tmpfil.vtable = NULL;
-#endif
   if (_IO_file_attach (&tmpfil.file, d) == NULL)
     {
       _IO_un_link (&tmpfil);
diff --git a/libio/iofdopen.c b/libio/iofdopen.c
index 39617365f53..21a53e30f6c 100644
--- a/libio/iofdopen.c
+++ b/libio/iofdopen.c
@@ -137,9 +137,6 @@ _IO_new_fdopen (int fd, const char *mode)
 #endif
       &_IO_file_jumps;
   _IO_new_file_init_internal (&new_f->fp);
-#if  !_IO_UNIFIED_JUMPTABLES
-  new_f->fp.vtable = NULL;
-#endif
   /* We only need to record the fd because _IO_file_init_internal will
      have unset the offset.  It is important to unset the cached
      offset because the real offset in the file could change between
diff --git a/libio/iofopen.c b/libio/iofopen.c
index f17ec914579..ed3e8b853c6 100644
--- a/libio/iofopen.c
+++ b/libio/iofopen.c
@@ -72,9 +72,6 @@ __fopen_internal (const char *filename, const char *mode, int is32)
   _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
   _IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
   _IO_new_file_init_internal (&new_f->fp);
-#if  !_IO_UNIFIED_JUMPTABLES
-  new_f->fp.vtable = NULL;
-#endif
   if (_IO_file_fopen ((FILE *) new_f, filename, mode, is32) != NULL)
     return __fopen_maybe_mmap (&new_f->fp.file);
 
diff --git a/libio/iopopen.c b/libio/iopopen.c
index efdd0a6f586..2eff45b4c80 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -200,9 +200,6 @@ _IO_new_popen (const char *command, const char *mode)
   _IO_init_internal (fp, 0);
   _IO_JUMPS (&new_f->fpx.file) = &_IO_proc_jumps;
   _IO_new_file_init_internal (&new_f->fpx.file);
-#if  !_IO_UNIFIED_JUMPTABLES
-  new_f->fpx.file.vtable = NULL;
-#endif
   if (_IO_new_proc_open (fp, command, mode) != NULL)
     return (FILE *) &new_f->fpx.file;
   _IO_un_link (&new_f->fpx.file);
diff --git a/libio/iovdprintf.c b/libio/iovdprintf.c
index 78df2fe559b..78a3a2bd159 100644
--- a/libio/iovdprintf.c
+++ b/libio/iovdprintf.c
@@ -40,9 +40,6 @@ _IO_vdprintf (int d, const char *format, va_list arg)
   _IO_no_init (&tmpfil.file, _IO_USER_LOCK, 0, &wd, &_IO_wfile_jumps);
   _IO_JUMPS (&tmpfil) = &_IO_file_jumps;
   _IO_new_file_init_internal (&tmpfil);
-#if  !_IO_UNIFIED_JUMPTABLES
-  tmpfil.vtable = NULL;
-#endif
   if (_IO_file_attach (&tmpfil.file, d) == NULL)
     {
       _IO_un_link (&tmpfil);
diff --git a/libio/libio.h b/libio/libio.h
index 890b825ed86..a3c679ca666 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -61,9 +61,6 @@ typedef union
 #include <shlib-compat.h>
 
 /* compatibility defines */
-#define _STDIO_USES_IOSTREAM
-#define _IO_UNIFIED_JUMPTABLES 1
-#define __HAVE_COLUMN
 #define _IO_file_flags _flags
 
 /* open modes */
@@ -228,28 +225,23 @@ extern wint_t __wunderflow (FILE *);
 extern wint_t __wuflow (FILE *);
 extern wint_t __woverflow (FILE *, wint_t);
 
-#if  __GNUC__ >= 3
-# define _IO_BE(expr, res) __builtin_expect ((expr), res)
-#else
-# define _IO_BE(expr, res) (expr)
-#endif
-
 #define _IO_getc_unlocked(_fp) __getc_unlocked_body (_fp)
-#define _IO_peekc_unlocked(_fp) \
-       (_IO_BE ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end, 0) \
-	  && __underflow (_fp) == EOF ? EOF \
-	: *(unsigned char *) (_fp)->_IO_read_ptr)
+#define _IO_peekc_unlocked(_fp)						\
+  (__glibc_unlikely ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end)	\
+   && __underflow (_fp) == EOF						\
+   ? EOF								\
+   : *(unsigned char *) (_fp)->_IO_read_ptr)
 #define _IO_putc_unlocked(_ch, _fp) __putc_unlocked_body (_ch, _fp)
 
-# define _IO_getwc_unlocked(_fp) \
-  (_IO_BE ((_fp)->_wide_data == NULL					\
-	   || ((_fp)->_wide_data->_IO_read_ptr				\
-	       >= (_fp)->_wide_data->_IO_read_end), 0)			\
+# define _IO_getwc_unlocked(_fp)					\
+  (__glibc_unlikely ((_fp)->_wide_data == NULL				\
+		     || ((_fp)->_wide_data->_IO_read_ptr		\
+			 >= (_fp)->_wide_data->_IO_read_end))		\
    ? __wuflow (_fp) : (wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
-# define _IO_putwc_unlocked(_wch, _fp) \
-  (_IO_BE ((_fp)->_wide_data == NULL					\
-	   || ((_fp)->_wide_data->_IO_write_ptr				\
-	       >= (_fp)->_wide_data->_IO_write_end), 0)			\
+# define _IO_putwc_unlocked(_wch, _fp)					\
+  (__glibc_unlikely ((_fp)->_wide_data == NULL				\
+		     || ((_fp)->_wide_data->_IO_write_ptr		\
+			 >= (_fp)->_wide_data->_IO_write_end))		\
    ? __woverflow (_fp, _wch)						\
    : (wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
 
@@ -304,7 +296,7 @@ extern int _IO_fwide (FILE *__fp, int __mode) __THROW;
 
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
 #  define _IO_fwide_maybe_incompatible \
-  (__builtin_expect (&_IO_stdin_used == NULL, 0))
+  (__glibc_unlikely (&_IO_stdin_used == NULL))
 extern const int _IO_stdin_used;
 weak_extern (_IO_stdin_used);
 #else
diff --git a/libio/libioP.h b/libio/libioP.h
index 57fd60567c7..5064bdf69d4 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -690,10 +690,6 @@ extern off64_t _IO_seekoff_unlocked (FILE *, off64_t, int, int)
 extern off64_t _IO_seekpos_unlocked (FILE *, off64_t, int)
      attribute_hidden;
 
-#ifndef EOF
-# define EOF (-1)
-#endif
-
 #if _G_HAVE_MMAP
 
 # include <unistd.h>
diff --git a/libio/oldiofdopen.c b/libio/oldiofdopen.c
index be670e8da4d..17930c2786f 100644
--- a/libio/oldiofdopen.c
+++ b/libio/oldiofdopen.c
@@ -102,9 +102,6 @@ _IO_old_fdopen (int fd, const char *mode)
   _IO_old_init (&new_f->fp.file._file, 0);
   _IO_JUMPS_FILE_plus (&new_f->fp) = &_IO_old_file_jumps;
   _IO_old_file_init_internal ((struct _IO_FILE_plus *) &new_f->fp);
-#if  !_IO_UNIFIED_JUMPTABLES
-  new_f->fp.vtable = NULL;
-#endif
   if (_IO_old_file_attach (&new_f->fp.file._file, fd) == NULL)
     {
       _IO_un_link ((struct _IO_FILE_plus *) &new_f->fp);
diff --git a/libio/oldiofopen.c b/libio/oldiofopen.c
index f4ead0c1299..f0a67104fb0 100644
--- a/libio/oldiofopen.c
+++ b/libio/oldiofopen.c
@@ -52,9 +52,6 @@ _IO_old_fopen (const char *filename, const char *mode)
   _IO_old_init (&new_f->fp.file._file, 0);
   _IO_JUMPS_FILE_plus (&new_f->fp) = &_IO_old_file_jumps;
   _IO_old_file_init_internal ((struct _IO_FILE_plus *) &new_f->fp);
-#if  !_IO_UNIFIED_JUMPTABLES
-  new_f->fp.vtable = NULL;
-#endif
   if (_IO_old_file_fopen ((FILE *) &new_f->fp, filename, mode) != NULL)
     return (FILE *) &new_f->fp;
   _IO_un_link ((struct _IO_FILE_plus *) &new_f->fp);
diff --git a/libio/oldiopopen.c b/libio/oldiopopen.c
index 42cab4e8f77..e47965db0ac 100644
--- a/libio/oldiopopen.c
+++ b/libio/oldiopopen.c
@@ -157,9 +157,6 @@ _IO_old_popen (const char *command, const char *mode)
   _IO_old_init (fp, 0);
   _IO_JUMPS_FILE_plus (&new_f->fpx.file) = &_IO_old_proc_jumps;
   _IO_old_file_init_internal ((struct _IO_FILE_plus *) &new_f->fpx.file);
-#if  !_IO_UNIFIED_JUMPTABLES
-  new_f->fpx.file.vtable = NULL;
-#endif
   if (_IO_old_proc_open (fp, command, mode) != NULL)
     return fp;
   _IO_un_link ((struct _IO_FILE_plus *) &new_f->fpx.file);
-- 
2.16.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH 4/6] Remove _IO_file_flags define.
  2018-02-11 16:36 [PATCH 0/6] Mostly mechanical libio decrufting Zack Weinberg
                   ` (4 preceding siblings ...)
  2018-02-11 17:45 ` [PATCH 3/6] Remove legacy configuration knobs from libio Zack Weinberg
@ 2018-02-11 17:52 ` Zack Weinberg
  2018-02-11 18:20   ` Andreas Schwab
  2018-02-21 21:25 ` [PATCH 0/6] Mostly mechanical libio decrufting Zack Weinberg
  6 siblings, 1 reply; 29+ messages in thread
From: Zack Weinberg @ 2018-02-11 17:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, adhemerval.zanella

This entirely mechanical (except for some indentation fixups) patch
replaces all uses of _IO_file_flags with _flags and removes the #define.

	* libio/libio.h (_IO_file_flags): Remove macro.
        All uses changed to _flags.
---
 debug/fgets_chk.c       |  8 ++++----
 debug/fgets_u_chk.c     |  9 ++++-----
 debug/fgetws_chk.c      |  6 +++---
 debug/fgetws_u_chk.c    |  9 ++++-----
 debug/gets_chk.c        |  8 ++++----
 libio/fileops.c         |  2 +-
 libio/iofclose.c        |  6 +++---
 libio/iofgets.c         |  9 ++++-----
 libio/iofgets_u.c       |  9 ++++-----
 libio/iofgetws.c        |  6 +++---
 libio/iofgetws_u.c      |  9 ++++-----
 libio/iogets.c          |  8 ++++----
 libio/iosetvbuf.c       | 12 ++++++------
 libio/libio.h           |  3 ---
 libio/libioP.h          |  4 ++--
 libio/oldfileops.c      |  2 +-
 libio/oldiofclose.c     |  6 +++---
 libio/strfile.h         |  2 +-
 libio/strops.c          |  2 +-
 stdio-common/vfprintf.c |  4 ++--
 20 files changed, 58 insertions(+), 66 deletions(-)

diff --git a/debug/fgets_chk.c b/debug/fgets_chk.c
index f2236533700..d86454f3e81 100644
--- a/debug/fgets_chk.c
+++ b/debug/fgets_chk.c
@@ -40,12 +40,12 @@ __fgets_chk (char *buf, size_t size, int n, FILE *fp)
   /* This is very tricky since a file descriptor may be in the
      non-blocking mode. The error flag doesn't mean much in this
      case. We return an error only when there is a new error. */
-  int old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
-  fp->_IO_file_flags &= ~_IO_ERR_SEEN;
+  int old_error = fp->_flags & _IO_ERR_SEEN;
+  fp->_flags &= ~_IO_ERR_SEEN;
   count = _IO_getline (fp, buf, MIN ((size_t) n - 1, size), '\n', 1);
   /* If we read in some bytes and errno is EAGAIN, that error will
      be reported for next read. */
-  if (count == 0 || ((fp->_IO_file_flags & _IO_ERR_SEEN)
+  if (count == 0 || ((fp->_flags & _IO_ERR_SEEN)
 		     && errno != EAGAIN))
     result = NULL;
   else if (count >= size)
@@ -55,7 +55,7 @@ __fgets_chk (char *buf, size_t size, int n, FILE *fp)
       buf[count] = '\0';
       result = buf;
     }
-  fp->_IO_file_flags |= old_error;
+  fp->_flags |= old_error;
   _IO_release_lock (fp);
   return result;
 }
diff --git a/debug/fgets_u_chk.c b/debug/fgets_u_chk.c
index 317ae5649df..924634c17bc 100644
--- a/debug/fgets_u_chk.c
+++ b/debug/fgets_u_chk.c
@@ -39,13 +39,12 @@ __fgets_unlocked_chk (char *buf, size_t size, int n, FILE *fp)
   /* This is very tricky since a file descriptor may be in the
      non-blocking mode. The error flag doesn't mean much in this
      case. We return an error only when there is a new error. */
-  int old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
-  fp->_IO_file_flags &= ~_IO_ERR_SEEN;
+  int old_error = fp->_flags & _IO_ERR_SEEN;
+  fp->_flags &= ~_IO_ERR_SEEN;
   count = _IO_getline (fp, buf, MIN ((size_t) n - 1, size), '\n', 1);
   /* If we read in some bytes and errno is EAGAIN, that error will
      be reported for next read. */
-  if (count == 0 || ((fp->_IO_file_flags & _IO_ERR_SEEN)
-		     && errno != EAGAIN))
+  if (count == 0 || ((fp->_flags & _IO_ERR_SEEN) && errno != EAGAIN))
     result = NULL;
   else if (count >= size)
     __chk_fail ();
@@ -54,6 +53,6 @@ __fgets_unlocked_chk (char *buf, size_t size, int n, FILE *fp)
       buf[count] = '\0';
       result = buf;
     }
-  fp->_IO_file_flags |= old_error;
+  fp->_flags |= old_error;
   return result;
 }
diff --git a/debug/fgetws_chk.c b/debug/fgetws_chk.c
index 8ea6635b30e..2380059f0f1 100644
--- a/debug/fgetws_chk.c
+++ b/debug/fgetws_chk.c
@@ -32,8 +32,8 @@ __fgetws_chk (wchar_t *buf, size_t size, int n, FILE *fp)
   /* This is very tricky since a file descriptor may be in the
      non-blocking mode. The error flag doesn't mean much in this
      case. We return an error only when there is a new error. */
-  old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
-  fp->_IO_file_flags &= ~_IO_ERR_SEEN;
+  old_error = fp->_flags & _IO_ERR_SEEN;
+  fp->_flags &= ~_IO_ERR_SEEN;
   count = _IO_getwline (fp, buf, MIN ((size_t) n - 1, size), L'\n', 1);
   /* If we read in some bytes and errno is EAGAIN, that error will
      be reported for next read. */
@@ -46,7 +46,7 @@ __fgetws_chk (wchar_t *buf, size_t size, int n, FILE *fp)
       buf[count] = '\0';
       result = buf;
     }
-  fp->_IO_file_flags |= old_error;
+  fp->_flags |= old_error;
   _IO_release_lock (fp);
   return result;
 }
diff --git a/debug/fgetws_u_chk.c b/debug/fgetws_u_chk.c
index 42dad6bc8b5..8147eb1e36c 100644
--- a/debug/fgetws_u_chk.c
+++ b/debug/fgetws_u_chk.c
@@ -40,13 +40,12 @@ __fgetws_unlocked_chk (wchar_t *buf, size_t size, int n, FILE *fp)
   /* This is very tricky since a file descriptor may be in the
      non-blocking mode. The error flag doesn't mean much in this
      case. We return an error only when there is a new error. */
-  old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
-  fp->_IO_file_flags &= ~_IO_ERR_SEEN;
+  old_error = fp->_flags & _IO_ERR_SEEN;
+  fp->_flags &= ~_IO_ERR_SEEN;
   count = _IO_getwline (fp, buf, MIN ((size_t) n - 1, size), L'\n', 1);
   /* If we read in some bytes and errno is EAGAIN, that error will
      be reported for next read. */
-  if (count == 0 || ((fp->_IO_file_flags & _IO_ERR_SEEN)
-		     && errno != EAGAIN))
+  if (count == 0 || ((fp->_flags & _IO_ERR_SEEN) && errno != EAGAIN))
     result = NULL;
   else if (count >= size)
     __chk_fail ();
@@ -55,6 +54,6 @@ __fgetws_unlocked_chk (wchar_t *buf, size_t size, int n, FILE *fp)
       buf[count] = '\0';
       result = buf;
     }
-  fp->_IO_file_flags |= old_error;
+  fp->_flags |= old_error;
   return result;
 }
diff --git a/debug/gets_chk.c b/debug/gets_chk.c
index df3f947e705..2b1416b295e 100644
--- a/debug/gets_chk.c
+++ b/debug/gets_chk.c
@@ -51,17 +51,17 @@ __gets_chk (char *buf, size_t size)
       /* This is very tricky since a file descriptor may be in the
 	 non-blocking mode. The error flag doesn't mean much in this
 	 case. We return an error only when there is a new error. */
-      int old_error = _IO_stdin->_IO_file_flags & _IO_ERR_SEEN;
-      _IO_stdin->_IO_file_flags &= ~_IO_ERR_SEEN;
+      int old_error = _IO_stdin->_flags & _IO_ERR_SEEN;
+      _IO_stdin->_flags &= ~_IO_ERR_SEEN;
       buf[0] = (char) ch;
       count = _IO_getline (_IO_stdin, buf + 1, size - 1, '\n', 0) + 1;
-      if (_IO_stdin->_IO_file_flags & _IO_ERR_SEEN)
+      if (_IO_stdin->_flags & _IO_ERR_SEEN)
 	{
 	  retval = NULL;
 	  goto unlock_return;
 	}
       else
-	_IO_stdin->_IO_file_flags |= old_error;
+	_IO_stdin->_flags |= old_error;
     }
   if (count >= size)
     __chk_fail ();
diff --git a/libio/fileops.c b/libio/fileops.c
index 1162b1b1442..fb39bec63cd 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -109,7 +109,7 @@ _IO_new_file_init_internal (struct _IO_FILE_plus *fp)
      of our file descriptor.  Hence we actually don't know the actual
      position before we do the first fseek (and until a following fflush). */
   fp->file._offset = _IO_pos_BAD;
-  fp->file._IO_file_flags |= CLOSED_FILEBUF_FLAGS;
+  fp->file._flags |= CLOSED_FILEBUF_FLAGS;
 
   _IO_link_in (fp);
   fp->file._fileno = -1;
diff --git a/libio/iofclose.c b/libio/iofclose.c
index c7c44ed9b47..7a8b89f9f54 100644
--- a/libio/iofclose.c
+++ b/libio/iofclose.c
@@ -45,11 +45,11 @@ _IO_new_fclose (FILE *fp)
 #endif
 
   /* First unlink the stream.  */
-  if (fp->_IO_file_flags & _IO_IS_FILEBUF)
+  if (fp->_flags & _IO_IS_FILEBUF)
     _IO_un_link ((struct _IO_FILE_plus *) fp);
 
   _IO_acquire_lock (fp);
-  if (fp->_IO_file_flags & _IO_IS_FILEBUF)
+  if (fp->_flags & _IO_IS_FILEBUF)
     status = _IO_file_close_it (fp);
   else
     status = fp->_flags & _IO_ERR_SEEN ? -1 : 0;
@@ -73,7 +73,7 @@ _IO_new_fclose (FILE *fp)
     }
   if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr)
     {
-      fp->_IO_file_flags = 0;
+      fp->_flags = 0;
       free(fp);
     }
 
diff --git a/libio/iofgets.c b/libio/iofgets.c
index b15b59d3bf6..68177dbe22d 100644
--- a/libio/iofgets.c
+++ b/libio/iofgets.c
@@ -48,20 +48,19 @@ _IO_fgets (char *buf, int n, FILE *fp)
   /* This is very tricky since a file descriptor may be in the
      non-blocking mode. The error flag doesn't mean much in this
      case. We return an error only when there is a new error. */
-  old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
-  fp->_IO_file_flags &= ~_IO_ERR_SEEN;
+  old_error = fp->_flags & _IO_ERR_SEEN;
+  fp->_flags &= ~_IO_ERR_SEEN;
   count = _IO_getline (fp, buf, n - 1, '\n', 1);
   /* If we read in some bytes and errno is EAGAIN, that error will
      be reported for next read. */
-  if (count == 0 || ((fp->_IO_file_flags & _IO_ERR_SEEN)
-		     && errno != EAGAIN))
+  if (count == 0 || ((fp->_flags & _IO_ERR_SEEN) && errno != EAGAIN))
     result = NULL;
   else
     {
       buf[count] = '\0';
       result = buf;
     }
-  fp->_IO_file_flags |= old_error;
+  fp->_flags |= old_error;
   _IO_release_lock (fp);
   return result;
 }
diff --git a/libio/iofgets_u.c b/libio/iofgets_u.c
index 90916446857..9d33a376219 100644
--- a/libio/iofgets_u.c
+++ b/libio/iofgets_u.c
@@ -47,20 +47,19 @@ __fgets_unlocked (char *buf, int n, FILE *fp)
   /* This is very tricky since a file descriptor may be in the
      non-blocking mode. The error flag doesn't mean much in this
      case. We return an error only when there is a new error. */
-  old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
-  fp->_IO_file_flags &= ~_IO_ERR_SEEN;
+  old_error = fp->_flags & _IO_ERR_SEEN;
+  fp->_flags &= ~_IO_ERR_SEEN;
   count = _IO_getline (fp, buf, n - 1, '\n', 1);
   /* If we read in some bytes and errno is EAGAIN, that error will
      be reported for next read. */
-  if (count == 0 || ((fp->_IO_file_flags & _IO_ERR_SEEN)
-		     && errno != EAGAIN))
+  if (count == 0 || ((fp->_flags & _IO_ERR_SEEN) && errno != EAGAIN))
     result = NULL;
   else
     {
       buf[count] = '\0';
       result = buf;
     }
-  fp->_IO_file_flags |= old_error;
+  fp->_flags |= old_error;
   return result;
 }
 libc_hidden_def (__fgets_unlocked)
diff --git a/libio/iofgetws.c b/libio/iofgetws.c
index 0e2d515df5e..292a161757d 100644
--- a/libio/iofgetws.c
+++ b/libio/iofgetws.c
@@ -48,8 +48,8 @@ fgetws (wchar_t *buf, int n, FILE *fp)
   /* This is very tricky since a file descriptor may be in the
      non-blocking mode. The error flag doesn't mean much in this
      case. We return an error only when there is a new error. */
-  old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
-  fp->_IO_file_flags &= ~_IO_ERR_SEEN;
+  old_error = fp->_flags & _IO_ERR_SEEN;
+  fp->_flags &= ~_IO_ERR_SEEN;
   count = _IO_getwline (fp, buf, n - 1, L'\n', 1);
   /* If we read in some bytes and errno is EAGAIN, that error will
      be reported for next read. */
@@ -60,7 +60,7 @@ fgetws (wchar_t *buf, int n, FILE *fp)
       buf[count] = '\0';
       result = buf;
     }
-  fp->_IO_file_flags |= old_error;
+  fp->_flags |= old_error;
   _IO_release_lock (fp);
   return result;
 }
diff --git a/libio/iofgetws_u.c b/libio/iofgetws_u.c
index a930b47a6df..46431a278b5 100644
--- a/libio/iofgetws_u.c
+++ b/libio/iofgetws_u.c
@@ -47,19 +47,18 @@ fgetws_unlocked (wchar_t *buf, int n, FILE *fp)
   /* This is very tricky since a file descriptor may be in the
      non-blocking mode. The error flag doesn't mean much in this
      case. We return an error only when there is a new error. */
-  old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
-  fp->_IO_file_flags &= ~_IO_ERR_SEEN;
+  old_error = fp->_flags & _IO_ERR_SEEN;
+  fp->_flags &= ~_IO_ERR_SEEN;
   count = _IO_getwline (fp, buf, n - 1, L'\n', 1);
   /* If we read in some bytes and errno is EAGAIN, that error will
      be reported for next read. */
-  if (count == 0 || ((fp->_IO_file_flags & _IO_ERR_SEEN)
-		     && errno != EAGAIN))
+  if (count == 0 || ((fp->_flags & _IO_ERR_SEEN) && errno != EAGAIN))
     result = NULL;
   else
     {
       buf[count] = '\0';
       result = buf;
     }
-  fp->_IO_file_flags |= old_error;
+  fp->_flags |= old_error;
   return result;
 }
diff --git a/libio/iogets.c b/libio/iogets.c
index 19048f6d03d..c2223e6ecc0 100644
--- a/libio/iogets.c
+++ b/libio/iogets.c
@@ -48,17 +48,17 @@ _IO_gets (char *buf)
       /* This is very tricky since a file descriptor may be in the
 	 non-blocking mode. The error flag doesn't mean much in this
 	 case. We return an error only when there is a new error. */
-      int old_error = _IO_stdin->_IO_file_flags & _IO_ERR_SEEN;
-      _IO_stdin->_IO_file_flags &= ~_IO_ERR_SEEN;
+      int old_error = _IO_stdin->_flags & _IO_ERR_SEEN;
+      _IO_stdin->_flags &= ~_IO_ERR_SEEN;
       buf[0] = (char) ch;
       count = _IO_getline (_IO_stdin, buf + 1, INT_MAX, '\n', 0) + 1;
-      if (_IO_stdin->_IO_file_flags & _IO_ERR_SEEN)
+      if (_IO_stdin->_flags & _IO_ERR_SEEN)
 	{
 	  retval = NULL;
 	  goto unlock_return;
 	}
       else
-	_IO_stdin->_IO_file_flags |= old_error;
+	_IO_stdin->_flags |= old_error;
     }
   buf[count] = 0;
   retval = buf;
diff --git a/libio/iosetvbuf.c b/libio/iosetvbuf.c
index b29a93be548..a35d866d827 100644
--- a/libio/iosetvbuf.c
+++ b/libio/iosetvbuf.c
@@ -39,7 +39,7 @@ _IO_setvbuf (FILE *fp, char *buf, int mode, size_t size)
   switch (mode)
     {
     case _IOFBF:
-      fp->_IO_file_flags &= ~(_IO_LINE_BUF|_IO_UNBUFFERED);
+      fp->_flags &= ~(_IO_LINE_BUF|_IO_UNBUFFERED);
       if (buf == NULL)
 	{
 	  if (fp->_IO_buf_base == NULL)
@@ -62,15 +62,15 @@ _IO_setvbuf (FILE *fp, char *buf, int mode, size_t size)
 		  result = EOF;
 		  goto unlock_return;
 		}
-	      fp->_IO_file_flags &= ~_IO_LINE_BUF;
+	      fp->_flags &= ~_IO_LINE_BUF;
 	    }
 	  result = 0;
 	  goto unlock_return;
 	}
       break;
     case _IOLBF:
-      fp->_IO_file_flags &= ~_IO_UNBUFFERED;
-      fp->_IO_file_flags |= _IO_LINE_BUF;
+      fp->_flags &= ~_IO_UNBUFFERED;
+      fp->_flags |= _IO_LINE_BUF;
       if (buf == NULL)
 	{
 	  result = 0;
@@ -78,8 +78,8 @@ _IO_setvbuf (FILE *fp, char *buf, int mode, size_t size)
 	}
       break;
     case _IONBF:
-      fp->_IO_file_flags &= ~_IO_LINE_BUF;
-      fp->_IO_file_flags |= _IO_UNBUFFERED;
+      fp->_flags &= ~_IO_LINE_BUF;
+      fp->_flags |= _IO_UNBUFFERED;
       buf = NULL;
       size = 0;
       break;
diff --git a/libio/libio.h b/libio/libio.h
index a3c679ca666..d1516185667 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -60,9 +60,6 @@ typedef union
 
 #include <shlib-compat.h>
 
-/* compatibility defines */
-#define _IO_file_flags _flags
-
 /* open modes */
 #define _IOS_INPUT	1
 #define _IOS_OUTPUT	2
diff --git a/libio/libioP.h b/libio/libioP.h
index 5064bdf69d4..ee23296ddba 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -761,7 +761,7 @@ extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
 #else
 /* This is part of the kludge for binary compatibility with old stdio. */
 # define COERCE_FILE(FILE) \
-  (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) == _OLD_MAGIC_MASK \
+  (((FILE)->_flags & _IO_MAGIC_MASK) == _OLD_MAGIC_MASK \
     && (FILE) = *(FILE**)&((int*)fp)[1])
 #endif
 
@@ -775,7 +775,7 @@ extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
 # define CHECK_FILE(FILE, RET) \
 	if ((FILE) == NULL) { MAYBE_SET_EINVAL; return RET; } \
 	else { COERCE_FILE(FILE); \
-	       if (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
+	       if (((FILE)->_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
 	  { MAYBE_SET_EINVAL; return RET; }}
 #else
 # define CHECK_FILE(FILE, RET) COERCE_FILE (FILE)
diff --git a/libio/oldfileops.c b/libio/oldfileops.c
index 5b6e81c4967..5a0f246411c 100644
--- a/libio/oldfileops.c
+++ b/libio/oldfileops.c
@@ -102,7 +102,7 @@ _IO_old_file_init_internal (struct _IO_FILE_plus *fp)
      of our file descriptor.  Hence we actually don't know the actual
      position before we do the first fseek (and until a following fflush). */
   fp->file._old_offset = _IO_pos_BAD;
-  fp->file._IO_file_flags |= CLOSED_FILEBUF_FLAGS;
+  fp->file._flags |= CLOSED_FILEBUF_FLAGS;
 
   _IO_link_in (fp);
   fp->file._vtable_offset = ((int) sizeof (struct _IO_FILE)
diff --git a/libio/oldiofclose.c b/libio/oldiofclose.c
index 432a7dd89a4..f414502fe01 100644
--- a/libio/oldiofclose.c
+++ b/libio/oldiofclose.c
@@ -46,11 +46,11 @@ _IO_old_fclose (FILE *fp)
     return _IO_new_fclose (fp);
 
   /* First unlink the stream.  */
-  if (fp->_IO_file_flags & _IO_IS_FILEBUF)
+  if (fp->_flags & _IO_IS_FILEBUF)
     _IO_un_link ((struct _IO_FILE_plus *) fp);
 
   _IO_acquire_lock (fp);
-  if (fp->_IO_file_flags & _IO_IS_FILEBUF)
+  if (fp->_flags & _IO_IS_FILEBUF)
     status = _IO_old_file_close_it (fp);
   else
     status = fp->_flags & _IO_ERR_SEEN ? -1 : 0;
@@ -60,7 +60,7 @@ _IO_old_fclose (FILE *fp)
     _IO_free_backup_area (fp);
   if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr)
     {
-      fp->_IO_file_flags = 0;
+      fp->_flags = 0;
       free(fp);
     }
 
diff --git a/libio/strfile.h b/libio/strfile.h
index b96fd0fb0ae..46ac81809a3 100644
--- a/libio/strfile.h
+++ b/libio/strfile.h
@@ -59,7 +59,7 @@ typedef struct _IO_strfile_
 
 /* frozen: set when the program has requested that the array object not
    be altered, reallocated, or freed. */
-#define _IO_STR_FROZEN(FP) ((FP)->_f._IO_file_flags & _IO_USER_BUF)
+#define _IO_STR_FROZEN(FP) ((FP)->_f._flags & _IO_USER_BUF)
 
 typedef struct
 {
diff --git a/libio/strops.c b/libio/strops.c
index adfa80749c1..eddd722c093 100644
--- a/libio/strops.c
+++ b/libio/strops.c
@@ -74,7 +74,7 @@ void
 _IO_str_init_readonly (_IO_strfile *sf, const char *ptr, int size)
 {
   _IO_str_init_static_internal (sf, (char *) ptr, size < 0 ? -1 : size, NULL);
-  sf->_sbf._f._IO_file_flags |= _IO_NO_WRITES;
+  sf->_sbf._f._flags |= _IO_NO_WRITES;
 }
 
 int
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 27d3a2c1bf7..8f0a6f8cf28 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -62,7 +62,7 @@
 	  return -1;							      \
 	}								      \
     } while (0)
-#define UNBUFFERED_P(S) ((S)->_IO_file_flags & _IO_UNBUFFERED)
+#define UNBUFFERED_P(S) ((S)->_flags & _IO_UNBUFFERED)
 
 #define done_add(val) \
   do {									      \
@@ -2307,7 +2307,7 @@ buffered_vfprintf (FILE *s, const CHAR_T *format, va_list args)
   _IO_setp (hp, buf, buf + sizeof buf);
   hp->_mode = -1;
 #endif
-  hp->_IO_file_flags = _IO_MAGIC|_IO_NO_READS|_IO_USER_LOCK;
+  hp->_flags = _IO_MAGIC|_IO_NO_READS|_IO_USER_LOCK;
 #if _IO_JUMPS_OFFSET
   hp->_vtable_offset = 0;
 #endif
-- 
2.16.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 1/6] Remove vestiges of external build support from libio headers.
  2018-02-11 16:36 ` [PATCH 1/6] Remove vestiges of external build support from libio headers Zack Weinberg
@ 2018-02-11 17:54   ` Andreas Schwab
  0 siblings, 0 replies; 29+ messages in thread
From: Andreas Schwab @ 2018-02-11 17:54 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: libc-alpha, fweimer, adhemerval.zanella

On Feb 11 2018, Zack Weinberg <zackw@panix.com> wrote:

> 	* libio/iolibio.h, libio/libioP.h: Remove extern "C".
>         * libio/libio.h: Remove __BEGIN_DECLS and __END_DECLS.
> 	Remove preprocessor conditionals on _LIBC and __USE_GNU,
> 	which are always true, and __cplusplus, which is always false.

Ok.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 2/6] Mechanically remove _IO_ name aliases for types and constants.
  2018-02-11 16:36 ` [PATCH 2/6] Mechanically remove _IO_ name aliases for types and constants Zack Weinberg
@ 2018-02-11 17:57   ` Andreas Schwab
  0 siblings, 0 replies; 29+ messages in thread
From: Andreas Schwab @ 2018-02-11 17:57 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: libc-alpha, fweimer, adhemerval.zanella

On Feb 11 2018, Zack Weinberg <zackw@panix.com> wrote:

> 	* libio/libio.h (_IO_FILE): Delete; all uses changed to FILE.
> 	(_IO_fpos_t): Delete; all uses changed to __fpos_t.
> 	(_IO_fpos64_t): Delete; all uses changed to __fpos64_t.
> 	(_IO_size_t): Delete; all uses changed to size_t.
> 	(_IO_ssize_t): Delete; all uses changed to ssize_t or __ssize_t.
> 	(_IO_off_t): Delete; all uses changed to off_t.
> 	(_IO_off64_t): Delete; all uses changed to off64_t.
> 	(_IO_pid_t): Delete; all uses changed to pid_t.
> 	(_IO_uid_t): Delete; all uses changed to uid_t.
> 	(_IO_wint_t): Delete; all uses changed to wint_t.
> 	(_IO_va_list): Delete; all uses changed to va_list or __gnuc_va_list.
> 	(_IO_BUFSIZ): Delete; all uses changed to BUFSIZ.
> 	(_IO_cookie_io_functions_t): Delete; all uses changed to
> 	cookie_io_functions_t.
> 	(__io_read_fn): Delete; all uses changed to cookie_read_function_t.
> 	(__io_write_fn): Delete; all uses changed to cookie_write_function_t.
> 	(__io_seek_fn): Delete; all uses changed to cookie_seek_function_t.
> 	(__io_close_fn): Delete: all uses changed to cookie_close_function_t.
>
> 	* libio/iofopncook.c: Remove unnecessary forward declarations.
> 	* libio/iolibio.h: Correct outdated commentary.
> 	* malloc/malloc.c (__malloc_stats): Remove unnecessary casts.
> 	* stdio-common/fxprintf.c (__fxprintf_nocancel):
> 	Remove unnecessary casts.
> 	* stdio-common/getline.c: Use _IO_getdelim directly.
> 	Don't redefine ssize_t.
> 	* stdio-common/printf_fp.c, stdio_common/printf_fphex.c
> 	* stdio-common/printf_size.c: Don't redefine size_t or FILE.
> 	Remove outdated comments.
> 	* stdio-common/vfscanf.c: Don't redefine va_list.

Ok.

> @@ -1003,7 +1002,7 @@ _IO_new_file_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
>    if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
>        && !_IO_in_backup (fp))
>      {
> -      _IO_off64_t start_offset = (fp->_offset
> +      off64_t start_offset = (fp->_offset
>  				  - (fp->_IO_read_end - fp->_IO_buf_base));

Reindent.

> @@ -1191,13 +1190,13 @@ _IO_file_close (_IO_FILE *fp)
>  }
>  libc_hidden_def (_IO_file_close)
>  
> -_IO_ssize_t
> -_IO_new_file_write (_IO_FILE *f, const void *data, _IO_ssize_t n)
> +ssize_t
> +_IO_new_file_write (FILE *f, const void *data, ssize_t n)
>  {
> -  _IO_ssize_t to_do = n;
> +  ssize_t to_do = n;
>    while (to_do > 0)
>      {
> -      _IO_ssize_t count = (__builtin_expect (f->_flags2
> +      ssize_t count = (__builtin_expect (f->_flags2
>  					     & _IO_FLAGS2_NOTCANCEL, 0)

Reindent.

> @@ -54,7 +54,7 @@ _IO_getwline_info (_IO_FILE *fp, wchar_t *buf, _IO_size_t n, wint_t delim,
>      _IO_fwide (fp, 1);
>    while (n != 0)
>      {
> -      _IO_ssize_t len = (fp->_wide_data->_IO_read_end
> +      ssize_t len = (fp->_wide_data->_IO_read_end
>  			 - fp->_wide_data->_IO_read_ptr);

Reindent.

> @@ -512,7 +512,7 @@ _IO_old_file_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
>        && !_IO_in_backup (fp))
>      {
>        /* Offset relative to start of main get area. */
> -      _IO_off_t rel_offset = (offset - fp->_old_offset
> +      off_t rel_offset = (offset - fp->_old_offset
>  			      + (fp->_IO_read_end - fp->_IO_read_base));

Reindent.

> @@ -860,7 +860,7 @@ _IO_wfile_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
>    if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
>        && !_IO_in_backup (fp))
>      {
> -      _IO_off64_t start_offset = (fp->_offset
> +      off64_t start_offset = (fp->_offset
>  				  - (fp->_IO_read_end - fp->_IO_buf_base));

Reindent.

> @@ -280,21 +280,21 @@ __wunderflow (_IO_FILE *fp)
>  libc_hidden_def (__wunderflow)
>  
>  
> -_IO_size_t
> -_IO_wdefault_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
> +size_t
> +_IO_wdefault_xsputn (FILE *f, const void *data, size_t n)
>  {
>    const wchar_t *s = (const wchar_t *) data;
> -  _IO_size_t more = n;
> +  size_t more = n;
>    if (more <= 0)
>      return 0;
>    for (;;)
>      {
>        /* Space available. */
> -      _IO_ssize_t count = (f->_wide_data->_IO_write_end
> +      ssize_t count = (f->_wide_data->_IO_write_end
>  			   - f->_wide_data->_IO_write_ptr);

Reindent.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 3/6] Remove legacy configuration knobs from libio.
  2018-02-11 17:45 ` [PATCH 3/6] Remove legacy configuration knobs from libio Zack Weinberg
@ 2018-02-11 18:07   ` Andreas Schwab
  2018-02-12 11:41   ` Adhemerval Zanella
  1 sibling, 0 replies; 29+ messages in thread
From: Andreas Schwab @ 2018-02-11 18:07 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: libc-alpha, fweimer, adhemerval.zanella

On Feb 11 2018, Zack Weinberg <zackw@panix.com> wrote:

> 	* libio/libio.h (_IO_UNIFIED_JUMPTABLES, _STDIO_USES_IOSTREAM)
> 	(__HAVE_COLUMN, _IO_BE): Don't define.
> 	(_IO_peekc_unlocked, _IO_getwc_unlocked, _IO_putwc_unlocked)
> 	(_IO_fwide_maybe_incompatible): Use __glibc_unlikely.
> 	* libio/libioP.h (EOF): Don't define.
> 	* libio/iofdopen.c, libio/iofopen.c, libio/iopopen.c
> 	* libio/iovdprintf.c, libio/oldiofdopen.c, libio/oldiofopen.c
> 	* libio/oldiopopen.c, debug/vdprintf_chk.c: Remove #if block
>         testing _IO_UNIFIED_JUMPTABLES.
 ^^^^^^^^^ tab

Ok.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 4/6] Remove _IO_file_flags define.
  2018-02-11 17:52 ` [PATCH 4/6] Remove _IO_file_flags define Zack Weinberg
@ 2018-02-11 18:20   ` Andreas Schwab
  0 siblings, 0 replies; 29+ messages in thread
From: Andreas Schwab @ 2018-02-11 18:20 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: libc-alpha, fweimer, adhemerval.zanella

On Feb 11 2018, Zack Weinberg <zackw@panix.com> wrote:

> 	* libio/libio.h (_IO_file_flags): Remove macro.
>         All uses changed to _flags.

Ok.

> diff --git a/debug/fgets_chk.c b/debug/fgets_chk.c
> index f2236533700..d86454f3e81 100644
> --- a/debug/fgets_chk.c
> +++ b/debug/fgets_chk.c
> @@ -40,12 +40,12 @@ __fgets_chk (char *buf, size_t size, int n, FILE *fp)
>    /* This is very tricky since a file descriptor may be in the
>       non-blocking mode. The error flag doesn't mean much in this
>       case. We return an error only when there is a new error. */
> -  int old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
> -  fp->_IO_file_flags &= ~_IO_ERR_SEEN;
> +  int old_error = fp->_flags & _IO_ERR_SEEN;
> +  fp->_flags &= ~_IO_ERR_SEEN;
>    count = _IO_getline (fp, buf, MIN ((size_t) n - 1, size), '\n', 1);
>    /* If we read in some bytes and errno is EAGAIN, that error will
>       be reported for next read. */
> -  if (count == 0 || ((fp->_IO_file_flags & _IO_ERR_SEEN)
> +  if (count == 0 || ((fp->_flags & _IO_ERR_SEEN)
>  		     && errno != EAGAIN))

Could be unfolded.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-11 16:36 ` [PATCH 5/6] Remove miscellaneous debris from libio Zack Weinberg
@ 2018-02-11 18:39   ` Andreas Schwab
  2018-02-11 19:06     ` Zack Weinberg
                       ` (2 more replies)
  2018-02-13 16:56   ` Zack Weinberg
  2018-02-19 17:41   ` Florian Weimer
  2 siblings, 3 replies; 29+ messages in thread
From: Andreas Schwab @ 2018-02-11 18:39 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: libc-alpha, fweimer, adhemerval.zanella

On Feb 11 2018, Zack Weinberg <zackw@panix.com> wrote:

> diff --git a/libio/fileops.c b/libio/fileops.c
> index fb39bec63cd..618c0d5c311 100644
> --- a/libio/fileops.c
> +++ b/libio/fileops.c
> @@ -468,11 +468,6 @@ int
>  _IO_new_file_underflow (FILE *fp)
>  {
>    ssize_t count;
> -#if 0
> -  /* SysV does not make this test; take it out for compatibility */
> -  if (fp->_flags & _IO_EOF_SEEN)
> -    return (EOF);
> -#endif

AFAICS, this is an area where we are not conforming to the C standard
(the EOF indicator is supposed to be sticking, see fgetc, and only
clearerr can fix that).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-11 18:39   ` Andreas Schwab
@ 2018-02-11 19:06     ` Zack Weinberg
  2018-02-11 19:32       ` Andreas Schwab
  2018-02-12 16:39     ` Joseph Myers
  2018-02-19 19:12     ` Florian Weimer
  2 siblings, 1 reply; 29+ messages in thread
From: Zack Weinberg @ 2018-02-11 19:06 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: GNU C Library, Florian Weimer, Adhemerval Zanella

On Sun, Feb 11, 2018 at 1:07 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> On Feb 11 2018, Zack Weinberg <zackw@panix.com> wrote:
>
>> diff --git a/libio/fileops.c b/libio/fileops.c
>> index fb39bec63cd..618c0d5c311 100644
>> --- a/libio/fileops.c
>> +++ b/libio/fileops.c
>> @@ -468,11 +468,6 @@ int
>>  _IO_new_file_underflow (FILE *fp)
>>  {
>>    ssize_t count;
>> -#if 0
>> -  /* SysV does not make this test; take it out for compatibility */
>> -  if (fp->_flags & _IO_EOF_SEEN)
>> -    return (EOF);
>> -#endif
>
> AFAICS, this is an area where we are not conforming to the C standard
> (the EOF indicator is supposed to be sticking, see fgetc, and only
> clearerr can fix that).

Yes, I think you're right.  I would generally be in favor of changing
to conform; the BSD lineage was always conformant and I think
compatibility with those is more important than compatibility with
legacy SysV nowadays.  And we're already contemplating a bunch of
stdio-related changes in this release cycle, so now is a good time.

I don't want to make any behavioral changes in this patch series,
though, and if I changed it I'd need to write a test case and that
looks nontrivial right now, so what I'll do is leave those #if 0
blocks in place and maybe come back to it in a separate discussion.
Sound good?

zw

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-11 19:06     ` Zack Weinberg
@ 2018-02-11 19:32       ` Andreas Schwab
  0 siblings, 0 replies; 29+ messages in thread
From: Andreas Schwab @ 2018-02-11 19:32 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: GNU C Library, Florian Weimer, Adhemerval Zanella

On Feb 11 2018, Zack Weinberg <zackw@panix.com> wrote:

> I don't want to make any behavioral changes in this patch series,
> though, and if I changed it I'd need to write a test case and that
> looks nontrivial right now, so what I'll do is leave those #if 0
> blocks in place and maybe come back to it in a separate discussion.
> Sound good?

Yes, that is what I had in mind.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 3/6] Remove legacy configuration knobs from libio.
  2018-02-11 17:45 ` [PATCH 3/6] Remove legacy configuration knobs from libio Zack Weinberg
  2018-02-11 18:07   ` Andreas Schwab
@ 2018-02-12 11:41   ` Adhemerval Zanella
  1 sibling, 0 replies; 29+ messages in thread
From: Adhemerval Zanella @ 2018-02-12 11:41 UTC (permalink / raw)
  To: Zack Weinberg, libc-alpha; +Cc: fweimer



On 11/02/2018 14:35, Zack Weinberg wrote:
> This patch eliminates the "compatibility defines"
> _IO_UNIFIED_JUMPTABLES (always defined to 1, used in a number of #ifs
> which are therefore always false), _STDIO_USES_IOSTREAM (unused),
> __HAVE_COLUMN (unused), _IO_BE (replaced with __glibc_unlikely), and
> yet another redundant definition of EOF.
> 
> 	* libio/libio.h (_IO_UNIFIED_JUMPTABLES, _STDIO_USES_IOSTREAM)
> 	(__HAVE_COLUMN, _IO_BE): Don't define.
> 	(_IO_peekc_unlocked, _IO_getwc_unlocked, _IO_putwc_unlocked)
> 	(_IO_fwide_maybe_incompatible): Use __glibc_unlikely.
> 	* libio/libioP.h (EOF): Don't define.
> 	* libio/iofdopen.c, libio/iofopen.c, libio/iopopen.c
> 	* libio/iovdprintf.c, libio/oldiofdopen.c, libio/oldiofopen.c
> 	* libio/oldiopopen.c, debug/vdprintf_chk.c: Remove #if block
>         testing _IO_UNIFIED_JUMPTABLES.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  debug/vdprintf_chk.c |  3 ---
>  libio/iofdopen.c     |  3 ---
>  libio/iofopen.c      |  3 ---
>  libio/iopopen.c      |  3 ---
>  libio/iovdprintf.c   |  3 ---
>  libio/libio.h        | 36 ++++++++++++++----------------------
>  libio/libioP.h       |  4 ----
>  libio/oldiofdopen.c  |  3 ---
>  libio/oldiofopen.c   |  3 ---
>  libio/oldiopopen.c   |  3 ---
>  10 files changed, 14 insertions(+), 50 deletions(-)
> 
> diff --git a/debug/vdprintf_chk.c b/debug/vdprintf_chk.c
> index c195a7951e0..bc713b49628 100644
> --- a/debug/vdprintf_chk.c
> +++ b/debug/vdprintf_chk.c
> @@ -40,9 +40,6 @@ __vdprintf_chk (int d, int flags, const char *format, va_list arg)
>    _IO_no_init (&tmpfil.file, _IO_USER_LOCK, 0, &wd, &_IO_wfile_jumps);
>    _IO_JUMPS (&tmpfil) = &_IO_file_jumps;
>    _IO_new_file_init_internal (&tmpfil);
> -#if  !_IO_UNIFIED_JUMPTABLES
> -  tmpfil.vtable = NULL;
> -#endif
>    if (_IO_file_attach (&tmpfil.file, d) == NULL)
>      {
>        _IO_un_link (&tmpfil);

Ok.

> diff --git a/libio/iofdopen.c b/libio/iofdopen.c
> index 39617365f53..21a53e30f6c 100644
> --- a/libio/iofdopen.c
> +++ b/libio/iofdopen.c
> @@ -137,9 +137,6 @@ _IO_new_fdopen (int fd, const char *mode)
>  #endif
>        &_IO_file_jumps;
>    _IO_new_file_init_internal (&new_f->fp);
> -#if  !_IO_UNIFIED_JUMPTABLES
> -  new_f->fp.vtable = NULL;
> -#endif
>    /* We only need to record the fd because _IO_file_init_internal will
>       have unset the offset.  It is important to unset the cached
>       offset because the real offset in the file could change between

Ok.

> diff --git a/libio/iofopen.c b/libio/iofopen.c
> index f17ec914579..ed3e8b853c6 100644
> --- a/libio/iofopen.c
> +++ b/libio/iofopen.c
> @@ -72,9 +72,6 @@ __fopen_internal (const char *filename, const char *mode, int is32)
>    _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
>    _IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
>    _IO_new_file_init_internal (&new_f->fp);
> -#if  !_IO_UNIFIED_JUMPTABLES
> -  new_f->fp.vtable = NULL;
> -#endif
>    if (_IO_file_fopen ((FILE *) new_f, filename, mode, is32) != NULL)
>      return __fopen_maybe_mmap (&new_f->fp.file);
>  

Ok.

> diff --git a/libio/iopopen.c b/libio/iopopen.c
> index efdd0a6f586..2eff45b4c80 100644
> --- a/libio/iopopen.c
> +++ b/libio/iopopen.c
> @@ -200,9 +200,6 @@ _IO_new_popen (const char *command, const char *mode)
>    _IO_init_internal (fp, 0);
>    _IO_JUMPS (&new_f->fpx.file) = &_IO_proc_jumps;
>    _IO_new_file_init_internal (&new_f->fpx.file);
> -#if  !_IO_UNIFIED_JUMPTABLES
> -  new_f->fpx.file.vtable = NULL;
> -#endif
>    if (_IO_new_proc_open (fp, command, mode) != NULL)
>      return (FILE *) &new_f->fpx.file;
>    _IO_un_link (&new_f->fpx.file);

Ok.

> diff --git a/libio/iovdprintf.c b/libio/iovdprintf.c
> index 78df2fe559b..78a3a2bd159 100644
> --- a/libio/iovdprintf.c
> +++ b/libio/iovdprintf.c
> @@ -40,9 +40,6 @@ _IO_vdprintf (int d, const char *format, va_list arg)
>    _IO_no_init (&tmpfil.file, _IO_USER_LOCK, 0, &wd, &_IO_wfile_jumps);
>    _IO_JUMPS (&tmpfil) = &_IO_file_jumps;
>    _IO_new_file_init_internal (&tmpfil);
> -#if  !_IO_UNIFIED_JUMPTABLES
> -  tmpfil.vtable = NULL;
> -#endif
>    if (_IO_file_attach (&tmpfil.file, d) == NULL)
>      {
>        _IO_un_link (&tmpfil);

Ok.

> diff --git a/libio/libio.h b/libio/libio.h
> index 890b825ed86..a3c679ca666 100644
> --- a/libio/libio.h
> +++ b/libio/libio.h
> @@ -61,9 +61,6 @@ typedef union
>  #include <shlib-compat.h>
>  
>  /* compatibility defines */
> -#define _STDIO_USES_IOSTREAM
> -#define _IO_UNIFIED_JUMPTABLES 1
> -#define __HAVE_COLUMN
>  #define _IO_file_flags _flags
>  

Ok.

>  /* open modes */
> @@ -228,28 +225,23 @@ extern wint_t __wunderflow (FILE *);
>  extern wint_t __wuflow (FILE *);
>  extern wint_t __woverflow (FILE *, wint_t);
>  
> -#if  __GNUC__ >= 3
> -# define _IO_BE(expr, res) __builtin_expect ((expr), res)
> -#else
> -# define _IO_BE(expr, res) (expr)
> -#endif
> -
>  #define _IO_getc_unlocked(_fp) __getc_unlocked_body (_fp)
> -#define _IO_peekc_unlocked(_fp) \
> -       (_IO_BE ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end, 0) \
> -	  && __underflow (_fp) == EOF ? EOF \
> -	: *(unsigned char *) (_fp)->_IO_read_ptr)
> +#define _IO_peekc_unlocked(_fp)						\
> +  (__glibc_unlikely ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end)	\
> +   && __underflow (_fp) == EOF						\
> +   ? EOF								\
> +   : *(unsigned char *) (_fp)->_IO_read_ptr)
>  #define _IO_putc_unlocked(_ch, _fp) __putc_unlocked_body (_ch, _fp)
>  
> -# define _IO_getwc_unlocked(_fp) \
> -  (_IO_BE ((_fp)->_wide_data == NULL					\
> -	   || ((_fp)->_wide_data->_IO_read_ptr				\
> -	       >= (_fp)->_wide_data->_IO_read_end), 0)			\
> +# define _IO_getwc_unlocked(_fp)					\
> +  (__glibc_unlikely ((_fp)->_wide_data == NULL				\
> +		     || ((_fp)->_wide_data->_IO_read_ptr		\
> +			 >= (_fp)->_wide_data->_IO_read_end))		\
>     ? __wuflow (_fp) : (wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
> -# define _IO_putwc_unlocked(_wch, _fp) \
> -  (_IO_BE ((_fp)->_wide_data == NULL					\
> -	   || ((_fp)->_wide_data->_IO_write_ptr				\
> -	       >= (_fp)->_wide_data->_IO_write_end), 0)			\
> +# define _IO_putwc_unlocked(_wch, _fp)					\
> +  (__glibc_unlikely ((_fp)->_wide_data == NULL				\
> +		     || ((_fp)->_wide_data->_IO_write_ptr		\
> +			 >= (_fp)->_wide_data->_IO_write_end))		\
>     ? __woverflow (_fp, _wch)						\
>     : (wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
>  

Ok.

> @@ -304,7 +296,7 @@ extern int _IO_fwide (FILE *__fp, int __mode) __THROW;
>  
>  #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
>  #  define _IO_fwide_maybe_incompatible \
> -  (__builtin_expect (&_IO_stdin_used == NULL, 0))
> +  (__glibc_unlikely (&_IO_stdin_used == NULL))
>  extern const int _IO_stdin_used;
>  weak_extern (_IO_stdin_used);
>  #else

Ok.

> diff --git a/libio/libioP.h b/libio/libioP.h
> index 57fd60567c7..5064bdf69d4 100644
> --- a/libio/libioP.h
> +++ b/libio/libioP.h
> @@ -690,10 +690,6 @@ extern off64_t _IO_seekoff_unlocked (FILE *, off64_t, int, int)
>  extern off64_t _IO_seekpos_unlocked (FILE *, off64_t, int)
>       attribute_hidden;
>  
> -#ifndef EOF
> -# define EOF (-1)
> -#endif
> -
>  #if _G_HAVE_MMAP
>  
>  # include <unistd.h>

Ok.

> diff --git a/libio/oldiofdopen.c b/libio/oldiofdopen.c
> index be670e8da4d..17930c2786f 100644
> --- a/libio/oldiofdopen.c
> +++ b/libio/oldiofdopen.c
> @@ -102,9 +102,6 @@ _IO_old_fdopen (int fd, const char *mode)
>    _IO_old_init (&new_f->fp.file._file, 0);
>    _IO_JUMPS_FILE_plus (&new_f->fp) = &_IO_old_file_jumps;
>    _IO_old_file_init_internal ((struct _IO_FILE_plus *) &new_f->fp);
> -#if  !_IO_UNIFIED_JUMPTABLES
> -  new_f->fp.vtable = NULL;
> -#endif
>    if (_IO_old_file_attach (&new_f->fp.file._file, fd) == NULL)
>      {
>        _IO_un_link ((struct _IO_FILE_plus *) &new_f->fp);

Ok.

> diff --git a/libio/oldiofopen.c b/libio/oldiofopen.c
> index f4ead0c1299..f0a67104fb0 100644
> --- a/libio/oldiofopen.c
> +++ b/libio/oldiofopen.c
> @@ -52,9 +52,6 @@ _IO_old_fopen (const char *filename, const char *mode)
>    _IO_old_init (&new_f->fp.file._file, 0);
>    _IO_JUMPS_FILE_plus (&new_f->fp) = &_IO_old_file_jumps;
>    _IO_old_file_init_internal ((struct _IO_FILE_plus *) &new_f->fp);
> -#if  !_IO_UNIFIED_JUMPTABLES
> -  new_f->fp.vtable = NULL;
> -#endif
>    if (_IO_old_file_fopen ((FILE *) &new_f->fp, filename, mode) != NULL)
>      return (FILE *) &new_f->fp;
>    _IO_un_link ((struct _IO_FILE_plus *) &new_f->fp);

Ok.

> diff --git a/libio/oldiopopen.c b/libio/oldiopopen.c
> index 42cab4e8f77..e47965db0ac 100644
> --- a/libio/oldiopopen.c
> +++ b/libio/oldiopopen.c
> @@ -157,9 +157,6 @@ _IO_old_popen (const char *command, const char *mode)
>    _IO_old_init (fp, 0);
>    _IO_JUMPS_FILE_plus (&new_f->fpx.file) = &_IO_old_proc_jumps;
>    _IO_old_file_init_internal ((struct _IO_FILE_plus *) &new_f->fpx.file);
> -#if  !_IO_UNIFIED_JUMPTABLES
> -  new_f->fpx.file.vtable = NULL;
> -#endif
>    if (_IO_old_proc_open (fp, command, mode) != NULL)
>      return fp;
>    _IO_un_link ((struct _IO_FILE_plus *) &new_f->fpx.file);
> 

Ok.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 6/6] Remove completely unused libio flag bits.
  2018-02-11 16:36 ` [PATCH 6/6] Remove completely unused libio flag bits Zack Weinberg
@ 2018-02-12 12:42   ` Adhemerval Zanella
  0 siblings, 0 replies; 29+ messages in thread
From: Adhemerval Zanella @ 2018-02-12 12:42 UTC (permalink / raw)
  To: Zack Weinberg, libc-alpha; +Cc: fweimer



On 11/02/2018 14:35, Zack Weinberg wrote:
> These macros are used literally nowhere in the source tree, and all
> of them appear to relate to the C++ functionality of the original
> libio that never got taken into glibc in the first place.  I also
> reformatted the first set of flags to make it really obvious which
> bits are not used (there's one bit that never gets set by current
> code but might get set by old code).
> 
> This is as far as I propose to go in this patchset.  The next most
> pressing changes are to eliminate _IO_MTSAFE_IO and to start removing
> support for deprecated-but-exported _IO_ symbols, and both of those I
> believe Florian has already been working on, so I'll leave them to
> him.
> 
> 	* libio/libio.h (_IOS_ATEND, _IOS_APPEND, _IOS_TRUNC)
> 	(_IOS_NOCREATE, _IOS_NOREPLACE, _IOS_BIN, _OLD_STDIO_MAGIC)
> 	(_IO_SKIPWS, _IO_LEFT, _IO_RIGHT, _IO_INTERNAL, _IO_DEC)
> 	(_IO_OCT, _IO_HEX, _IO_SHOWBASE, _IO_SHOWPOINT, _IO_UPPERCASE)
> 	(_IO_SHOWPOS, _IO_SCIENTIFIC, _IO_FIXED, _IO_UNITBUF, _IO_STDIO)
> 	(_IO_DONT_CLOSE, _IO_BOOLALPHA): Remove, unused.
> 	(_IO_BAD_SEEN): Comment out but leave as documentation.
> 	Reformat bit flags for _flags field to make occupancy clearer.
> 	Update commentary.
> 	* libio/bits/types/struct_FILE.h (_IO_EOF_SEEN, _IO_ERR_SEEN):
> 	Keep definitions consistent with those in libio/libio.h.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  libio/bits/types/struct_FILE.h |  4 +--
>  libio/libio.h                  | 77 ++++++++++++++----------------------------
>  2 files changed, 27 insertions(+), 54 deletions(-)
> 
> diff --git a/libio/bits/types/struct_FILE.h b/libio/bits/types/struct_FILE.h
> index a120c762685..359f9494534 100644
> --- a/libio/bits/types/struct_FILE.h
> +++ b/libio/bits/types/struct_FILE.h
> @@ -108,10 +108,10 @@ struct _IO_FILE_complete
>     ? __overflow (_fp, (unsigned char) (_ch))				\
>     : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))
>  
> -#define _IO_EOF_SEEN 0x10
> +#define _IO_EOF_SEEN 0x0010
>  #define __feof_unlocked_body(_fp) (((_fp)->_flags & _IO_EOF_SEEN) != 0)
>  
> -#define _IO_ERR_SEEN 0x20
> +#define _IO_ERR_SEEN 0x0020
>  #define __ferror_unlocked_body(_fp) (((_fp)->_flags & _IO_ERR_SEEN) != 0)
>  
>  #define _IO_USER_LOCK 0x8000

Ok.

> diff --git a/libio/libio.h b/libio/libio.h
> index 1371161e025..b25e583a794 100644
> --- a/libio/libio.h
> +++ b/libio/libio.h
> @@ -60,42 +60,34 @@ typedef union
>  
>  #include <shlib-compat.h>
>  
> -/* open modes */
> +/* _IO_seekoff modes */
>  #define _IOS_INPUT	1
>  #define _IOS_OUTPUT	2
> -#define _IOS_ATEND	4
> -#define _IOS_APPEND	8
> -#define _IOS_TRUNC	16
> -#define _IOS_NOCREATE	32
> -#define _IOS_NOREPLACE	64
> -#define _IOS_BIN	128
> -
> -/* Magic numbers and bits for the _flags field.
> -   The magic numbers use the high-order bits of _flags;
> -   the remaining bits are available for variable flags.
> -   Note: The magic numbers must all be negative if stdio
> -   emulation is desired. */
> -
> -#define _IO_MAGIC 0xFBAD0000 /* Magic number */
> -#define _OLD_STDIO_MAGIC 0xFABC0000 /* Emulate old stdio. */
> -#define _IO_MAGIC_MASK 0xFFFF0000
> -#define _IO_USER_BUF 1 /* User owns buffer; don't delete it on close. */
> -#define _IO_UNBUFFERED 2
> -#define _IO_NO_READS 4 /* Reading not allowed */
> -#define _IO_NO_WRITES 8 /* Writing not allowd */
> -#define _IO_EOF_SEEN 0x10
> -#define _IO_ERR_SEEN 0x20
> -#define _IO_DELETE_DONT_CLOSE 0x40 /* Don't call close(_fileno) on cleanup. */
> -#define _IO_LINKED 0x80 /* Set if linked (using _chain) to streambuf::_list_all.*/
> -#define _IO_IN_BACKUP 0x100
> -#define _IO_LINE_BUF 0x200
> -#define _IO_TIED_PUT_GET 0x400 /* Set if put and get pointer logicly tied. */
> -#define _IO_CURRENTLY_PUTTING 0x800
> -#define _IO_IS_APPENDING 0x1000
> -#define _IO_IS_FILEBUF 0x2000
> -#define _IO_BAD_SEEN 0x4000
> -#define _IO_USER_LOCK 0x8000
>  
> +/* Magic number and bits for the _flags field.  The magic number is
> +   mostly vestigial, but preserved for compatibility.  It occupies the
> +   high 16 bits of _flags; the low 16 bits are actual flag bits.  */
> +
> +#define _IO_MAGIC         0xFBAD0000 /* Magic number */
> +#define _IO_MAGIC_MASK    0xFFFF0000
> +#define _IO_USER_BUF          0x0001 /* Don't deallocate buffer on close. */
> +#define _IO_UNBUFFERED        0x0002
> +#define _IO_NO_READS          0x0004 /* Reading not allowed.  */
> +#define _IO_NO_WRITES         0x0008 /* Writing not allowed.  */
> +#define _IO_EOF_SEEN          0x0010
> +#define _IO_ERR_SEEN          0x0020
> +#define _IO_DELETE_DONT_CLOSE 0x0040 /* Don't call close(_fileno) on close.  */
> +#define _IO_LINKED            0x0080 /* In the list of all open files.  */
> +#define _IO_IN_BACKUP         0x0100
> +#define _IO_LINE_BUF          0x0200
> +#define _IO_TIED_PUT_GET      0x0400 /* Put and get pointer move in unison.  */
> +#define _IO_CURRENTLY_PUTTING 0x0800
> +#define _IO_IS_APPENDING      0x1000
> +#define _IO_IS_FILEBUF        0x2000
> +/*#define _IO_BAD_SEEN        0x4000  No longer used, reserved for compat.  */

There is no need to comment _IO_BAD_SEEN (and it add some confusion why it is
commented).

> +#define _IO_USER_LOCK         0x8000
> +
> +/* Bits for the _flags2 field.  */
>  #define _IO_FLAGS2_MMAP 1
>  #define _IO_FLAGS2_NOTCANCEL 2
>  #define _IO_FLAGS2_FORTIFY 4
> @@ -105,25 +97,6 @@ typedef union
>  #define _IO_FLAGS2_CLOEXEC 64
>  #define _IO_FLAGS2_NEED_LOCK 128
>  
> -/* These are "formatting flags" matching the iostream fmtflags enum values. */
> -#define _IO_SKIPWS 01
> -#define _IO_LEFT 02
> -#define _IO_RIGHT 04
> -#define _IO_INTERNAL 010
> -#define _IO_DEC 020
> -#define _IO_OCT 040
> -#define _IO_HEX 0100
> -#define _IO_SHOWBASE 0200
> -#define _IO_SHOWPOINT 0400
> -#define _IO_UPPERCASE 01000
> -#define _IO_SHOWPOS 02000
> -#define _IO_SCIENTIFIC 04000
> -#define _IO_FIXED 010000
> -#define _IO_UNITBUF 020000
> -#define _IO_STDIO 040000
> -#define _IO_DONT_CLOSE 0100000
> -#define _IO_BOOLALPHA 0200000
> -
>  /* _IO_pos_BAD is an off64_t value indicating error, unknown, or EOF. */
>  #define _IO_pos_BAD ((off64_t) -1)
>  
> 

Ok.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-11 18:39   ` Andreas Schwab
  2018-02-11 19:06     ` Zack Weinberg
@ 2018-02-12 16:39     ` Joseph Myers
  2018-02-12 16:44       ` Zack Weinberg
  2018-02-19 19:12     ` Florian Weimer
  2 siblings, 1 reply; 29+ messages in thread
From: Joseph Myers @ 2018-02-12 16:39 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Zack Weinberg, libc-alpha, fweimer, adhemerval.zanella

On Sun, 11 Feb 2018, Andreas Schwab wrote:

> AFAICS, this is an area where we are not conforming to the C standard
> (the EOF indicator is supposed to be sticking, see fgetc, and only
> clearerr can fix that).

This is bug 1190.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-12 16:39     ` Joseph Myers
@ 2018-02-12 16:44       ` Zack Weinberg
  0 siblings, 0 replies; 29+ messages in thread
From: Zack Weinberg @ 2018-02-12 16:44 UTC (permalink / raw)
  To: Joseph Myers
  Cc: Andreas Schwab, GNU C Library, Florian Weimer, Adhemerval Zanella

On Mon, Feb 12, 2018 at 11:37 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Sun, 11 Feb 2018, Andreas Schwab wrote:
>
>> AFAICS, this is an area where we are not conforming to the C standard
>> (the EOF indicator is supposed to be sticking, see fgetc, and only
>> clearerr can fix that).
>
> This is bug 1190.

Funny you should mention that ...

zw

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-11 16:36 ` [PATCH 5/6] Remove miscellaneous debris from libio Zack Weinberg
  2018-02-11 18:39   ` Andreas Schwab
@ 2018-02-13 16:56   ` Zack Weinberg
  2018-02-19 17:41   ` Florian Weimer
  2 siblings, 0 replies; 29+ messages in thread
From: Zack Weinberg @ 2018-02-13 16:56 UTC (permalink / raw)
  To: GNU C Library; +Cc: Florian Weimer, Adhemerval Zanella

On Sun, Feb 11, 2018 at 11:35 AM, Zack Weinberg <zackw@panix.com> wrote:
> This patch eliminates a number of #if 0 and #ifdef TODO blocks, macros
> that are never used, macros that provide portability to substrates that
> lack basic things like EINVAL and off_t, and other such debris.

Apart from Andreas' comment about the lack of sticky EOF, this patch
doesn't appear to have been reviewed; all the other patches in the
series have been reviewed, so would anyone like to step up and look at
this one?

zw

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-11 16:36 ` [PATCH 5/6] Remove miscellaneous debris from libio Zack Weinberg
  2018-02-11 18:39   ` Andreas Schwab
  2018-02-13 16:56   ` Zack Weinberg
@ 2018-02-19 17:41   ` Florian Weimer
  2018-02-21 21:25     ` Zack Weinberg
  2 siblings, 1 reply; 29+ messages in thread
From: Florian Weimer @ 2018-02-19 17:41 UTC (permalink / raw)
  To: Zack Weinberg, libc-alpha; +Cc: adhemerval.zanella

On 02/11/2018 05:35 PM, Zack Weinberg wrote:
> -#if 0 /* Work in progress */
> -/* Seems not to be needed.  */
> -#if 0
> -void
> -_IO_set_column (FILE *fp, int c)

I'm glad that's gone.  8-P

The rest of the patch is okay, except I'm not sure if moving around this 
comment is the right thing:

> +/* Does not actually test that stream was created by popen(). Instead,
> +   it depends on the filebuf::sys_close() virtual to Do The Right Thing. */

It doesn't look very informative and completely up-to-date to me.  But I 
don't think it's a good use of our time to dwell on this.

Do fclose and pclose have to have different addresses?  We could make 
them aliases.


Thanks,
Florian

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-11 18:39   ` Andreas Schwab
  2018-02-11 19:06     ` Zack Weinberg
  2018-02-12 16:39     ` Joseph Myers
@ 2018-02-19 19:12     ` Florian Weimer
  2018-02-19 20:10       ` Zack Weinberg
  2018-02-20  0:18       ` Andreas Schwab
  2 siblings, 2 replies; 29+ messages in thread
From: Florian Weimer @ 2018-02-19 19:12 UTC (permalink / raw)
  To: Andreas Schwab, Zack Weinberg; +Cc: libc-alpha, adhemerval.zanella

On 02/11/2018 07:07 PM, Andreas Schwab wrote:
> AFAICS, this is an area where we are not conforming to the C standard
> (the EOF indicator is supposed to be sticking, see fgetc, and only
> clearerr can fix that).

But is this actually observable without violating any of the stream 
synchronization requirements, or relying on implementation-defined 
behavior of file descriptors?

I'm not convinced that the current behavior is actually non-compliant.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-19 19:12     ` Florian Weimer
@ 2018-02-19 20:10       ` Zack Weinberg
  2018-02-19 21:29         ` Florian Weimer
  2018-02-20  0:18       ` Andreas Schwab
  1 sibling, 1 reply; 29+ messages in thread
From: Zack Weinberg @ 2018-02-19 20:10 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Andreas Schwab, GNU C Library, Adhemerval Zanella

On Mon, Feb 19, 2018 at 1:32 PM, Florian Weimer <fweimer@redhat.com> wrote:
> On 02/11/2018 07:07 PM, Andreas Schwab wrote:
>>
>> AFAICS, this is an area where we are not conforming to the C standard
>> (the EOF indicator is supposed to be sticking, see fgetc, and only
>> clearerr can fix that).
>
>
> But is this actually observable without violating any of the stream
> synchronization requirements, or relying on implementation-defined behavior
> of file descriptors?

I think so, see the test case in
https://sourceware.org/ml/libc-alpha/2018-02/msg00420.html .

zw

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-19 20:10       ` Zack Weinberg
@ 2018-02-19 21:29         ` Florian Weimer
  0 siblings, 0 replies; 29+ messages in thread
From: Florian Weimer @ 2018-02-19 21:29 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Andreas Schwab, GNU C Library, Adhemerval Zanella

On 02/19/2018 08:12 PM, Zack Weinberg wrote:
> On Mon, Feb 19, 2018 at 1:32 PM, Florian Weimer <fweimer@redhat.com> wrote:
>> On 02/11/2018 07:07 PM, Andreas Schwab wrote:
>>>
>>> AFAICS, this is an area where we are not conforming to the C standard
>>> (the EOF indicator is supposed to be sticking, see fgetc, and only
>>> clearerr can fix that).
>>
>>
>> But is this actually observable without violating any of the stream
>> synchronization requirements, or relying on implementation-defined behavior
>> of file descriptors?
> 
> I think so, see the test case in
> https://sourceware.org/ml/libc-alpha/2018-02/msg00420.html .

Do you mean the on in this patch:

   https://sourceware.org/ml/libc-alpha/2018-02/msg00416.html

I believe the test case is invalid because interleaving file access in 
this way requires that fseek is used before reading any data, and this 
will clear the EOF indicator.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-19 19:12     ` Florian Weimer
  2018-02-19 20:10       ` Zack Weinberg
@ 2018-02-20  0:18       ` Andreas Schwab
  2018-02-20 10:26         ` Florian Weimer
  1 sibling, 1 reply; 29+ messages in thread
From: Andreas Schwab @ 2018-02-20  0:18 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Zack Weinberg, libc-alpha, adhemerval.zanella

On Feb 19 2018, Florian Weimer <fweimer@redhat.com> wrote:

> But is this actually observable without violating any of the stream
> synchronization requirements, or relying on implementation-defined
> behavior of file descriptors?

Just point the stream to a tty and type an EOF character.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-20  0:18       ` Andreas Schwab
@ 2018-02-20 10:26         ` Florian Weimer
  2018-02-20 18:38           ` Andreas Schwab
  0 siblings, 1 reply; 29+ messages in thread
From: Florian Weimer @ 2018-02-20 10:26 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Zack Weinberg, libc-alpha, adhemerval.zanella

On 02/19/2018 09:10 PM, Andreas Schwab wrote:
> On Feb 19 2018, Florian Weimer <fweimer@redhat.com> wrote:
> 
>> But is this actually observable without violating any of the stream
>> synchronization requirements, or relying on implementation-defined
>> behavior of file descriptors?
> 
> Just point the stream to a tty and type an EOF character.

Shouldn't fgetc block and wait for more characters in this case?

Thanks,
Florian

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-20 10:26         ` Florian Weimer
@ 2018-02-20 18:38           ` Andreas Schwab
  0 siblings, 0 replies; 29+ messages in thread
From: Andreas Schwab @ 2018-02-20 18:38 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Zack Weinberg, libc-alpha, adhemerval.zanella

On Feb 20 2018, Florian Weimer <fweimer@redhat.com> wrote:

> On 02/19/2018 09:10 PM, Andreas Schwab wrote:
>> On Feb 19 2018, Florian Weimer <fweimer@redhat.com> wrote:
>>
>>> But is this actually observable without violating any of the stream
>>> synchronization requirements, or relying on implementation-defined
>>> behavior of file descriptors?
>>
>> Just point the stream to a tty and type an EOF character.
>
> Shouldn't fgetc block and wait for more characters in this case?

No, it should get EOF immediately, since that is supposed to be sticky.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 0/6] Mostly mechanical libio decrufting.
  2018-02-11 16:36 [PATCH 0/6] Mostly mechanical libio decrufting Zack Weinberg
                   ` (5 preceding siblings ...)
  2018-02-11 17:52 ` [PATCH 4/6] Remove _IO_file_flags define Zack Weinberg
@ 2018-02-21 21:25 ` Zack Weinberg
  6 siblings, 0 replies; 29+ messages in thread
From: Zack Weinberg @ 2018-02-21 21:25 UTC (permalink / raw)
  To: GNU C Library

On Sun, Feb 11, 2018 at 11:35 AM, Zack Weinberg <zackw@panix.com> wrote:
> This patch set performs a number of largely search-and-replace
> cleanups to libio enabled by libio.h no longer being a public header.
> It includes all of the follow-up changes requested by Adhemerval for
> the patchset that stopped installing libio.h.
>
> Every patch in this series meets the "installed stripped binaries are
> unchanged" criterion, except for a handful of assertions whose line
> numbers change.

I have made all the changes requested by reviewers and pushed this
patchset.  I'd like to thank Andreas Schwab especially, for going to
the trouble to find indentation errors in a huge diff.

zw

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-19 17:41   ` Florian Weimer
@ 2018-02-21 21:25     ` Zack Weinberg
  2018-02-21 23:24       ` Joseph Myers
  0 siblings, 1 reply; 29+ messages in thread
From: Zack Weinberg @ 2018-02-21 21:25 UTC (permalink / raw)
  To: Florian Weimer; +Cc: GNU C Library, Adhemerval Zanella

On Mon, Feb 19, 2018 at 12:01 PM, Florian Weimer <fweimer@redhat.com> wrote:
> On 02/11/2018 05:35 PM, Zack Weinberg wrote:
>> +/* Does not actually test that stream was created by popen(). Instead,
>> +   it depends on the filebuf::sys_close() virtual to Do The Right Thing.
>> */
>
> It doesn't look very informative and completely up-to-date to me.  But I
> don't think it's a good use of our time to dwell on this.

I think it's useful to remark that POSIX doesn't require us to check
that a stream passed to pclose was created by popen (or that a stream
passed to fclose was created by fopen).  I changed the comment to say
that, and to refer to _IO_SYSCLOSE instead of "the filebuf::sys_close
virtual".

> Do fclose and pclose have to have different addresses?  We could make them
> aliases.

I don't know how to find out the answer to this question.  We do make
fputc and putc have the same address...

zw

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/6] Remove miscellaneous debris from libio.
  2018-02-21 21:25     ` Zack Weinberg
@ 2018-02-21 23:24       ` Joseph Myers
  0 siblings, 0 replies; 29+ messages in thread
From: Joseph Myers @ 2018-02-21 23:24 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Florian Weimer, GNU C Library, Adhemerval Zanella

On Wed, 21 Feb 2018, Zack Weinberg wrote:

> > Do fclose and pclose have to have different addresses?  We could make them
> > aliases.
> 
> I don't know how to find out the answer to this question.  We do make
> fputc and putc have the same address...

The question of explicitly allowing aliasing between different standard 
library functions with the same type (I think it's clearly allowed between 
functions with different types, simply because of the limitations of what 
you can do with a function pointer converted to a different type) is on my 
list of issues to raise formally with WG14 papers for C2x.

The footnote "There is no linkage between different identifiers." is not 
normative and can reasonably be interpreted as meaning "there is no way in 
standard C to declare there to be a linkage between different identifiers" 
without saying anything about how such linkage might be created for 
standard library functions that aren't in standard C.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2018-02-21 22:39 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-11 16:36 [PATCH 0/6] Mostly mechanical libio decrufting Zack Weinberg
2018-02-11 16:36 ` [PATCH 1/6] Remove vestiges of external build support from libio headers Zack Weinberg
2018-02-11 17:54   ` Andreas Schwab
2018-02-11 16:36 ` [PATCH 5/6] Remove miscellaneous debris from libio Zack Weinberg
2018-02-11 18:39   ` Andreas Schwab
2018-02-11 19:06     ` Zack Weinberg
2018-02-11 19:32       ` Andreas Schwab
2018-02-12 16:39     ` Joseph Myers
2018-02-12 16:44       ` Zack Weinberg
2018-02-19 19:12     ` Florian Weimer
2018-02-19 20:10       ` Zack Weinberg
2018-02-19 21:29         ` Florian Weimer
2018-02-20  0:18       ` Andreas Schwab
2018-02-20 10:26         ` Florian Weimer
2018-02-20 18:38           ` Andreas Schwab
2018-02-13 16:56   ` Zack Weinberg
2018-02-19 17:41   ` Florian Weimer
2018-02-21 21:25     ` Zack Weinberg
2018-02-21 23:24       ` Joseph Myers
2018-02-11 16:36 ` [PATCH 6/6] Remove completely unused libio flag bits Zack Weinberg
2018-02-12 12:42   ` Adhemerval Zanella
2018-02-11 16:36 ` [PATCH 2/6] Mechanically remove _IO_ name aliases for types and constants Zack Weinberg
2018-02-11 17:57   ` Andreas Schwab
2018-02-11 17:45 ` [PATCH 3/6] Remove legacy configuration knobs from libio Zack Weinberg
2018-02-11 18:07   ` Andreas Schwab
2018-02-12 11:41   ` Adhemerval Zanella
2018-02-11 17:52 ` [PATCH 4/6] Remove _IO_file_flags define Zack Weinberg
2018-02-11 18:20   ` Andreas Schwab
2018-02-21 21:25 ` [PATCH 0/6] Mostly mechanical libio decrufting Zack Weinberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).