mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-08 14:20:07 +00:00
2cc7bad0ae
C99 specifies that the EOF condition on a file is "sticky": once EOF has been encountered, all subsequent reads should continue to return EOF until the file is closed or something clears the "end-of-file indicator" (e.g. fseek, clearerr). This is arguably a change from C89, where the wording was ambiguous; the BSDs always had sticky EOF, but the System V lineage would attempt to read from the underlying fd again. GNU libc has followed System V for as long as we've been using libio, but nowadays C99 conformance and BSD compatibility are more important than System V compatibility. You might wonder if changing the _underflow impls is sufficient to apply the C99 semantics to all of the many stdio functions that perform input. It should be enough to cover all paths to _IO_SYSREAD, and the only other functions that call _IO_SYSREAD are the _seekoff impls, which is OK because seeking clears EOF, and the _xsgetn impls, which, as far as I can tell, are unused within glibc. The test programs in this patch use a pseudoterminal to set up the necessary conditions. To facilitate this I added a new test-support function that sets up a pair of pty file descriptors for you; it's almost the same as BSD openpty, the only differences are that it allocates the optionally-returned tty pathname with malloc, and that it crashes if anything goes wrong. [BZ #1190] [BZ #19476] * libio/fileops.c (_IO_new_file_underflow): Return EOF immediately if the _IO_EOF_SEEN bit is already set; update commentary. * libio/oldfileops.c (_IO_old_file_underflow): Likewise. * libio/wfileops.c (_IO_wfile_underflow): Likewise. * support/support_openpty.c, support/tty.h: New files. * support/Makefile (libsupport-routines): Add support_openpty. * libio/tst-fgetc-after-eof.c, wcsmbs/test-fgetwc-after-eof.c: New test cases. * libio/Makefile (tests): Add tst-fgetc-after-eof. * wcsmbs/Makefile (tests): Add tst-fgetwc-after-eof. |
||
---|---|---|
argp | ||
assert | ||
benchtests | ||
bits | ||
catgets | ||
ChangeLog.old | ||
conform | ||
crypt | ||
csu | ||
ctype | ||
debug | ||
dirent | ||
dlfcn | ||
elf | ||
gmon | ||
gnulib | ||
grp | ||
gshadow | ||
hesiod | ||
hurd | ||
iconv | ||
iconvdata | ||
include | ||
inet | ||
intl | ||
io | ||
libidn | ||
libio | ||
locale | ||
localedata | ||
login | ||
mach | ||
malloc | ||
manual | ||
math | ||
mathvec | ||
misc | ||
nis | ||
nptl | ||
nptl_db | ||
nscd | ||
nss | ||
po | ||
posix | ||
pwd | ||
resolv | ||
resource | ||
rt | ||
scripts | ||
setjmp | ||
shadow | ||
signal | ||
socket | ||
soft-fp | ||
stdio-common | ||
stdlib | ||
streams | ||
string | ||
sunrpc | ||
support | ||
sysdeps | ||
sysvipc | ||
termios | ||
time | ||
timezone | ||
wcsmbs | ||
wctype | ||
.gitattributes | ||
.gitignore | ||
abi-tags | ||
aclocal.m4 | ||
ChangeLog | ||
config.h.in | ||
config.make.in | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING.LIB | ||
extra-lib.mk | ||
gen-locales.mk | ||
INSTALL | ||
libc-abis | ||
libof-iterator.mk | ||
LICENSES | ||
MAINTAINERS | ||
Makeconfig | ||
Makefile | ||
Makefile.in | ||
Makerules | ||
NEWS | ||
o-iterator.mk | ||
README | ||
Rules | ||
shlib-versions | ||
test-skeleton.c | ||
version.h |
This directory contains the sources of the GNU C Library. See the file "version.h" for what release version you have. The GNU C Library is the standard system C library for all GNU systems, and is an important part of what makes up a GNU system. It provides the system API for all programs written in C and C-compatible languages such as C++ and Objective C; the runtime facilities of other programming languages use the C library to access the underlying operating system. In GNU/Linux systems, the C library works with the Linux kernel to implement the operating system behavior seen by user applications. In GNU/Hurd systems, it works with a microkernel and Hurd servers. The GNU C Library implements much of the POSIX.1 functionality in the GNU/Hurd system, using configurations i[4567]86-*-gnu. The current GNU/Hurd support requires out-of-tree patches that will eventually be incorporated into an official GNU C Library release. When working with Linux kernels, this version of the GNU C Library requires Linux kernel version 3.2 or later. Also note that the shared version of the libgcc_s library must be installed for the pthread library to work correctly. The GNU C Library supports these configurations for using Linux kernels: aarch64*-*-linux-gnu alpha*-*-linux-gnu arm-*-linux-gnueabi hppa-*-linux-gnu i[4567]86-*-linux-gnu x86_64-*-linux-gnu Can build either x86_64 or x32 ia64-*-linux-gnu m68k-*-linux-gnu microblaze*-*-linux-gnu mips-*-linux-gnu mips64-*-linux-gnu powerpc-*-linux-gnu Hardware or software floating point, BE only. powerpc64*-*-linux-gnu Big-endian and little-endian. s390-*-linux-gnu s390x-*-linux-gnu riscv64-*-linux-gnu sh[34]-*-linux-gnu sparc*-*-linux-gnu sparc64*-*-linux-gnu tilegx-*-linux-gnu If you are interested in doing a port, please contact the glibc maintainers; see http://www.gnu.org/software/libc/ for more information. See the file INSTALL to find out how to configure, build, and install the GNU C Library. You might also consider reading the WWW pages for the C library at http://www.gnu.org/software/libc/. The GNU C Library is (almost) completely documented by the Texinfo manual found in the `manual/' subdirectory. The manual is still being updated and contains some known errors and omissions; we regret that we do not have the resources to work on the manual as much as we would like. For corrections to the manual, please file a bug in the `manual' component, following the bug-reporting instructions below. Please be sure to check the manual in the current development sources to see if your problem has already been corrected. Please see http://www.gnu.org/software/libc/bugs.html for bug reporting information. We are now using the Bugzilla system to track all bug reports. This web page gives detailed information on how to report bugs properly. The GNU C Library is free software. See the file COPYING.LIB for copying conditions, and LICENSES for notices about a few contributions that require these additional notices to be distributed. License copyright years may be listed using range notation, e.g., 1996-2015, indicating that every year in the range, inclusive, is a copyrightable year that would otherwise be listed individually.