Commit Graph

4 Commits

Author SHA1 Message Date
Zack Weinberg 30bfee2630 Remove miscellaneous debris from libio.
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_.

Installed stripped libraries and executables are unchanged, except,
again, that the line number of an assertion changes (this time it's
somewhere in fileops.c).

	* 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.
2018-02-21 14:39:54 -05:00
Roland McGrath 1ce8aaaedb * locale/xlocale.h (struct __locale_struct): New member `__names'.
* locale/xlocale.c (_nl_C_locobj): Update initializer.
	* locale/global-locale.c (_nl_global_locale): Likewise.
	* locale/duplocale.c (__duplocale): strdup __names elements.
	* locale/freelocale.c (__freelocale): Free __names elements.
	* locale/localename.c (_nl_current_names): Variable removed.
	(__current_locale_name): Use _NL_CURRENT_LOCALE->__names instead.
	* locale/localeinfo.h (_nl_current_names): Removed decl.
	* locale/setlocale.c: Use _nl_global_locale->__names in place of
	_nl_current_names throughout.

	* locale/setlocale.c (setlocale): strdup -> __strdup (not ISO C).

	* sysdeps/gnu/errlist-compat.awk: Emit link_warnings for sys_errlist
	and sys_nerr in the output file.

	* sunrpc/Makefile (rpcgen-cmd): Pass CPP in rpcgen's environment.
	* scripts/cpp: Just use the environment variable.

	* libio/tst-mmap-setvbuf.c (main): Use 'm' fopen flag.
	* libio/tst-mmap-offend.c (do_test): Likewise.
	* libio/tst-mmap-fflushsync.c (do_test): Likewise.
	* libio/tst-mmap-eofsync.c (do_test): Likewise.
	* libio/tst-mmap2-eofsync.c (do_test): Likewise.
2002-08-30 10:36:44 +00:00
Ulrich Drepper 6d497bbef7 Update.
* libio/tst-freopen.c (main): Use correct formats for __LINE__.
	* libio/tst-mmap-setvbuf.c (main): Likewise.
	* libio/tst-widetext.c (main): Likewise.

	* libio/tst-mmap-eofsync.c (do_test): Use correct format in error
	message.
	* libio/tst-mmap-fflushsync.c (do_test): Likewise.
	* libio/tst-mmap2-eofsync.c (do_test): Likewise.
2002-08-25 08:44:43 +00:00
Roland McGrath acbee5f637 * libio/fileops.c (_IO_file_sync_mmap): New function.
(_IO_file_jumps_mmap): Use it.
	(_IO_file_underflow_mmap): Rewritten.  If after EOF or fflush,
	repeat the stat check and resize the mapped buffer as necessary.

2002-07-31  Roland McGrath  <roland@frob.com>

	* libio/fileops.c (decide_maybe_mmap): New static function.
	Code taken from libio/iofopen.c:__fopen_maybe_mmap to try to
	mmap the file contents.  Then switch the jump tables to the mmap
	tables if it worked, or the vanilla file tables if not.
	(_IO_file_underflow_maybe_mmap): New function.
	(_IO_file_seekoff_maybe_mmap): New function.
	(_IO_file_xsgetn_maybe_mmap): New function.
	(_IO_file_jumps_maybe_mmap): New variable, jump table using those.
	* libio/libioP.h: Declare those.
	* libio/wfileops.c (_IO_wfile_underflow_maybe_mmap): New function.
	(_IO_wfile_jumps_maybe_mmap): New variable, jump table using that.
	* libio/iofopen.c (__fopen_maybe_mmap): Don't try to mmap here.
	If the stream is read-only, set its jump tables to those new ones.
	* libio/iofdopen.c (_IO_new_fdopen) [_G_HAVE_MMAP]: Set the initial
	jump tables to the maybe_mmap ones, and don't call __fopen_maybe_mmap.
	We need the tables set before _IO_file_attach.

	* libio/tst-mmap-eofsync.c: New file.
	* libio/tst-mmap-fflushsync.c: New file.
	* libio/bug-mmap-fflush.c: New file.
	* libio/tst-mmap2-eofsync.c: New file.
	* libio/Makefile (tests): Add them.

	* libio/wfileops.c (_IO_wfile_underflow_mmap): Don't set EOF bit when
	_IO_file_underflow_mmap fails, it already set the appropriate bit.
2002-08-02 01:29:37 +00:00