about summary refs log tree commit diff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2018-02-05 14:13:41 -0500
committerZack Weinberg <zackw@panix.com>2018-02-07 10:10:32 -0500
commit63fb8f9aa9d19f85599afe4b849b567aefd70a36 (patch)
tree607f89b682d7c7200b389cba7de7e4496806565f /sysdeps/unix/sysv
parent6c6c962a202299b55d180e04f44a63ffb748096c (diff)
downloadglibc-63fb8f9aa9d19f85599afe4b849b567aefd70a36.tar.gz
glibc-63fb8f9aa9d19f85599afe4b849b567aefd70a36.tar.xz
glibc-63fb8f9aa9d19f85599afe4b849b567aefd70a36.zip
Post-cleanup 2: minimize _G_config.h.
Nearly everything in _G_config.h is either junk or more appropriately
defined elsewhere:

 * _G_fpos_t, _G_fpos64_t, and _G_BUFSIZ are already completely unused.
 * All remaining uses of _G_va_list have been changed to __gnuc_va_list.
 * The definition of _G_HAVE_ST_BLKSIZE/_IO_HAVE_ST_BLKSIZE has
   been inlined into its sole use.
 * The complete definition of _G_iconv_t has been moved to libio.h and
   renamed _IO_iconv_t (all actual users used that name).
 * _G_IO_IO_FILE_VERSION is vestigial; some code cares whether
   _IO_stdin_used exists, but nothing looks at its value.  I've
   preserved the value as a hardwired constant in csu/init.c.
   This means csu/init.c no longer needs to include anything.
 * Many of the headers included by _G_config.h were already being
   included directly by either either libio.h or stdio.h; the
   remaining ones were moved to libio.h.
 * _G_HAVE_MREMAP is still relevant, because mremap genuinely is a
   Linux extension; it's not in POSIX and as far as I can tell it's
   not available on the Hurd either.  I also preserved _G_HAVE_MMAP,
   since it's conceivable someone would want to port glibc to a
   MMU-less, mmap-less environment in the future.  Both are now always
   defined to 1/0 as is the current convention, instead of the older
   1/undef convention.  These are the only symbols still defined in
   _G_config.h.
 * The actual inclusion of _G_config.h moves from libio.h to libioP.h,
   as this is where a potential override of _G_HAVE_MMAP happens.
 * The #ifdef logic in libioP.h controlling _IO_JUMPS_OFFSET has been
   simplified.

After this patch, the only surviving _G_ symbols are the struct tag
names _G_fpos_t and _G_fpos64_t, which are preserved for the sake of
C++ mangled names in applications, and _G_HAVE_MMAP and _G_HAVE_MREMAP,
which do not seem worth renaming.

Installed stripped libraries are unchanged by this patch.

	* bits/_G_config.h: Move back to sysdeps/generic/_G_config.h.
	Delete all contents except for definitions of _G_HAVE_MMAP and
	_G_HAVE_MREMAP.  Add commentary explaining those two symbols.
	* sysdeps/unix/sysv/linux/bits/_G_config.h: Move back to
	sysdeps/unix/sysv/linux/_G_config.h.  Make same content
	change as above.

	* libio/libio.h: Don't include bits/_G_config.h here.
	Include stddef.h with __need_wchar_t defined.  Include
	bits/types/__mbstate_t.h, bits/types/wint_t.h, and gconv.h.
	Define _IO_iconv_t here, directly.
	Don't define _IO_HAVE_ST_BLKSIZE.
	* libio/libioP.h: Include _G_config.h here.  Move include of
	shlib-compat.h up with rest of includes.  Simplify conditionals
	controlling definition of _IO_JUMPS_OFFSET.

	* csu/init.c: Remove always-true #if around entire file.
	Don't include stdio.h.  Set _IO_stdin_used to hardwired
	constant 0x20001, and update commentary.
	* include/stdio.h, sysdeps/ieee754/ldbl-opt/nldbl-compat.h:
	Replace all uses of _G_va_list with __gnuc_va_list.
	* libio/filedoalloc.c: Use #if defined _STATBUF_ST_BLKSIZE
	instead of #if _IO_HAVE_ST_BLKSIZE.
	* libio/fileops.c: Test _G_HAVE_MREMAP with #if, not #ifdef.
	* libio/iofdopen.c, libio/iofopen.c: Test _G_HAVE_MMAP with #if,
	not #ifdef.
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/_G_config.h15
-rw-r--r--sysdeps/unix/sysv/linux/bits/_G_config.h55
2 files changed, 15 insertions, 55 deletions
diff --git a/sysdeps/unix/sysv/linux/_G_config.h b/sysdeps/unix/sysv/linux/_G_config.h
new file mode 100644
index 0000000000..0413716481
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/_G_config.h
@@ -0,0 +1,15 @@
+/* Configuration parameters for stdio - Linux version.  */
+
+#ifndef __G_CONFIG_H
+#define __G_CONFIG_H 1
+
+/* Define to 1 if the operating system supports mmap, 0 otherwise.
+   This function is required by POSIX but might still be unavailable,
+   for instance when the hardware lacks support for virtual memory.  */
+#define _G_HAVE_MMAP 1
+
+/* Define to 1 if the operating system supports mremap, 0 otherwise.
+   This function is currently a Linux-specific extension.  */
+#define _G_HAVE_MREMAP 1
+
+#endif	/* bits/_G_config.h */
diff --git a/sysdeps/unix/sysv/linux/bits/_G_config.h b/sysdeps/unix/sysv/linux/bits/_G_config.h
deleted file mode 100644
index 05a64acb2c..0000000000
--- a/sysdeps/unix/sysv/linux/bits/_G_config.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* This file is needed by libio to define various configuration parameters.
-   These are always the same in the GNU C library.  */
-
-#ifndef _BITS_G_CONFIG_H
-#define _BITS_G_CONFIG_H 1
-
-/* Define types for libio in terms of the standard internal type names.  */
-
-#include <bits/types.h>
-#define __need_size_t
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define __need_wchar_t
-#endif
-#define __need_NULL
-#include <stddef.h>
-
-#include <bits/types/__mbstate_t.h>
-#include <bits/types/__fpos_t.h>
-#include <bits/types/__fpos64_t.h>
-
-#define _G_fpos_t __fpos_t
-#define _G_fpos64_t __fpos64_t
-
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# include <bits/types/wint_t.h>
-#endif
-
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# include <gconv.h>
-typedef union
-{
-  struct __gconv_info __cd;
-  struct
-  {
-    struct __gconv_info __cd;
-    struct __gconv_step_data __data;
-  } __combined;
-} _G_iconv_t;
-#endif
-
-
-/* These library features are always available in the GNU C library.  */
-#define _G_va_list __gnuc_va_list
-
-#define _G_HAVE_MMAP 1
-#define _G_HAVE_MREMAP 1
-
-#define _G_IO_IO_FILE_VERSION 0x20001
-
-/* This is defined by <bits/stat.h> if `st_blksize' exists.  */
-#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
-
-#define _G_BUFSIZ 8192
-
-#endif	/* bits/_G_config.h */