__alloc_dir.
(__alloc_dir): Only close descriptor on error if new parameter is true.
* sysdeps/unix/fdopendir.c (fdopendir): Pass extra argument to
__alloc_dir. Don't close fd on error.
* include/dirent.h (__alloc_dir): Adjust prototype.
* include/sys/mman.h (__mremap): Add ellipsis.
* malloc/memusage.c: Adjust mremap wrapper for optional additional
parameter.
* malloc/malloc.c (struct malloc_state): Replace max_fast with flags
fields.
(global_max_fast): New variable.
(set_max_fast): Change to not require arena parameter and to modify
global_max_fast. Change all callers.
(get_max_fast): New macro. Use this instead of directly accessing
now removed max_fast arena member.
(have_fastchunks): Use flags instead of max_fast.
(clear_fastchunks): Likewise.
(set_fastchunks): Likewise.
(contiguous): Likewise.
(noncontiguous): Likewise.
(set_noncontiguous): Likewise.
(set_contiguous): Likewise.
(malloc_init_state): Explicitly set FASTCHUNKS_BIT. Call set_max_fast
only for main arena.
* malloc/hooks.c (public_sET_STATe): Adjust set_max_fast use.
check_arrival_add_next_nodes): Avoid using uninitialized variable.
* malloc/memusage.c (dest): Fix a bunch of warnings on 32-bit arches.
* sysdeps/i386/fpu/libm-test-ulps: Update for GCC 4.0.x.
* malloc/arena.c (ptmalloc_lock_all): If global lock already taken
by the same thread, just bump the counter.
(ptmalloc_unlock_all): If counter for recursive locks hasn't reached
zero, don't do anything else.
* malloc/Makefile (tests): Add tst-mallocfork.
* malloc/tst-mallocfork.c: New file.
2005-08-17 Robert Love <rml@novell.com>
* sysdeps/unix/sysv/linux/sys/inotify.h: Add IN_MOVE_SELF event.
2005-08-19 Bruno Haible <bruno@clisp.org>
* intl/localealias.c (read_alias_file): In case of failure, close the
file descriptor and sort the array before returning.
2005-08-19 Ulrich Drepper <drepper@redhat.com>
* malloc/Makefile: Link libmemusage.so with ld.so.
* malloc/memusage.c: Use atomic operations for all counter and size
computations. Handle thread stacks.
* sysdeps/generic/memusage.h: Define memusage_cntr_t and
memusage_size_t.
* sysdeps/i386/i686/memusage.h: New file.
* include/atomic.h: Define atomic_max and atomic_min.
* debug/tst-chk1.c: Add tests for mbstowcs and wcstombs.
(_dl_close): If called recursively, just remember GC needs to be rerun
and decrease l_direct_opencount. Avoid GC if l_direct_opencount
decreased to 1. Rerun GC at the end if any destructor unloaded some
additional libraries.
* elf/Makefile: Add rules to build and run unload6 test.
* elf/unload6.c: New test.
* elf/unload6mod1.c: New file.
* elf/unload6mod2.c: New file.
* elf/unload6mod3.c: New file.
* malloc/hooks.c (mem2chunk_check): Add magic_p argument, set *magic_p
if magic_p is not NULL.
(top_check): Invoke MALLOC_FAILURE_ACTION if MORECORE failed.
(malloc_check): Fail if sz == -1.
(free_check): Adjust mem2chunk_check caller.
(realloc_check): Likewise. Fail if bytes == -1. If bytes == 0 and
oldmem != NULL, call free_check and return NULL. If reallocating
and returning NULL, invert magic byte again to make oldmem valid
region for further checking.
(memalign_check): Fail if bytes == -1.
* malloc/Makefile: Add rules to build and run tst-mcheck.
* malloc/tst-mcheck.c: New test.
mallopt appropriately.
* malloc/malloc.h: Define M_PERTURB.
* malloc/malloc.c (perturb_byte): New variable.
(alloc_perturb, free_perturb): New macros.
(_int_malloc): Before returning, overwrite the memory if this is
requested.
(_int_free): Overwrite freed memory if requested.
(mALLOPt): Handle M_PERTURB.
* test-skeleton.c: Add call to mallopt with M_PERTURB command.
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>
* misc/sys/cdefs.h (__attribute_warn_unused_result__): Define.
* stdlib/stdlib.h: Make realloc with
__attribute_warn_unused_result__ instead of __wur.
* malloc/malloc.h: Add __wur and __attribute_warn_unused_result__
markers as in <stdlib.h>.
Update.
2004-10-19 Wolfram Gloger <wg@malloc.de>
* malloc/hooks.c (mem2chunk_check, top_check): Handle
non-contiguous arena. Reported by Michael Dalton
<mwdalton@stanford.edu> [BZ #457]. Add further checks for top chunk.
2004-12-11 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (_int_realloc): Add checks for corrupted memory.
(_int_free): Make clear message are result of free() calls.
* malloc/malloc.c (_int_realloc): Remove unnecessary tests for
oldmem and size == 0.
2004-11-19 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (_int_free): Add a few more cheap tests for
corruption.
* debug/fprintf_chk.c: Adjust all users.
2004-11-13 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (malloc_state): stat_lock_* elements need only
be defined if THREAD_STATS is defined. Remove pad0_ since it does
not align with cache line sizes in general anyway.
2004-11-13 Jakub Jelinek <jakub@redhat.com>
* elf/rtld.c (print_statistics): Avoid segfaults if not all namespaces
are used. Fix computation of num_relative_relocations on RELA
architectures other than IA-64 and Alpha.
2004-11-13 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (_int_free): Use munmap_chunk for handling
mmaped memory.
2004-11-12 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/libc_fatal.c: Add new function __libc_message
which performs the printing and simple format string handling. The
string is written to tty, stderr, syslog in this order, stopping after
the first successful output.
(__libc_fatal): Call __libc_message.
* include/stdio.h: Declare __libc_message.
* malloc/malloc.c (malloc_printerr): Use __libc_message.
* debug/chk_fail.c: Also print message with __libc_message.
* debug/test-strcpy_chk.c: Ensure that debug messages are not printed
to the terminal or stderr.
* debug/tst-chk1.c: Likewise.
* posix/Makefile: Remove gpl2lgpl variable.
2004-10-30 Andreas Schwab <schwab@suse.de>
* sysdeps/unix/sysv/linux/waitid.c: Include <stddef.h> for NULL.
2004-10-30 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (_int_free): Use unique comments for the error
cases.
2004-10-18 Jakub Jelinek <jakub@redhat.com>
* elf/dl-libc.c (__libc_dlsym_private, __libc_register_dl_open_hook):
New functions.
(__libc_dlopen_mode): Call __libc_register_dl_open_hook and
__libc_register_dlfcn_hook.
* dlfcn/Makefile (routines, elide-routines.os): Set.
Add rules to build and test tststatic2.
* dlfcn/tststatic2.c: New test.
* dlfcn/modstatic2.c: New test module.
* dlfcn/dladdr.c: Call _dlfcn_hook from libdl.so if not NULL.
Define __ prefixed routine in libc.a and in libdl.a just call it.
* dlfcn/dladdr1.c: Likewise.
* dlfcn/dlclose.c: Likewise.
* dlfcn/dlerror.c: Likewise.
* dlfcn/dlinfo.c: Likewise.
* dlfcn/dlmopen.c: Likewise.
* dlfcn/dlopen.c: Likewise.
* dlfcn/dlopenold.c: Likewise.
* dlfcn/dlsym.c: Likewise.
* dlfcn/dlvsym.c: Likewise.
* dlfcn/sdladdr.c: New file.
* dlfcn/sdladdr1.c: New file.
* dlfcn/sdlclose.c: New file.
* dlfcn/sdlerror.c: New file.
* dlfcn/sdlinfo.c: New file.
* dlfcn/sdlopen.c: New file.
* dlfcn/sdlsym.c: New file.
* dlfcn/sdlvsym.c: New file.
* dlfcn/Versions (libdl): Export _dlfcn_hook@GLIBC_PRIVATE.
* include/dlfcn.h (DL_CALLER_DECL, DL_CALLER RETURN_ADDRESS): Define.
(struct dlfcn_hook): New type.
(_dlfcn_hook): New extern decl.
(__dlopen, __dlclose, __dlsym, __dlerror, __dladdr, __dladdr1,
__dlinfo, __dlmopen, __libc_dlsym_private,
__libc_register_dl_open_hook, __libc_register_dlfcn_hook): New
prototypes.
(__dlvsym): Use DL_CALLER_DECL.
* include/libc-symbols.h: Define libdl_hidden_proto and friends.
* malloc/arena.c (_dl_open_hook): Extern decl.
(ptmalloc_init): Don't call _dl_addr when dlopened from statically
linked programs but don't use brk for them either.
Update.
Add support for namespaces in the dynamic linker.
* dlfcn/Makefile (libdl-routines): Add dlmopen.
* dlfcn/Versions [libdl, GLIBC_2.3.4]: Add dlmopen.
* dlfcn/dlfcn.h: Define Lmid_t, LM_ID_BASE, and LM_ID_NEWLM.
Declare dlmopen. Document RTLD_DI_LMID.
* dlfcn/dlinfo.c: Handle RTLD_DI_LMID.
* dlfcn/dlmopen.c: New file.
* dlfcn/dlopen.c: Pass new parameter to _dl_open.
* dlfcn/dlopenold.c: Likewise.
* elf/dl-addr.c: Adjust for removal of GL(dl_loaded).
* elf/dl-caller.c: Likewise.
* elf/dl-close.c: Likewise.
* elf/dl-conflict.c: Likewise.
* elf/dl-debug.c: Likewise.
* elf/dl-lookup.c: Likewise.
* elf/dl-sym.c: Likewise.
* elf/dl-version.c: Likewise.
* elf/do-lookup.h: Likewise.
* elf/rtld.c: Likewise.
* sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise.
* elf/dl-depsc: Likewise. Add new parameter to _dl_map_object.
* elf/dl-fini.c: Call destructors in all namespaces.
* elf/dl-iteratephdr.c: Compute total nloaded. Adjust for removal of
GL(dl_loaded).
* elf/dl-libc.c: Pass new parameter to _dl_open. Adjust for removal
of GL(dl_loaded).
* elf/dl-load.c (_dl_map_object_from_fd): Don't load ld.so a second
time. Reuse the one from the main namespace in all others.
Pass new parameter to _dl_new_object.
Adjust for removal of GL(dl_loaded).
* elf/dl-object.c: Take new parameter. Use it to initialize l_ns.
Adjust for removal of GL(dl_loaded).
* elf/dl-open.c (_dl_open): Take new parameter.
Adjust for removal of GL(dl_loaded).
* elf/dl-support.c: Replace global _dl_loaded etc variables with
_dl_ns variable.
* include/dlfcn.h: Adjust prototype of _dl_open.
Define __LM_ID_CALLER.
* include/link.h: Add l_real, l_ns, and l_direct_opencount elements.
* sysdeps/generic/dl-tls.c: Bump TLS_STATIC_SURPLUS. Since libc is
using TLS we need memory appropriate to the number of namespaces.
* sysdeps/generic/ldsodefs.h (struct rtld_global): Replace _dl_loaded,
_dl_nloaded, _dl_global_scope, _dl_main_searchlist, and
_dl_global_scope_alloc with _dl_ns element. Define DL_NNS.
Adjust prototypes of _dl_map_object and member in rtld_global_ro.
* malloc/malloc.c: Include <dlfcn.h>.
* malloc/arena.c (ptmalloc_init): If libc is not in primary namespace,
never use brk.
* elf/Makefile: Add rules to build and run tst-dlmopen1 and
tst-dlmopen2.
* elf/tst-dlmopen1.c: New file.
* elf/tst-dlmopen1mod.c: New file.
* elf/tst-dlmopen2.c: New file.
* elf/dl-close.c: Improve reference counting by tracking direct loads.
* elf/dl-lookup.c (add_dependency): Likewise.
* elf/dl-open.c (dl_open_worker): Likewise.
* elf/rtld.c (dl_main): Likewise.
2004-09-09 GOTO Masanori <gotom@debian.or.jp>
[BZ #77]
* elf/dl-close.c: Count down l_opencount to check not only for
l_reldeps, but also l_initfini.
2004-10-13 Ulrich Drepper <drepper@redhat.com>
* posix/tst-getaddrinfo2.c: Include stdlib.h and string.h.
(do_test): Use %p instead of 0x%08X to print a pointer.
* malloc/malloc.c: Include stdio-common/_itoa.h.
2004-10-04 Ulrich Drepper <drepper@redhat.com>
* malloc/mtrace.pl: Avoid calling location unless it is needed for
output. Patch by Edward Bishop <binutils@gmail.com>.
* nscd/Makefile (CFLAGS-gai.c): Add -fpie.
2004-03-18 Jakub Jelinek <jakub@redhat.com>
* malloc/arena.c (aligned_heap_area): New variable.
(new_heap): If aligned_heap_area != NULL, attempt to use that
first. If HEAP_MAX_SIZE << 1 area is already HEAP_MAX_SIZE bytes
aligned, remember the second half in aligned_heap_area.
(delete_heap): Clear aligned_heap_area if deleting the area right
before aligned_heap_area.
* malloc/malloc.c (_int_free): Add inexpensive double free and
memory corruption tests.
(malloc_printf_nc): Renamed to malloc_printerr. Second parameter
is no format string anymore. Don't use stdio. Adjust all callers.
* malloc/hooks.c: Adjust malloc_printf_nc callers.
* malloc/hooks.c (DEFAULT_CHECK_ACTION): Moved to malloc.c.
(check_action): Likewise.
When printing error messages, use malloc_printf_nc now instead of
fiddling with the streams cancellation flag in every place.
* malloc/malloc.c (DEFAULT_CHECK_ACTION): New definition. Change
default to 3.
(check_action): New variable.
(unlink): Print error message and eventually terminate in case list
is corrupted.
(malloc_printf_nc): New function. Use it in _int_free.
Change proposed by Arjan van de Ven.
2004-08-13 Ulrich Drepper <drepper@redhat.com>
* elf/sprof.c (read_symbols): When comparing aliases, prefer
strong over weak symbols if both don't start with '_'.
* malloc/malloc.c: Use strong_alias instead of weak_alias wherever
possible.
Update.
* malloc/memusage.c (me): Use creat64, not creat.
* malloc/memusagestat.c: Fix handling of very large sizes. [BZ #285]
Patch by Guy Maor <guymaor@yahoo.com>.
2004-05-25 Ulrich Drepper <drepper@redhat.com>
* nss/digits_dots.c (__nss_hostname_digits_dots): Remove typep and
flags parameter, convert afp to simple int parameter. Adjust code.
typep was never != NULL and flags therefore also unused. *afp is
never modified.
* nss/nsswitch.h: Adjust __nss_hostname_digits_dots prototype.
* nss/getXXbyYY.c: Remove HAVE_TYPE handling. Adjust af parameter
handling for __nss_hostname_digits_dots calls.
* nss/getXXbyYY_r.c: Likewise.
* elf/dl-load.c (_dl_map_object_from_fd): Map DSOs with MAP_DENYWRITE.
2004-05-20 Paul Eggert <eggert@cs.ucla.edu>
* malloc/obstack.c (_obstack) [!defined _LIBC]: Remove; not used.
Add comment explaining why libc still defines it.
Update.
2004-05-18 Petter Reinholdtsen <pere@hungry.com>
* locales/sl_SI [LC_TIME]: Correct d_fmt date format from
'22.06.2003' to '22. 06. 2003'. Change requested from Aleks
Reinhardt, and approved by the locale author Borka
Jerman-Blazic. [BZ #163]
2003-12-17 Jakub Jelinek <jakub@redhat.com>
* malloc/mtrace.c (tr_old_memalign_hook): New variable.
(tr_memalignhook): New function.
(mtrace): Register tr_memalignhook.
(muntrace): Deregister tr_memalignhook.
* malloc/malloc.c (__posix_memalign): If __memalign_hook != NULL,
call it directly instead of memalign_internal.
2003-12-17 Ulrich Drepper <drepper@redhat.com>
* misc/mntent_r.c: Change encoding to match recently change decoder.
Patch by Alexander Achenbach <xela@slit.de>.
2003-12-16 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Correct definition of
vrregset_t.
2003-12-16 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/sys/procfs.h [!__PPC64_ELF_H]: Extent
conditional to include typedef elf_vrreg_t.
2002-12-17 Paolo Bonzini <bonzini@gnu.org>
* posix/regexec.c (re_search_internal): Limit search to the
beginning of the buffer if the initial states are empty for
contexts that do not include CONTEXT_BEGBUF or, if
!preg->newline_anchor, that do not include any one of
CONTEXT_BEGBUF and CONTEXT_NEWLINE.
2003-09-27 Wolfram Gloger <wg@malloc.de>
* malloc/malloc.c: Include <malloc-machine.h> earlier instead of
"thread-m.h", so that default parameters can be overridden in a
system-specific malloc-machine.h. Remove extra ; from extern "C"
closing brace.
* sysdeps/generic/malloc-machine.h: New file.
* sysdeps/mach/hurd/malloc-machine.h: New file.
* malloc/thread-m.h: Removed.
* malloc/Makefile: Remove CFLAGS-malloc.c parameter addition, it
is in sysdeps/generic/malloc-machine.h now.
* elf/dl-reloc.c (_dl_allocate_static_tls): Move definition of
variables only used if TLS_TCB_AT_TP is defined into the #if
branch.
2003-05-08 Ulrich Drepper <drepper@redhat.com>
* malloc/thread-m.h: Remove special handling of thread_atfork if
HAVE_register_atfork_malloc is defined.
* sysdeps/unix/sysv/linux/Makefile: Remove db2 directory handling.
* malloc/Makefile (CFLAGS-malloc.c): Define DEFAULT_TOP_PAD to 128k.
* sysdeps/unix/sysv/linux/Makefile (CFLAGS-malloc.c): Add to, not
replace.
2003-04-05 Ulrich Drepper <drepper@redhat.com>
* malloc/thread-m.h [PTHREAD_MUTEX_INITIALIZER]: If
HAVE_register_atfork_malloc is defined use __register_atfork_malloc
instead of __register_atfork.
Add comment.
(atomic_decrement_and_test): Add comment.
2003-03-22 Jakub Jelinek <jakub@redhat.com>
* include/atomic.h (atomic_compare_and_exchange_val_acq): Add comment.
Don't define if __arch_compare_and_exchange_val_32_acq is not defined.
(atomic_compare_and_exchange_bool_acq): Add comment. Don't use
__oldval variable in the macro, since it might be macro argument.
(atomic_decrement_if_positive): Initialize __memp, remove setting
of non-existent variable.
(atomic_bit_test_set): Cast 1 to __typeof (*mem) before shifting.
* sysdeps/ia64/bits/atomic.h (atomic_exchange_and_add): Implement
using atomic_compare_and_exchange_val_acq.
(atomic_decrement_if_positive, atomic_bit_test_set): Define.
* sysdeps/s390/bits/atomic.h (__arch_compare_and_exchange_val_8_acq):
Renamed from...
(__arch_compare_and_exchange_bool_8_acq): ... this.
(__arch_compare_and_exchange_val_16_acq): Renamed from...
(__arch_compare_and_exchange_bool_16_acq): ... this.
(__arch_compare_and_exchange_val_32_acq): Return old value. Renamed
from...
(__arch_compare_and_exchange_bool_32_acq): ... this.
(__arch_compare_and_exchange_val_64_acq): Return old value. Renamed
from...
(__arch_compare_and_exchange_bool_64_acq): ... this.
(__arch_compare_and_exchange_val_32_acq): Use __typeof for local
variables types instead of assuming int.
Change prefix of local variables to __arch.
* sysdeps/generic/bits/atomic.h (arch_compare_and_exchange_acq):
Remove.
(atomic_compare_and_exchange_val_acq,
atomic_compare_and_exchange_bool_acq): Define.
* csu/tst-atomic.c: New test.
* csu/tst-atomic-long.c: New test.
* csu/Makefile (tests): Add tst-atomic and tst-atomic-long.
* malloc/memusagestat.c (main): Kill warning if uint64_t is ulong.
* sysdeps/s390/Versions: Add trailing newline.
* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Kill warning
if INTERNAL_SYSCALL_ERROR_P doesn't use its first argument.
* malloc/thread-freeres.c: New file.
* malloc/Makefile (aux): Add it.
* sunrpc/Versions (GLIBC_PRIVATE): Removed.
* sunrpc/rpc_thread.c (__rpc_thread_destroy): Put in special section
"__libc_thread_freeres_fn" and add to __libc_thread_subfreeres set.
* sysdeps/unix/sysv/linux/i386/geteuid.c (__geteuid): Typo fix.
* sysdeps/unix/sysv/linux/i386/getgid.c (__getgid): Typo fix.
2003-02-21 Roland McGrath <roland@frob.com>
* sysdeps/mach/hurd/opendir.c (__opendir): Use O_NONBLOCK in open.
* iconvdata/Makefile (tests): Add bug-iconv3 only if
[$(have-thread-library) = yes].
* malloc/obstack.h (__INT_TO_PTR) [__STDC__]: Cast result to
(void *) to avoid diagnostic with native c89 on SGI IRIX 6.5
when compiling Bison 1.875's `bitset bset = obstack_alloc
(bobstack, bytes);'. Problem reported by Nelson H. F. Beebe.