Commit Graph

67 Commits

Author SHA1 Message Date
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Florian Weimer db3476aff1 libio: Implement vtable verification [BZ #20191]
This commit puts all libio vtables in a dedicated, read-only ELF
section, so that they are consecutive in memory.  Before any indirect
jump, the vtable pointer is checked against the section boundaries,
and the process is terminated if the vtable pointer does not fall into
the special ELF section.

To enable backwards compatibility, a special flag variable
(_IO_accept_foreign_vtables), protected by the pointer guard, avoids
process termination if libio stream object constructor functions have
been called earlier.  Such constructor functions are called by the GCC
2.95 libstdc++ library, and this mechanism ensures compatibility with
old binaries.  Existing callers inside glibc of these functions are
adjusted to call the original functions, not the wrappers which enable
vtable compatiblity.

The compatibility mechanism is used to enable passing FILE * objects
across a static dlopen boundary, too.
2016-06-23 20:01:52 +02:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Feng Gao 2e4250225c Use "|" instead of "+" when combine the _IO_LINE_BUF and _IO_UNBUFFERED flags
Both of "_IO_UNBUFFERED" and "_IO_LINE_BUF"  are the bit flags, but I
find there are some codes looks like "_IO_LINE_BUF+_IO_UNBUFFERED",
while some codes are "_IO_LINE_BUF|_IO_UNBUFFERED".

I think the former is not good, even though the final result is same.
2015-07-08 13:53:11 +05:30
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Siddhesh Poyarekar 24b9788285 Fix up function definition style
Don't use K&R style for function definitions.
2014-12-04 08:45:55 +05:30
Siddhesh Poyarekar fe8b4d98e9 Reset cached offset when reading to end of stream (BZ #17653)
POSIX allows applications to switch file handles when a read results
in an end of file.  Unset the cached offset at this point so that it
is queried again.
2014-12-04 08:13:28 +05:30
Siddhesh Poyarekar be349d7042 ftell: seek to end only when there are unflushed bytes (BZ #17647)
Currently we seek to end of file if there are unflushed writes or the
stream is in write mode, to get the current offset for writing in
append mode, which is the end of file.  The latter case (i.e. stream
is in write mode, but no unflushed writes) is unnecessary since it
will only happen when the stream has just been flushed, in which case
the recorded offset ought to be reliable.

Removing that case lets ftell give the correct offset when it follows
an ftruncate.  The latter truncates the file, but does not change the
file position, due to which it is permissible to call ftell without an
intervening fseek call.

Tested on x86_64 to verify that the added test case fails without the
patch and succeeds with it, and that there are no additional
regressions due to it.

	[BZ #17647]
	* libio/fileops.c (do_ftell): Seek only when there are
	unflushed writes.
	* libio/wfileops.c (do_ftell_wide): Likewise.
	* libio/tst-ftell-active-handler.c (do_ftruncate_test): New
	test case.
	(do_one_test): Call it.
2014-12-04 08:08:37 +05:30
Andreas Schwab 04b76b5aa8 Don't error out writing a multibyte character to an unbuffered stream (bug 17522) 2014-11-03 09:58:24 +01:00
Siddhesh Poyarekar 545583d664 Fix memory leak in error path of do_ftell_wide (BZ #17370) 2014-09-16 14:20:45 +05:30
Tim Lammens 984c0ea97f Fix memory leak in libio/wfileops.c do_ftell_wide [BZ #17370] 2014-09-11 10:44:02 +05:30
Siddhesh Poyarekar 2482ae433a Fix offset computation for append+ mode on switching from read (BZ #16724)
The offset computation in write mode uses the fact that _IO_read_end
is kept in sync with the external file offset.  This however is not
true when O_APPEND is in effect since switching to write mode ought to
send the external file offset to the end of file without making the
necessary adjustment to _IO_read_end.

Hence in append mode, offset computation when writing should only
consider the effect of unflushed writes, i.e. from _IO_write_base to
_IO_write_ptr.

The wiki has a detailed document that describes the rationale for
offsets returned by ftell in various conditions:

https://sourceware.org/glibc/wiki/File%20offsets%20in%20a%20stdio%20stream%20and%20ftell
2014-05-27 13:54:19 +05:30
Siddhesh Poyarekar ea33158c96 Fix offset caching for streams and use it for ftell (BZ #16680)
The ftell implementation was made conservative to ensure that
incorrectly cached offsets never affect it.  However, this causes
problems for append mode when a file stream is rewound.  Additionally,
the 'clever' trick of using stat to get position for append mode files
caused more problems than it solved and broke old behavior.  I have
described the various problems that it caused and then finally the
solution.

For a and a+ mode files, rewinding the stream should result in ftell
returning 0 as the offset, but the stat() trick caused it to
(incorrectly) always return the end of file.  Now I couldn't find
anything in POSIX that specifies the stream position after rewind()
for a file opened in 'a' mode, but for 'a+' mode it should be set to
0.  For 'a' mode too, it probably makes sense to keep it set to 0 in
the interest of retaining old behavior.

The initial file position for append mode files is implementation
defined, so the implementation could either retain the current file
position or move the position to the end of file.  The earlier ftell
implementation would move the offset to end of file for append-only
mode, but retain the old offset for a+ mode.  It would also cache the
offset (this detail is important).  My patch broke this and would set
the initial position to end of file for both append modes, thus
breaking old behavior.  I was ignorant enough to write an incorrect
test case for it too.

The Change:

I have now brought back the behavior of seeking to end of file for
append-only streams, but with a slight difference.  I don't cache the
offset though, since we would want ftell to query the current file
position through lseek while the stream is not active.  Since the
offset is moved to the end of file, we can rely on the file position
reported by lseek and we don't need to resort to the stat() nonsense.

Finally, the cache is always reliable, except when there are unflished
writes in an append mode stream (i.e. both a and a+).  In the latter
case, it is safe to just do an lseek to SEEK_END.  The value can be
safely cached too, since the file handle is already active at this
point.  Incidentally, this is the only state change we affect in the
file handle (apart from taking locks of course).

I have also updated the test case to correct my impression of the
initial file position for a+ streams to the initial behavior.  I have
verified that this does not break any existing tests in the testsuite
and also passes with the new tests.
2014-03-17 21:23:56 +05:30
Siddhesh Poyarekar 091eff71a5 Fix up formatting 2014-03-04 12:27:34 +05:30
Siddhesh Poyarekar fa3cd24827 Use cached offset in ftell when reliable
The cached offset is reliable to use in ftell when the stream handle
is active.  We can consider a stream as being active when there is
unflushed data.  However, even in this case, we can use the cached
offset only when the stream is not being written to in a+ mode,
because this case may have unflushed data and a stale offset; the
previous read could have sent it off somewhere other than the end of
the file.

There were a couple of adjustments necessary to get this to work.
Firstly, fdopen now ceases to use _IO_attach_fd because it sets the
offset cache to the current file position.  This is not correct
because there could be changes to the file descriptor before the
stream handle is activated, which would not get reflected.

A similar offset caching action is done in _IO_fwide, claiming that
wide streams have 'problems' with the file offsets.  There don't seem
to be any obvious problems with not having the offset cache available,
other than that it will have to be queried in a subsequent
read/write/seek.  I have removed this as well.

The testsuite passes successfully with these changes on x86_64.
2014-03-04 12:23:28 +05:30
Siddhesh Poyarekar 000232b9bc Separate ftell from fseek logic and avoid modifying FILE data (#16532)
ftell semantics are distinct from fseek(SEEK_CUR) especially when it
is called on a file handler that is not yet active.  Due to this
caveat, much care needs to be taken while modifying the handler data
and hence, this first iteration on separating out ftell focusses on
maintaining handler data integrity at all times while it figures out
the current stream offset.  The result is that it makes a syscall for
every offset request.

There is scope for optimizing this by caching offsets when we know
that the handler is active.  A simple way to find out is when the
buffers have data.  It is not so simple to find this out when the
buffer is empty without adding some kind of flag.
2014-03-04 07:45:58 +05:30
Ondřej Bílka a1ffb40e32 Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
Siddhesh Poyarekar df675f9933 Fix infinite loop in ftell when writing wide char data (BZ #16398)
ftell tries to avoid flushing the buffer when it is in write mode by
converting the wide char data and placing it into the binary buffer.
If the output buffer space is full and there is data to write, the
code reverts to flushing the buffer.  This breaks when there is space
in the buffer but it is not enough to convert the next character in
the wide data buffer, due to which __codecvt_do_out returns a
__codecvt_partial status.  In this case, ftell keeps running in an
infinite loop.

The fix here is to detect the __codecvt_partial status in addition to
checking if the buffer is full.  I have also added a test case that
demonstrates the infinite loop.
2014-02-05 12:49:00 +05:30
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Joseph Myers 2e09a79ada Avoid use of "register" as optimization hint. 2013-06-07 22:24:35 +00:00
Roland McGrath f1d70dad53 Remove lots of inline keywords. 2013-02-07 14:44:18 -08:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Joseph Myers c8450f70fa Remove _G_off64_t and _G_stat64 from _G_config.h. 2012-10-09 15:09:32 +00:00
Siddhesh Poyarekar adb26faefe Don't flush write buffer for ftell
[BZ #5298]
Use write pointer state along with the file offset and/or the read
pointers to get the current file position.
2012-09-28 18:38:14 +05:30
Siddhesh Poyarekar 4573c6b098 Adjust wide data buffer pointers during fseek and ftell
[BZ #14543]
Set the internal buffer state correctly whenever the external buffer
state is modified by fseek by either computing the current
_IO_read_ptr/end for the internal buffer based on the new _IO_read_ptr
in the external buffer or converting the content read into the
external buffer, up to the extent of the requested fseek offset.
2012-09-28 18:21:39 +05:30
Siddhesh Poyarekar 1ffb8c9001 Fix typos in comments
* libio/fileops.c: Fix typos in comments.
        * libio/oldfileops.c: Likewise.
        * libio/wfileops.c: Likewise.
2012-09-05 22:04:57 +05:30
Andreas Schwab d18ea0c5e6 Remove use of INTDEF/INTUSE in libio 2012-05-24 23:06:20 +02:00
Paul Eggert 59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Marek Polacek aaddc98c25 Remove unused variables 2011-11-11 13:27:59 -05:00
Jim Meyering ded5b9b7c7 Remove doubled words. 2011-04-22 21:34:32 -04:00
Roland McGrath 487a6d7735 Remove some unused variables. 2009-09-19 17:19:41 -07:00
Andreas Schwab 5d2e69766a Fix fsetpos on wide stream. 2009-09-02 19:45:33 -07:00
Andreas Schwab d840539e12 Cleanup _IO_wfile_seekoff.
This reformulates the in-buffer optimisation check to match the code in
_IO_new_file_seekoff.  No functional changes, but easier to understand.
2009-09-01 15:36:22 -07:00
Ulrich Drepper a71433e7fd * sysdeps/unix/sysv/linux/sparc/bits/siginfo.h (struct sigevent):
Add _tid slot to maintain consistency with kernel.
2009-02-05 00:21:43 +00:00
Ulrich Drepper 82f2e9c6bd 2009-02-04 Ulrich Drepper <drepper@redhat.com>
* libio/wfileops.c (_IO_wfile_underflow): Fix handling of
	incomplete characters at end of input buffer.
	* libio/Makefile (tests): Add tst-fgetwc.
	* libio/tst-fgetwc.c: New file.
	* libio/tst-fgetwc.input: New file.
2009-02-04 21:27:48 +00:00
Andreas Jaeger f3495a080c [BZ #2079]
* libio/fputwc_u.c (fputwc_unlocked): Fix return value. 
* libio/getwc_u.c (__getwc_unlocked): Likewise. 
* libio/wfileops.c (_IO_wdo_write): Likewise.
2006-01-15 17:45:20 +00:00
Ulrich Drepper a334319f65 (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4. 2004-12-22 20:10:10 +00:00
Jakub Jelinek 0ecb606cb6 2.5-18.1 2007-07-12 18:26:36 +00:00
Ulrich Drepper b2637a22db Update.
2004-01-14  Ulrich Drepper  <drepper@redhat.com>

	* libio/libio.h: Add const to function tables types.
	* libio/libioP.h: Likewise.
	* /login/utmp-private.h: Likewise.
	* libio/fileops.c: Add const to jump table variable definition.
	* libio/genops.c: Likewise.
	* libio/iofopncook.c: Likewise.
	* libio/iopopen.c: Likewise.
	* libio/memstream.c: Likewise.
	* libio/obprintf.c: Likewise.
	* libio/oldfileops.c: Likewise.
	* libio/oldiopopen.c: Likewise.
	* libio/strops.c: Likewise.
	* libio/vsnprintf.c: Likewise.
	* libio/vswprintf.c: Likewise.
	* libio/wfileops.c: Likewise.
	* libio/wstrops.c: Likewise.
	* login/getutent_r.c: Likewise.
	* login/getutid_r.c Likewise.
	* login/getutline_r.c: Likewise.
	* sysdeps/generic/utmp_file.c: Likewise.
2004-01-14 18:41:22 +00:00
Ulrich Drepper eb35b0972f Update.
* sysdeps/unix/sysv/linux/tcgetattr.c (__tcgetattr): Fill in c_ispeed
	and c_ospeed fields.
	* sysdeps/unix/sysv/linux/speed.c (cfsetospeed): Set c_ospeed field.
	(cfsetispeed): Set c_ispeed field.
	* sysdeps/unix/sysv/linux/tcsetattr.c (IBAUD0): Define unconditionally
	to match corresponding speed.c code.

2003-09-06  Ulrich Drepper  <drepper@redhat.com>

	* libio/wfileops.c (_IO_wfile_underflow): Mark beginning of the
	narrow character buffer.
	* libio/Makefile: Add rules to build and run bug-ftell.
	* libio/bug-ftell.c: New file.

	* stdio-common/vfprintf.c: Don't use the first grouping number twice.

	* stdio-common/vfscanf.c (vfscanf): Fix recognition of characters
	matching the decimal point and possibly leading the thousands
	separator.  This caused the recognition of thousands separators to
	always fail.

2003-09-05  Ulrich Drepper  <drepper@redhat.com>

	* libio/fileops.c (_IO_new_file_overflow): Handle switching to
	write mode from read in backup buffer.
	* libio/Makefile (tests): Add bug-ungetc2.
	* libio/bug-ungetc2.c: New file.

2003-09-05  Roland McGrath  <roland@redhat.com>

>>>>>>> 1.7905
	* sysdeps/unix/sysv/linux/linux_fsinfo.h: Define VXFS_SUPER_MAGIC.
2003-09-06 09:56:14 +00:00
Ulrich Drepper 0261d33f87 Update.
2003-08-29  Jakub Jelinek  <jakub@redhat.com>

	* libio/Makefile: Compile fputc.c, fputwc.c, freopen64.c, freopen.c,
	fseek.c, fseeko64.c, fseeko.c, ftello64.c, ftello.c, fwide.c, getc.c,
	getchar.c, getwc.c, getwchar.c, iofclose.c, iofflush.c, iofgetpos64.c,
	iofgetpos.c, iofgets.c, iofgetws.c, iofputs.c, iofputws.c, iofread.c,
	iofsetpos64.c, iofsetpos.c, ioftell.c, iofwrite.c, iogetdelim.c,
	iogetline.c, iogets.c, iogetwline.c, ioputs.c, ioseekoff.c,
	ioseekpos.c, iosetbuffer.c, iosetvbuf.c, ioungetc.c, ioungetwc.c,
	oldfileops.c, oldiofclose.c, oldiofgetpos64.c, oldiofgetpos.c,
	oldiofsetpos64.c, oldiofsetpos.c, peekc.c, putc.c, putchar.c, putwc.c,
	putwchar.c and rewind.c with exceptions.
	* sysdeps/generic/bits/stdio-lock.h (_IO_acquire_lock,
	_IO_release_lock): Define.
	* libio/fileops.c (_IO_new_file_underflow): Use it.
	* libio/fputc.c (fputc): Likewise.
	* libio/fputwc.c (fputwc): Likewise.
	* libio/freopen64.c (freopen64):
	* libio/freopen.c (freopen): Likewise.
	* libio/fseek.c (fseek): Likewise.
	* libio/fseeko64.c (fseeko64): Likewise.
	* libio/fseeko.c (fseeko): Likewise.
	* libio/ftello64.c (ftello64): Likewise.
	* libio/ftello.c (ftello): Likewise.
	* libio/fwide.c (fwide): Likewise.
	* libio/getc.c (_IO_getc): Likewise.
	* libio/getchar.c (getchar): Likewise.
	* libio/getwc.c (_IO_getwc): Likewise.
	* libio/getwchar.c (getwchar): Likewise.
	* libio/iofclose.c (_IO_new_fclose):
	* libio/iofflush.c (_IO_fflush): Likewise.
	* libio/iofgetpos64.c (_IO_new_fgetpos64): Likewise.
	* libio/iofgetpos.c (_IO_new_fgetpos): Likewise.
	* libio/iofgets.c (_IO_fgets): Likewise.
	* libio/iofgetws.c (fgetws): Likewise.
	* libio/iofputs.c (_IO_fputs):
	* libio/iofputws.c (_IO_fputs): Likewise.
	* libio/iofread.c (_IO_fread): Likewise.
	* libio/iofsetpos64.c (_IO_new_fsetpos64): Likewise.
	* libio/iofsetpos.c (_IO_new_fsetpos): Likewise.
	* libio/ioftell.c (_IO_ftell): Likewise.
	* libio/iofwrite.c (_IO_fwrite): Likewise.
	* libio/iogetdelim.c (_IO_getdelim): Likewise.
	* libio/iogets.c (_IO_gets): Likewise.
	* libio/ioputs.c (_IO_puts): Likewise.
	* libio/ioseekoff.c (_IO_seekoff): Likewise.
	* libio/ioseekpos.c (_IO_seekpos): Likewise.
	* libio/iosetbuffer.c (_IO_setbuffer): Likewise.
	* libio/iosetvbuf.c (_IO_setvbuf): Likewise.
	* libio/ioungetc.c (_IO_ungetc): Likewise.
	* libio/ioungetwc.c (ungetwc): Likewise.
	* libio/oldiofclose.c (_IO_old_fclose): Likewise.
	* libio/oldiofgetpos64.c (_IO_old_fgetpos64): Likewise.
	* libio/oldiofgetpos.c (_IO_old_fgetpos): Likewise.
	* libio/oldiofsetpos64.c (_IO_old_fsetpos64): Likewise.
	* libio/oldiofsetpos.c (_IO_old_fsetpos): Likewise.
	* libio/peekc.c (_IO_peekc_locked): Likewise.
	* libio/putc.c (_IO_putc): Likewise.
	* libio/putchar.c (putchar): Likewise.
	* libio/putwc.c (putwc): Likewise.
	* libio/putwchar.c (putwchar): Likewise.
	* libio/rewind.c (rewind): Likewise.
	* libio/wfileops.c (_IO_wfile_underflow): Likewise.
2003-08-29 19:58:49 +00:00
Roland McGrath 15a686af58 * scripts/abilist.awk: If variable `parse_names' is set, grok the file
header lines and write out foo.symlist files for each foo.so.NN listed.

	* libio/libioP.h (_IO_wfile_jumps): Remove attribute_hidden.
	This symbol is exported, and we don't want to hide it.
	Add libc_hidden_proto instead.
	(_IO_file_jumps): Add libc_hidden_proto.
	* libio/wfileops.c (_IO_wfile_jumps): Add libc_hidden_data_def.
	Remove INTVARDEF.
	* libio/fileops.c (_IO_file_jumps): Likewise.
	* libio/stdfiles.c: Don't use INTUSE on them.
	* libio/iofdopen.c (_IO_new_fdopen): Likewise.
	* libio/iofopen.c (__fopen_internal): Likewise.
	* libio/freopen.c (freopen): Likewise.
	* libio/freopen64.c (freopen64): Likewise.
	* libio/iovdprintf.c (_IO_vdprintf): Likewise.
2003-03-27 11:54:09 +00:00
Ulrich Drepper 2fdeb7ca4f (_IO_wfile_seekoff): Don't modify _offset and _wide_data->_IO_read_end if adjustment can be made in the current buffer. 2002-11-05 07:29:40 +00:00
Ulrich Drepper 442685a8ba Update.
2002-08-26  Ulrich Drepper  <drepper@redhat.com>

	* libio/wfileops.c (_IO_wfile_seekoff): Set fp->_offset after
	finding the read position [PR libc/4265].
	* libio/Makefile (tests): Add bug-rewind2.
	* libio/bug-rewind2.c: New file.
2002-08-26 08:08:50 +00:00
Ulrich Drepper 6dd67bd565 Update.
2002-08-24  Ulrich Drepper  <drepper@redhat.com>

	* locale/programs/charmap.c (charmap_new_char): Don't use
	ULONG_MAX as maximum UCS4 value.

	* sysdeps/unix/sysv/linux/ia64/sys/user.h: New file.

	* sysdeps/generic/strtol.c: We don't need the isascii test in glibc.

	* malloc/hooks.c (public_sET_STATe): use size_t as type for i.
	* malloc/malloc.c (mALLINFo): Likewise.

	* libio/wstrops.c (_IO_wstr_pbackfail): Use WEOF in comparison.

	* libio/wfileops.c (_IO_wfile_overflow): Use EOF not WEOF when
	examining result of _IO_do_flush call.

	* stdio-common/vfprintf.c (vfprintf): Use correct type in va_arg.
	Use prec not spec when sizing buffers.

	* catgets/open_catalog.c (__open_catalog): Add casts to avoid warnings.
	* locale/loadarchive.c (_nl_load_locale_from_archive): Likewise.
	* locale/loadlocale.c (_nl_intern_locale_data): Likewise.
	* stdio-common/vfscanf.c (inchar): Likewise.
	* misc/efgcvt_r.c (fcvt_r): Likewise.
	* elf/dl-misc.c (_dl_debug_vdprintf): Likewise.
	* elf/readlib.c (process_file): Likewise.
	* elf/sprof.c (load_profdata): Likewise.
	* sysdeps/ia64/hp-timing.h (HP_TIMING_PRINT): Likewise.
	* locale/programs/linereader.c (get_toplvl_escape): Likewise.
	* locale/programs/charmap.c (charmap_read): Likewise.
	* libio/fileops.c: Likewise.
	* libio/fmemopen.c: Likewise.
	* stdlib/strtod.c: Likewise.
	* elf/dl-load.c: Likewise.
	* iconv/iconvconfig.c: Likewise.
	* iconv/iconv_prog.c (process_block): Likewise.

	* sysdeps/unix/sysv/linux/ia64/Makefile: Define _ASM_IA64_CURRENT_H
	macro to calm down the compiler.

	* iconv/gconv_cache.c (__gconv_load_cache): Add cast to avoid warning.

	* sysdeps/ia64/elf/initfini.c: Don't use newlines embedded in string.

	* sysdeps/unix/sysv/linux/i386/sysdep.S: Update comment regarding
	placement of errno definition.
	* sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/mips/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S: Likewise.

	* resolv/nss_dns/dns-host.c (MAXPACKET): Increase minimum value
	from 1024 to 65536, to avoid buffer overrun.

2002-08-16  Paul Eggert  <eggert@twinsun.com>

	* resolv/gethnamaddr.c (MAXPACKET): Increase minimum value
	from 1024 to 65536, to avoid buffer overrun.
	* resolv/res_query.c (MAXPACKET): Likewise.

	architectures.
2002-08-25 04:51:08 +00:00
Ulrich Drepper 230491f02c Update.
2002-08-04  Ulrich Drepper  <drepper@redhat.com>

	* stdio-common/psignal.c: Declare _sys_siglist_internal.  Use USEINT
	to access _sys_siglist.
	* string/strsignal.c: Likewise.
	* sysdeps/generic/siglist.c: Add _sys_siglist_internal alias.
	* sysdeps/gnu/siglist.c: Likewise.
	* sysdeps/unix/siglist.c: Likewise.
	* sysdeps/unix/sysv/linux/arm/siglist.c: Likewise.

	* libio/fileops.c: Add missing INTUSEs for _IO_file_jumps.

	* libio/wfileops.c: Add missing INTUSE for _IO_file_close.

	* intl/dcigettext.c: Define _nl_default_dirname_internal as hidden
	alias and use it.
	* intl/bindtextdom.c: Use _nl_default_dirname_internal.

	* include/netinet/in.h: Add declaration of in6addr_loopback_internal.
	* inet/in6_addr.c: Add INTVARDEF for in6addr_loopback.
	* sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access.

	* include/time.h: Add libc_hidden_proto for __gmtime_r.
	* time/gmtime.c (__gmtime_r): Add libc_hidden_def.

	* iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db,
	and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db,
	and __gconv_get_cache respectively.
	* iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and
	defined static.  Change all users.
	(__gconv_get_cache): New function.
	* iconv/gconv_db.c (__gconv_get_modules_db): New function.
	(__gconv_get_alias_db): New function.
	* iconv/gconv_int.h (__gconv_alias_db): Declare as hidden.
	(__conv_modules_db): Likewise.
	Add prototypes for __gconv_get_cache, __gconv_get_modules_db,
	and __gconv_get_alias_db.
	* iconv/iconv_prog.c: Use the new functions instead of accessing the
	variables.

	* include/stdlib.h: Add prototype and libc_hidden_proto for
	__default_morecore.
	* sysdeps/generic/morecore.c: Include <stdlib.h>.

	* malloc/obstack.c: Remove fputs macro.

	* malloc/mtrace.c: Remove fopen macro.
2002-08-04 23:32:14 +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
Ulrich Drepper 706d1dee46 Update.
2002-07-15  Ulrich Drepper  <drepper@redhat.com>

	* libio/wfileops.c (_IO_wfile_seekoff): Reposition wide pointers
	and adjust state for seek position.  [PR libc/4070]
	* libio/Makefile (tests): Add bug-rewind.
	* libio/bug-rewind.c: New file.
2002-07-15 23:37:22 +00:00
Ulrich Drepper bff334e090 Update.
2002-06-17  Jakub Jelinek  <jakub@redhat.com>

	* elf/dl-lookup.c (_dl_debug_bindings): Use type_class 4 for TLS
	lookups.
	* elf/rtld.c (dl_main): Move TLS setup code before LD_TRACE_PRELINKING
	code.  Print TLS modid and offset for modules containing PT_TLS
	segments.

2002-06-09  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/i386/dl-brk.c: Move...
	* sysdeps/unix/sysv/linux/dl-brk.c: ...here.
	* sysdeps/unix/sysv/linux/i386/dl-sbrk.c: Move...
	* sysdeps/unix/sysv/linux/dl-sbrk.c: ...here.

2002-06-07  Jakub Jelinek  <jakub@redhat.com>

	* nss/getXXbyYY_r.c (NEW, NEW1): Define.
	(NEW (REENTRANT_NAME)): Strong alias to INTERNAL (REENTRANT_NAME).
	(REENTRANT_NAME@@GLIBC_2.1.2): Use NEW (REENTRANT_NAME).
	* nss/getXXent_r.c (NEW, NEW1): Define.
	(NEW (REENTRANT_GETNAME)): Strong alias to
	INTERNAL (REENTRANT_GETNAME).
	(REENTRANT_GETNAME@@GLIBC_2.1.2): Use NEW (REENTRANT_GETNAME).

2002-06-21  Ulrich Drepper  <drepper@redhat.com>

	* libio/fileops.c (_IO_file_setbuf_mmap): New function.
	(_IO_file_jumps_mmap): Use it.
	* libio/iosetvbuf.c: Don't call _IO_WSETBUF.
	* libio/libioP.h: Remove _IO_wdefault_setbuf and
	_IO_wdefault_setbuf_internal prorotypes.  Add _IO_file_setbuf_mmap
	prototype.
	* libio/wfileops.c (_IO_wfile_setbuf): Removed.
	(_IO_wfile_jumps_mmap): Don't use it anymore.
	* libio/wgenops.c (_IO_wdefault_setbuf): Removed.
	* libio/memstream.c (_IO_wmem_jumps): Use _IO_default_setbuf not
	_IO_wdefault_setbuf.
	* libio/vswprintf.c (_IO_wstrn_jumps): Likewise.
	* libio/wstrops.c (_IO_wstr_jumps): Likewise.
	* stdio-common/vfprintf.c (_IO_helper_jumps): Likewise.

2002-06-05  Jakub Jelinek  <jakub@redhat.com>

	* libio/Makefile (tests): Add tst-mmap-setvbuf.
	* libio/tst-mmap-setvbuf.c: New test.
2002-06-22 05:24:45 +00:00
Ulrich Drepper 100351c3e1 Update.
* stdio-common/itowa-digits.c (_itowa_lower_digits): Define as hidden.
	(_itowa_upper_digits): Likewise.

	* libio/stdio.c (_IO_stdin, _IO_stdout, _IO_stderr): Define as hidden.
	* libio/libio.h [_LIBC] (_IO_stdin, _IO_stdout, _IO_stderr): Declare
	as hidden.

	* libio/libioP.h: Declare _IO_file_jumps_mmap, _IO_wfile_jumps,
	_IO_wfile_jumps_mmap, _IO_proc_jumps, _IO_old_proc_jumps,
	_IO_str_jumps, _IO_wstr_jumps, _IO_file_jumps_internal,
	_IO_wfile_jumps_internal, and _IO_list_all_internal as hidden.

	* gmon/gmon.c (__bb_head): Define as hidden.
	* gmon/bb_exit_func.c (__bb_head): Declare as hidden.

	* argp/argp-parse.c (_argp_hang): Define as static.

	* include/libc-symbols.h (_INTVARDEF): Adjust for visibility
	handling in latest compilers.

	* inet/in6_addr.c (in6addr_any): Use INTVARDEF not INTDEF to
	define alias.
	* libio/fileops.c (_IO_file_jumps): Likewise.
	* libio/stdfiles.c (_IO_list_all): Likewise.
	* libio/wfileops.c (_IO_wfile_jumps): Likewise.

	* malloc/malloc.h: Move __libc_malloc_initialized declaration to
	include/malloc.h.
	* include/malloc.h: Add __libc_malloc_initialized declaration
	here.  Mark variable hidden.
	* malloc/malloc.c: Include <malloc.h> not "malloc.h".

	* elf/dl-open.c (__libc_argc): Declare as hidden.
	(__libc_argv): Likewise.
	* sysdeps/generic/wordexp.c (__libc_argc): Declare as hidden.
	(__libc_argv): Likewise.
	* sysdeps/mach/hurd/i386/init-first.c: Define __libc_argc and
	__libc_argv as hidden.
	* sysdeps/mach/hurd/mips/init-first.c: Likewise.
	* sysdeps/mach/hurd/powerpc/init-first.c: Likewise.
	* sysdeps/unix/sysv/aix/init-first.c: Likewise.
	* sysdeps/unix/sysv/linux/init-first.c: Likewise.
2002-03-13 02:17:12 +00:00