buffer. This is not necessary except in debug mode. If we don't
free the buffer but the FILE structure to a list.
(buffer_free): New function. Free buffers or tell _IO_unbuffer_write
to do so.
* libio/libio.h (struct _IO_FILE): Add new members to keep track
of which buffers have to be freed.
it or _GNU_SOURCE is defined.
* io/fcntl.h: Protect *at and AT_* with [__USE_ATFILE] instead of
[__USE_GNU].
* libio/stdio.h: Likewise.
* posix/unistd.h: Likewise.
* time/sys/time.h: Likewise.
fchownat, and unlinkat.
(static-only-routines): Add fstatat and fstatat64.
(tests): Add tst-unlinkat, tst-fstatat, tst-futimesat, tst-renameat,
and tst-fchownat.
* io/Versions [GLIBC_2.4]: Add fchownat, __fxstatat, __fxstatat64,
and unlinkat.
* io/fcntl.h: Define AT_FDCWD, AT_SYMLINK_NOFOLLOW, and AT_REMOVEDIR.
* io/fstatat.c: New file.
* io/fstatat64.c: New file.
* io/sys/stat.h: Declare fstatat, fstatat64, __fxstatat, __fxstatat64
and define fstatat and fstatat64 inline functions.
* libio/stdio.h: Declare renameat.
* misc/Makefile (routines): Add futimesat.
* misc/Versions [GLIBC_2.4]: Add futimesat.
* posix/unistd.h: Declare fchownat and unlinkat.
* stdio-common/Makefile (routines): Add renameat.
* stdio-common/Versions [GLIBC_2.4]: Add renameat.
* sysdeps/generic/fchownat.c: New file.
* sysdeps/generic/futimesat.c: New file.
* sysdeps/generic/fxstatat.c: New file.
* sysdeps/generic/fxstatat64.c: New file.
* sysdeps/generic/renameat.c: New file.
* sysdeps/generic/unlinkat.c: New file.
* sysdeps/unix/sysv/linux/fchownat.c: New file.
* sysdeps/unix/sysv/linux/futimesat.c: New file.
* sysdeps/unix/sysv/linux/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/fxstatat64.c: New file.
* sysdeps/unix/sysv/linux/renameat.c: New file.
* sysdeps/unix/sysv/linux/unlinkat.c: New file.
* sysdeps/unix/sysv/linux/alpha/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/i386/fchownat.c: New file.
* sysdeps/unix/sysv/linux/i386/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/m68k/fchownat.c: New file.
* sysdeps/unix/sysv/linux/m68k/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/powerpc/fchownat.c: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c: New file.
* sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/sh/fchownat.c: New file.
* sysdeps/unix/sysv/linux/sh/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/fchownat.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c: New file.
* time/sys/time.h: Declare futimesat.
* include/fcntl.h: Declare __atfct_seterrno.
* sysdeps/unix/sysv/linux/openat.c (__atfct_seterrno): New function.
Split out from openat code and called.
(do_test): Allow openat to fail with ENOSYS. Handle AT_FDCWD.
* sysdeps/generic/openat.c: Handle AT_FDCWD.
* sysdeps/generic/openat64.c: Likewise.
* io/tst-unlinkat.c: New file.
* io/tst-fstatat.c: New file.
* io/tst-futimesat.c: New file.
* io/tst-renameat.c: New file.
* io/tst-fchownat.c: New file.
* io/tst-openat.c: Don't fail if openat is not implemented.
* sysdeps/unix/sysv/linux/powerpc/chown.c: Don't provide backward
compatibility code if new kernel is guaranteed.
* time/sys/time.h: Add a few nonnull attributes.
Return EOF not 0.
* sysdeps/unix/sysv/linux/readonly-area.c (__readonly_area): Also
allow EACCES errors when opening /rpco for now.
* wctype/wcfuncs.c: Don't use expensive wide char lookups in isw*
functions if character is in ASCII range.
* wctype/wcfuncs_l.c: Likewise.
2005-09-23 Ulrich Drepper <drepper@redhat.com>
[BZ #394]
* libio/fmemopen.c (fmemopen_write): Return 0 instead of -1 if
nothing can be written.
* libio/iofopncook.c (_IO_cookie_write): If something went wrong,
set error bit.
* stdio-common/tst-put-error.c: New file.
* libio/fileops.c (_IO_new_file_xsputn): If overflow fails and no more
data would have to be written signal error.
* libio/oldfileops.c (_IO_old_file_xsputn): Likewise.
* libio/fileops.c (_IO_new_file_overflow): Use NULL not 0.
* include/bits/wchar2.h: New file.
* wcsmbs/wchar.h: Include <bits/wchar2.h> if fortification is
requested.
* wcsmbs/wcsncpy.c: Add __wcsncpy alias.
* string/bits/string3.h: Add fortified stpncpy definitions.
* sysdeps/generic/stpncpy_chk.c: New file.
* libio/vswprintf.c: Move _IO_wstrnfile definition to strfile.h.
Export _IO_wstrn_jumps.
* libio/strfile.h: Define _IO_wstrnfile and declare _IO_wstrn_jumps.
* include/wchar.h: Declare __wcsncpy and __vswprintf_chk.
* debug/fgetws_chk.c: New file.
* debug/fgetws_u_chk.c: New file.
* debug/fwprintf_chk.c: New file.
* debug/swprintf_chk.c: New file.
* debug/vfwprintf_chk.c: New file.
* debug/vswprintf_chk.c: New file.
* debug/vwprintf_chk.c: New file.
* debug/wcpcpy_chk.c: New file.
* debug/wcpncpy_chk.c: New file.
* debug/wcscat_chk.c: New file.
* debug/wcscpy_chk.c: New file.
* debug/wcsncat_chk.c: New file.
* debug/wcsncpy_chk.c: New file.
* debug/wmemcpy_chk.c: New file.
* debug/wmemmove_chk.c: New file.
* debug/wmempcpy_chk.c: New file.
* debug/wmemset_chk.c: New file.
* debug/wprintf_chk.c: New file.
* debug/tst-chk1.c: Add tests for new functions.
* debug/Versions: Export new functions.
* debug/Makefile (routines): Add new functions.
* sysdeps/generic/strchrnul.c: Add cast to avoid warning.
* libio/iofwide.c: Add casts to avoid warnings.
* stdio-common/printf-prs.c (parse_printf_format): Introduce new
variable f to avoid warnings.
* sysdeps/unix/sysv/linux/x86_64/makecontext.c (__makecontext):
Fix a few casts to avoid warnings.
* iconv/gconv_simple.c (internal_utf8_loop): Make start unsigned
to avoid warning.
map if requested.
* debug/chk_fail.c: Request backtrace and memory map dump.
* Versions.def: Add GLIBC_2.4 for libc.
* debug/fgets_chk.c: New file.
* debug/fgets_u_chk.c: New file.
* debug/getcwd_chk.c: New file.
* debug/getwd_chk.c: New file.
* debug/readlink_chk.c: New file.
* debug/read_chk.c: New file.
* debug/pread_chk.c: New file.
* debug/pread64_chk.c: New file.
* debug/recv_chk.c: New file.
* debug/recvfrom_chk.c: New file.
* debug/Versions: Add all new functions with version GLIBC_2.4.
* debug/Makefile (routines): Add fgets_chk, fgets_u_chk, read_chk,
pread_chk, pread64_chk, recv_chk, recvfrom_chk, readlink_chk,
getwd_chk, and getcwd_chk. Plus appropriate CFLAGS definitions.
* debug/tst-chk1.c: Add more tests.
* libio/bits/stdio2.h: Add macros for fgets and fgets_unlocked.
* include/stdio.h: Declare __fgets_chk and __fgets_unlocked_chk.
* posix/unistd.h: Include <bits/unistd.h> for fortification.
* posix/bits/unistd.h: New file.
* posix/Makefile (headers): Add bits/unistd.h.
* socket/sys/socket.h: Include <bits/socket2.h> for fortification.
* socket/bits/socket2.h: New file.
* socket/Makefile (headers): Add bits/socket2.h.
* string/bits/string3.h: Extend memset macro to check for zero 3rd
parameter and use __memset_zero_constant_len_parameter in that case.
* sysdeps/generic/memset_chk.c: Add
__memset_zero_constant_len_parameter alias and linker warning.
* debug/Versions: Add __memset_zero_constant_len_parameter to libc
with version GLIBC_2.4.
* sysdeps/generic/bits/types.h: Don't unnecessarily use __extension__
in __STD_TYPE definition.
2005-02-21 Jakub Jelinek <jakub@redhat.com>
* malloc/malloc.c (malloc_printerr): If MALLOC_CHECK_={5,7}, print
the error message rather than program name.
2005-02-21 Ulrich Drepper <drepper@redhat.com>
* intl/dcigettext.c (_nl_find_msg): Add a cast.
* nis/nis_clone_dir.c (nis_clone_directory): Use char * for ADDR.
* nis/nis_clone_obj.c (nis_clone_object): Likewise.
* nis/nis_clone_res.c (nis_clone_result): Likewise.
* resolv/nss_dns/dns-network.c (getanswer_r): Use const unsigned char *
for END_OF_MESSAGE and CP.
* resolv/res_send.c (send_dg): Add else branch for case impossible
unless `poll' is buggy.
* crypt/crypt_util.c (__setkey_r): Add a cast.
* locale/programs/linereader.c (get_toplvl_escape): Use size_t for
NBYTES, and unsigned char * for BYTES.
* locale/programs/charmap.c (charmap_new_char): Use size_t and
unsighed char * for NBYTES, BYTES parameters.
* sysdeps/generic/dl-hash.h (_dl_elf_hash): Take const char * argument
and cast it.
* sysdeps/i386/i686/dl-hash.h (_dl_elf_hash): Likewise.
* sunrpc/create_xid.c (_create_xid): Don't use unsigned long for RES.
* sunrpc/svcauth_des.c (_svcauth_des): Fix cast type.
* sunrpc/auth_des.c (authdes_create): Don't use u_char for PKEY_DATA.
(authdes_marshal): Don't use unsigned int for LEN.
* sunrpc/xdr.c (xdr_hyper): Don't use unsigned long for T2.
(xdr_u_hyper): Likewise.
(xdr_u_short): Don't use u_long for L.
* sunrpc/xdr_intXX_t.c (xdr_int64_t): Don't use uint32_t for T2.
* inet/rexec.c (rexec_af): Use socklen_t.
* sunrpc/key_call.c (getkeyserv_handle): Likewise.
* sunrpc/rtime.c (rtime): Likewise.
* resolv/res_send.c (send_vc, send_dg): Likewise.
* nis/nis_callback.c (__nis_create_callback): Likewise.
* sysdeps/generic/libc-start.c: Use unsigned int for nthreads ptr.
* sysdeps/posix/getaddrinfo.c (gaih_inet): Fix type of ADDR local.
* libio/libio.h (_IO_BE): Add parenthesis around EXPR.
* intl/dcigettext.c (INTVARDEF, INTUSE): Macros removed.
(_nl_default_dirname): Use libc_hidden_data_def instead of INTVARDEF.
(libc_freeres_fn, DCIGETTEXT): Don't use INTUSE.
* intl/bindtextdom.c (INTUSE): Macro removed.
(_nl_default_dirname): Use libc_hidden_proto.
(set_binding_values): Don't use INTUSE.
* include/libintl.h (_libc_intl_domainname_internal): Decl removed.
(_libc_intl_domainname): Use libc_hidden_proto.
* posix/regex_internal.h (gettext): Remove INTUSE on it.
* locale/SYS_libc.c (_libc_intl_domainname): Use libc_hidden_data_def
rather than INTDEF.
* include/libintl.h (_): Don't use *_internal name.
* ctype/ctype-extn.c (__ctype_tolower, __ctype_toupper): Use int32_t,
not uint32_t.
* locale/lc-ctype.c (_nl_postload_ctype): Likewise for assignments.
* iconv/gconv_open.c (__gconv_open): Remove useless cast.
[BZ #721]
* sysdeps/i386/dl-machine.h (ELF_MACHINE_NO_RELA): Define this outside
of [RESOLVE_MAP].
* sysdeps/sh/dl-machine.h (ELF_MACHINE_NO_REL): Likewise.
* sysdeps/powerpc/powerpc32/dl-machine.h
(elf_machine_rel, elf_machine_rel_relative): Removed.
* sysdeps/powerpc/powerpc64/dl-machine.h
(elf_machine_rel, elf_machine_rel_relative): Removed.
2005-02-03 Alexandre Oliva <aoliva@redhat.com>
[BZ #721]
* elf/dynamic-link.h: Don't declare nested auto functions that are
not going to be defined.
2004-07-23 Jakub Jelinek <jakub@redhat.com>
[BZ #284]
* include/features.h (_POSIX_SOURCE, _POSIX_C_SOURCE): Define
if _XOPEN_SOURCE >= 500 even if __STRICT_ANSI__ is defined.
2005-02-16 Roland McGrath <roland@redhat.com>
(dtv_t): Change pointer type to be a struct which also contains
information whether the memory pointed to is static TLS or not.
* sysdeps/generic/syslog.c (send_flags) [!send_flags]: Define it.
* shadow/sgetspent_r.c (FALSE): Macro renamed to ...
(FALSEP): ... this. Updated all references.
* libio/fmemopen.c: Include <stdint.h>.
* libio/iofopncook.c (_IO_cookie_seekoff): Define. Mark offset as
invalid to disable optimizations in fileops which won't work here.
(_IO_cookie_jumps): Use it.
(_IO_old_cookie_jumps): Likewise.
* libio/fmemopen.c (fmemopen_seek): Result must be returned in *P,
not the return value.
* stdio-common/Makefile (tests): Add tst-fmemopen2.
* stdio-common/tst-fmemopen2.c: New file.
2004-11-04 Jakub Jelinek <jakub@redhat.com>
* libio/fileops.c (_IO_new_file_seekoff): If mode is 0 and
fp->_offset == _IO_pos_BAD, just call _IO_SYSSEEK (fp, 0, dir)
and if successful set fp->_offset.
* libio/Makefile (tests): Add bug-ungetc3.
* libio/bug-ungetc3.c: New test.
Update.
* libio/vasprintf.c (_IO_vasprintf): Fix condition to decide
whether to realloc or not.
Reported by Pavel Kankovsky <peak@argo.troja.mff.cuni.cz> [BZ #346].
2004-08-10 Jakub Jelinek <jakub@redhat.com>
* libio/bits/stdio.h (fread_unlocked): Cast 0 to (size_t).
(fwrite_unlocked): When checking if size * n is <= 8, cast each
argument to size_t individually. Cast n to (void) instead of
(size_t), surround with (), return (size_t) 0 if one of n or size
is 0. [BZ #316]
* stdio-common/Makefile (tests): Add tst-unlockedio.
* stdio-common/tst-unlockedio.c: New test.
Update.
* libio/bits/stdio.h (fread_unlocked): Add a couple of (size_t)
casts to handle funny calls with floating point argument values
and signed values correctly and without warning.
(fwrite_unlocked): Likewise. [BZ #309]
2004-07-23 Ulrich Drepper <drepper@redhat.com>
* posix/bits/posix1_lim.h: Fix values for _POSIX_CHILD_MAX and
_POSIX_OPEN_MAX. Add _POSIX_HOST_NAME_MAX, _POSIX_SYMLINK_MAX,
_POSIX_SYMLOOP_MAX, and _POSIX_RE_DUP_MAX.
Reported by Andrew Josey.
* include/features.h: Document _POSIX_C_SOURCE == 200112L.
* grp/grp.h: Define gid_t if __USE_XOPEN2K is defined.
* pwd/pwd.h: Define uid_t and gid_t if __USE_XOPEN2K is defined.
* io/sys/stat.h: Define dev_t, gid_t, ino_t, mode_t, nlink_t,
off_t, time_t, and uid_t if __USE_XOPEN2K is defined.
* signal/signal.h: Define pid_t if __USE_XOPEN2K is defined.
* posix/unistd.h: Define gid_t, off_t, pid_t, uid_t, and
useconds_t if __USE_XOPEN2K is defined.
* io/utime.h: Define time_t if __USE_XOPEN2K is defined.
* libio/stdio.h: Declare fseeko and ftello if __USE_XOPEN2K is defined.
2004-05-13 Jakub Jelinek <jakub@redhat.com>
* libio/genops.c (_IO_default_xsputn): Avoid one overflow per char if
count is negative, yet write_ptr < write_end.
(_IO_default_xsgetn): Avoid one underflow per char if count is
negative, yet read_ptr < read_end.
* iconv/gconv_db.c: Don't define lock as static. Rename to
__gconv_lock and export from the file.
* iconv/gconv_int.h: Declare __gconv_lock.
* libio/iofclose.c [_LIBC] (_IO_new_fclose): Lock gconv lock
before __gconv_release_step calls.
Patch by Shunichi Sagawa <s-sagawa@jp.fujitsu.com>.
* iconv/gconv_simple.c (internal_ucs4_loop): Fix typo in last change.
* iconv/gconv_db.c
2003-09-17 Philip Blundell <philb@gnu.org>
* sysdeps/unix/sysv/linux/arm/vfork.S: Branch to fork if
libpthread is loaded. Elide backwards compatibility code when not
required.
2003-09-11 H.J. Lu <hongjiu.lu@intel.com>
* elf/tls-macros.h (TLS_IE): Add a stop bit for ia64.
(TLS_LD): Likewise.
(TLS_GD): Likewise.
2003-09-11 Jakub Jelinek <jakub@redhat.com>
* libio/fileops.c (_IO_new_file_overflow): Add INTUSE to
_IO_free_backup_area call.
* 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-08-26 Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (search_dir): When checking for GNU-style .so
link file use the real file name, not the resolved name we got by
following the symlinks.
2003-08-25 Ulrich Drepper <drepper@redhat.com>
* libio/libio.h (_IO_fwide): In the mode==0 optimization, don't
use _mode if _IO_fwide_maybe_incompatible.
* libio/iofwide.c (_IO_fwide): Move the test for mode == 0 after
the compatibility test.
2003-08-25 Jakub Jelinek <jakub@redhat.com>
* elf/cache.c (save_cache): Don't write beyond end of file_entries
buffer.
Duplicate last old cache entry if the count would be odd.
More cancellation handling fixups.
* sysdeps/unix/sysv/linux/not-cancel.h: Add waitpid_not_cancel.
* sysdeps/generic/not-cancel.h: Likewise.
* catgets/open_catalog.c: Use not-cancelable syscalls.
* time/Makefile (CFLAGS-getdate.c): Add -fexceptions.
* sysdeps/unix/sysv/linux/llseek.c: Must not be cancelable.
* sysdeps/unix/syscalls.list: Don't mark lseek as cancelable.
* dlfcn/dlfcn.h: Mark dlopen with __THROW again.
* io/fcntl.h: Don't mark posix_fallocate with __THROW.
* libio/fileops.c: Use not-cancelable syscalls for fclose.
* libio/iopopen.c: Use no-cancelable syscalls.
* libio/stdio.h: Mark popen and pclose with __THROW again.
* misc/Makefile (CFLAGS-syslog.c): Add -fexceptions.
* misc/syslog.c: Fix locking and cancellation cleanup handling.
* posix/unistd.h: Mark ttyname and ttyname_r again with __THROW.
* stdio-common/Makefile (CFLAGS-tmpfile.c, CFLAGS-tmpfile64.c,
CFLAGS-tempname.c): Add -fexceptions.
* stdlib/Makefile (CFLAGS-mkstemp.c): Add -fexceptions.
* string/string.h: Mark strerror and strerror_r with _THROW again.
* sysdeps/generic/unwind.inc: New file. Copied from gcc.
* sysdeps/generic/unwind-dw2.c: Update from gcc version. Remove
#ifs since we now need all the code compiled.
* sysdeps/posix/spawni.c: Use close_not_cancel instead of close.
* sysdeps/unix/closedir.c: Use not-cancelable syscalls.
* sysdeps/unix/opendir.c: Likewise.
2003-05-31 Ulrich Drepper <drepper@redhat.com>
* libio/fileops.c (_IO_file_open): Don't mark as inline.
* sysdeps/ia64/elf/initfini.c ((gmon_initializer): Mark with
attribute used.
2003-02-05 Ulrich Drepper <drepper@redhat.com>
* libio/putwc_u.c: Use _IO_putwc_unlocked, not _IO_putc_unlocked.
Patch by Moritz Schulte <moritz@duesseldorf.ccc.de>.
2002-12-31 Ulrich Drepper <drepper@redhat.com>
* string/string-inlines.c: Define __memcpy_g and __strchr_g macros
to avoid using the exported symbols. Define aliases with the
original names separately.
* include/time.h: Add libc_hidden_proto for __strftime_l.
* include/wchar.h: Add libc_hidden_proto for __wcsftime_l.
* time/strftime.c: Always use libc_hidden_def if _LIBC.
* libio/libioP.h: Add libc_hidden_proto for _IO_file_open.
* libio/fileops.c: Add libc_hidden_def for _IO_file_open.
* malloc/mtrace.c: Add libc_hidden_proto and libc_hidden_def for
tr_break.
* csu/Makefile (routines): Add dso_handle.
* csu/dso_handle.c: New file.
* libio/libioP.h: Add libc_hidden_proto for _IO_list_lock,
_IO_list_unlock, and _IO_list_resetlock.
* libio/genops.c: Add libc_hidden_def for _IO_list_lock,
_IO_list_unlock, and _IO_list_resetlock.
* libio/libioP.h: Add libc_hidden_proto for _IO_iter_begin,
_IO_iter_end, _IO_iter_next, and _IO_iter_file.
* libio/genops.c: Add libc_hidden_def for _IO_iter_begin,
_IO_iter_end, _IO_iter_next, and _IO_iter_file.