diff options
| author | Ulrich Drepper <drepper@redhat.com> | 1996-12-21 04:13:58 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 1996-12-21 04:13:58 +0000 |
| commit | 7e3be507eed53cfe516ec101f312dac160e43bad (patch) | |
| tree | b51330919edcf15ebfb4c87f5b3338c2a426e4e4 | |
| parent | 6d52618b15cbe25ed4822ac51321db292f28ccda (diff) | |
| download | glibc-7e3be507eed53cfe516ec101f312dac160e43bad.tar.xz glibc-7e3be507eed53cfe516ec101f312dac160e43bad.zip | |
update from main archive 961220cvs/libc-961221
Sat Dec 21 04:14:16 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/common/pause.c: Add missing second argument in
call to __sigpause.
Reported by a sun <asun@zoology.washington.edu>.
* locale/weight.h: Correct handling of collation elements.
Reported by Keld Simonsen <keld@dkuug.dk>.
* manual/time.texi: Document ^ flag and %P format.
* new-malloc/malloc.c: Update from Wolfram Gloger.
* nss/nss.h: Reformat copyright.
* posix/sched.h: Likewise.
* sysdeps/i386/fpu_control.h: Likewise.
* sysdeps/unix/sysv/linux/fcntlbits.h: Likewise.
* sysdeps/unix/sysv/linux/ioctls.h: Likewise.
* sysdeps/unix/sysv/linux/sigcontext.h: Likewise.
* sysdeps/unix/sysv/linux/utsnamelen.h: Likewise.
* sysdeps/unix/sysv/linux/sys/acct.h: Likewise.
* sysvips/sys/msg.h: Likewise.
* stdio-common/Makefile (routines): Remove fcloseall.
* stdio-common/fcloseall.c: Removed.
* stdlib/Makefile (distribute): Add abort-instr.h.
* sysdeps/generic/abort-instr.h: New file.
* sysdeps/i386/abort-instr.h: New file.
* sysdeps/generic/abort.c: Use lock and stage counter to prevent
any form of loop.
* sysdeps/unix/sysv/linux/timebits.h: Define CLK_TCK as 100.
* sysdeps/unix/sysv/linux/alpha/timebits.h: Define CLOCKS_PER_SEC
as 1000000. Define CLK_TCK as 1024.
* time/time.c (CLK_TCK): Define only if not already set.
* time/strftime.c: Don't use `isdigit' when computing field width
from string since the locale might have more than one digit
block.
Fri Dec 20 12:38:14 1996 Darrel Hankerson <hankedr@mail.auburn.edu>
* posix/getopt.c (in -W option handling): Return when optind == argc.
Thu Dec 19 14:24:50 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* nis/nss_nis/nis-alias.c (_nss_nis_parse_aliasent): Add const to
type of KEY.
* nis/nss_compat/compat-grp.c: Include the declaration of the file
parser.
* nis/nss_compat/compat-pwd.c: Likewise.
* nis/nss_compat/compat-spwd.c: Likewise.
* nis/nss_nis/nis-ethers.c: Likewise.
* nis/nss_nis/nis-grp.c: Likewise.
* nis/nss_nis/nis-network.c: Likewise.
* nis/nss_nis/nis-proto.c: Likewise.
* nis/nss_nis/nis-pwd.c: Likewise.
* nis/nss_nis/nis-rpc.c: Likewise.
* nis/nss_nis/nis-spwd.c: Likewise.
* nis/nss_compat/compat-grp.c (getgrent_next_nis,
getgrent_next_file): Pass the correct type for the buffer to the
parser function.
* nis/nss_compat/compat-pwd.c (getpwent_next_netgr,
getpwent_next_nis, getpwent_next_file): Likewise.
* nis/nss_compat/compat-spwd.c (getspent_next_netgr,
getspent_next_nis, getspent_next_file): Likewise.
* nis/nss_nis/nis-ethers.c (internal_nis_getetherent_r,
_nss_nis_getethernam_r, _nss_nis_getetherbyaddr_r): Likewise.
* nis/nss_nis/nis-grp.c (internal_nis_getgrent_r,
_nss_nis_getgrnam_r, _nss_nis_getgrgid_r): Likewise.
* nis/nss_nis/nis-network.c (internal_nis_getnetent_r,
_nss_nis_getnetbyname_r, _nss_nis_getnetbyaddr_r): Likewise.
* nis/nss_nis/nis-proto.c (internal_nis_getprotoent_r,
_nss_nis_getprotobyname_r, _nss_nis_getprotobynumber_r): Likewise.
* nis/nss_nis/nis-pwd.c (internal_nis_getpwent_r,
_nss_nis_getpwnam_r, _nss_nis_getpwuid_r): Likewise.
* nis/nss_nis/nis-rpc.c (internal_nis_getrpcent_r,
_nss_nis_getrpcbynumber_r): Likewise.
* nis/nss_nis/nis-spwd.c (internal_nis_getspent_r,
_nss_nis_getspnam_r): Likewise.
Thu Dec 19 13:37:16 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/m68k/setjmp.c: New file.
38 files changed, 765 insertions, 378 deletions
@@ -1,3 +1,91 @@ +Sat Dec 21 04:14:16 1996 Ulrich Drepper <drepper@cygnus.com> + + * sysdeps/unix/common/pause.c: Add missing second argument in + call to __sigpause. + Reported by a sun <asun@zoology.washington.edu>. + + * locale/weight.h: Correct handling of collation elements. + Reported by Keld Simonsen <keld@dkuug.dk>. + + * manual/time.texi: Document ^ flag and %P format. + + * new-malloc/malloc.c: Update from Wolfram Gloger. + + * nss/nss.h: Reformat copyright. + * posix/sched.h: Likewise. + * sysdeps/i386/fpu_control.h: Likewise. + * sysdeps/unix/sysv/linux/fcntlbits.h: Likewise. + * sysdeps/unix/sysv/linux/ioctls.h: Likewise. + * sysdeps/unix/sysv/linux/sigcontext.h: Likewise. + * sysdeps/unix/sysv/linux/utsnamelen.h: Likewise. + * sysdeps/unix/sysv/linux/sys/acct.h: Likewise. + * sysvips/sys/msg.h: Likewise. + + * stdio-common/Makefile (routines): Remove fcloseall. + * stdio-common/fcloseall.c: Removed. + + * stdlib/Makefile (distribute): Add abort-instr.h. + * sysdeps/generic/abort-instr.h: New file. + * sysdeps/i386/abort-instr.h: New file. + * sysdeps/generic/abort.c: Use lock and stage counter to prevent + any form of loop. + + * sysdeps/unix/sysv/linux/timebits.h: Define CLK_TCK as 100. + * sysdeps/unix/sysv/linux/alpha/timebits.h: Define CLOCKS_PER_SEC + as 1000000. Define CLK_TCK as 1024. + * time/time.c (CLK_TCK): Define only if not already set. + + * time/strftime.c: Don't use `isdigit' when computing field width + from string since the locale might have more than one digit + block. + +Fri Dec 20 12:38:14 1996 Darrel Hankerson <hankedr@mail.auburn.edu> + + * posix/getopt.c (in -W option handling): Return when optind == argc. + +Thu Dec 19 14:24:50 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * nis/nss_nis/nis-alias.c (_nss_nis_parse_aliasent): Add const to + type of KEY. + + * nis/nss_compat/compat-grp.c: Include the declaration of the file + parser. + * nis/nss_compat/compat-pwd.c: Likewise. + * nis/nss_compat/compat-spwd.c: Likewise. + * nis/nss_nis/nis-ethers.c: Likewise. + * nis/nss_nis/nis-grp.c: Likewise. + * nis/nss_nis/nis-network.c: Likewise. + * nis/nss_nis/nis-proto.c: Likewise. + * nis/nss_nis/nis-pwd.c: Likewise. + * nis/nss_nis/nis-rpc.c: Likewise. + * nis/nss_nis/nis-spwd.c: Likewise. + + * nis/nss_compat/compat-grp.c (getgrent_next_nis, + getgrent_next_file): Pass the correct type for the buffer to the + parser function. + * nis/nss_compat/compat-pwd.c (getpwent_next_netgr, + getpwent_next_nis, getpwent_next_file): Likewise. + * nis/nss_compat/compat-spwd.c (getspent_next_netgr, + getspent_next_nis, getspent_next_file): Likewise. + * nis/nss_nis/nis-ethers.c (internal_nis_getetherent_r, + _nss_nis_getethernam_r, _nss_nis_getetherbyaddr_r): Likewise. + * nis/nss_nis/nis-grp.c (internal_nis_getgrent_r, + _nss_nis_getgrnam_r, _nss_nis_getgrgid_r): Likewise. + * nis/nss_nis/nis-network.c (internal_nis_getnetent_r, + _nss_nis_getnetbyname_r, _nss_nis_getnetbyaddr_r): Likewise. + * nis/nss_nis/nis-proto.c (internal_nis_getprotoent_r, + _nss_nis_getprotobyname_r, _nss_nis_getprotobynumber_r): Likewise. + * nis/nss_nis/nis-pwd.c (internal_nis_getpwent_r, + _nss_nis_getpwnam_r, _nss_nis_getpwuid_r): Likewise. + * nis/nss_nis/nis-rpc.c (internal_nis_getrpcent_r, + _nss_nis_getrpcbynumber_r): Likewise. + * nis/nss_nis/nis-spwd.c (internal_nis_getspent_r, + _nss_nis_getspnam_r): Likewise. + +Thu Dec 19 13:37:16 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * sysdeps/unix/sysv/linux/m68k/setjmp.c: New file. + Thu Dec 19 23:28:33 1996 Ulrich Drepper <drepper@cygnus.com> * resolv/resolv.h: Update from BIND 4.9.5-P1. @@ -1,4 +1,4 @@ -/* interp - add information about dynamic loader to shared library obejcts. +/* interp - add information about dynamic loader to shared library objects. Copyright (C) 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/locale/weight.h b/locale/weight.h index 1b7b6eae81..0d6ef51722 100644 --- a/locale/weight.h +++ b/locale/weight.h @@ -118,7 +118,7 @@ get_weight (const STRING_TYPE **str, weight_t *result) /* This is a comparison between a u_int32_t array (aka wchar_t) and an 8-bit string. */ for (idx = 0; __collate_extra[slot + 2 + idx] != 0; ++idx) - if (__collate_extra[slot + 2 + idx] != (u_int32_t) str[idx]) + if (__collate_extra[slot + 2 + idx] != (u_int32_t) (*str)[idx]) break; /* When the loop finished with all character of the collation @@ -127,6 +127,7 @@ get_weight (const STRING_TYPE **str, weight_t *result) { size_t cnt; + *str += idx; idx += slot + 3; for (cnt = 0; cnt < collate_nrules; ++cnt) { diff --git a/malloc/malloc.c b/malloc/malloc.c index 840655f4db..7e71e9777a 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -179,7 +179,7 @@ Define to enable debugging. Adds fairly extensive assertion-based checking to help track down memory errors, but noticeably slows down execution. - MALLOC_HOOKS (default: NOT defined) + MALLOC_HOOKS (default: NOT defined) Define to enable support run-time replacement of the allocation functions through user-defined `hooks'. REALLOC_ZERO_BYTES_FREES (default: NOT defined) @@ -298,7 +298,7 @@ #if __STD_C # include <stddef.h> /* for size_t */ # if defined(_LIBC) || defined(MALLOC_HOOKS) -# include <stdlib.h> /* for getenv() */ +# include <stdlib.h> /* for getenv(), abort() */ # endif #else # include <sys/types.h> @@ -315,13 +315,6 @@ extern "C" { #include <stdio.h> /* needed for malloc_stats */ -/* We must not pollute the name space in the GNU libc. */ -#ifdef _LIBC -#define malloc_stats __malloc_stats -#define malloc_usable_size __malloc_usable_size -#define malloc_trim __malloc_trim -#endif - /* Compile-time options @@ -878,6 +871,9 @@ extern Void_t* sbrk(); #define pvALLOc __libc_pvalloc #define mALLINFo __libc_mallinfo #define mALLOPt __libc_mallopt +#define mALLOC_STATs __malloc_stats +#define mALLOC_USABLE_SIZe __malloc_usable_size +#define mALLOC_TRIm __malloc_trim #else @@ -890,6 +886,9 @@ extern Void_t* sbrk(); #define pvALLOc pvalloc #define mALLINFo mallinfo #define mALLOPt mallopt +#define mALLOC_STATs malloc_stats +#define mALLOC_USABLE_SIZe malloc_usable_size +#define mALLOC_TRIm malloc_trim #endif @@ -908,12 +907,9 @@ Void_t* vALLOc(size_t); Void_t* pvALLOc(size_t); Void_t* cALLOc(size_t, size_t); void cfree(Void_t*); -int __malloc_trim(size_t); -int malloc_trim(size_t); -size_t __malloc_usable_size(Void_t*); -size_t malloc_usable_size(Void_t*); -void __malloc_stats(void); -void malloc_stats(void); +int mALLOC_TRIm(size_t); +size_t mALLOC_USABLE_SIZe(Void_t*); +void mALLOC_STATs(void); int mALLOPt(int, int); struct mallinfo mALLINFo(void); #else @@ -928,12 +924,9 @@ Void_t* vALLOc(); Void_t* pvALLOc(); Void_t* cALLOc(); void cfree(); -int __malloc_trim(); -int malloc_trim(); -size_t _malloc_usable_size(); -size_t malloc_usable_size(); -void __malloc_stats(); -void malloc_stats(); +int mALLOC_TRIm(); +size_t mALLOC_USABLE_SIZe(); +void mALLOC_STATs(); int mALLOPt(); struct mallinfo mALLINFo(); #endif @@ -1166,9 +1159,9 @@ typedef struct _heap_info { static void chunk_free(arena *ar_ptr, mchunkptr p); static mchunkptr chunk_alloc(arena *ar_ptr, INTERNAL_SIZE_T size); static mchunkptr chunk_realloc(arena *ar_ptr, mchunkptr oldp, - INTERNAL_SIZE_T oldsize, INTERNAL_SIZE_T nb); + INTERNAL_SIZE_T oldsize, INTERNAL_SIZE_T nb); static mchunkptr chunk_align(arena *ar_ptr, INTERNAL_SIZE_T nb, - size_t alignment); + size_t alignment); static int main_trim(size_t pad); #ifndef NO_THREADS static int heap_trim(heap_info *heap, size_t pad); @@ -1178,6 +1171,8 @@ static Void_t* malloc_check(size_t sz); static void free_check(Void_t* mem); static Void_t* realloc_check(Void_t* oldmem, size_t bytes); static Void_t* memalign_check(size_t alignment, size_t bytes); +static Void_t* malloc_starter(size_t sz); +static void free_starter(Void_t* mem); #endif #else @@ -1195,6 +1190,8 @@ static Void_t* malloc_check(); static void free_check(); static Void_t* realloc_check(); static Void_t* memalign_check(); +static Void_t* malloc_starter(); +static void free_starter(); #endif #endif @@ -1434,7 +1431,7 @@ static arena main_arena = { IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119), IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127) }, - NULL, /* next */ + &main_arena, /* next */ 0, /* size */ #if THREAD_STATS 0, 0, 0, /* stat_lock_direct, stat_lock_loop, stat_lock_wait */ @@ -1489,8 +1486,9 @@ static unsigned long max_mmapped_mem = 0; -/* Already initialized? */ -int __malloc_initialized; + +/* Already initialized? */ +int __malloc_initialized = 0; /* Initialization routine. */ @@ -1507,11 +1505,22 @@ ptmalloc_init __MALLOC_P((void)) #endif { #if defined(_LIBC) || defined(MALLOC_HOOKS) + __malloc_ptr_t (*save_malloc_hook) __MALLOC_P ((size_t __size)); + void (*save_free_hook) __MALLOC_P ((__malloc_ptr_t __ptr)); const char* s; #endif if(__malloc_initialized) return; __malloc_initialized = 1; +#if defined(_LIBC) || defined(MALLOC_HOOKS) + /* With some threads implementations, creating thread-specific data + or initializing a mutex may call malloc() itself. Provide a + simple starter version (realloc() won't work). */ + save_malloc_hook = __malloc_hook; + save_free_hook = __free_hook; + __malloc_hook = malloc_starter; + __free_hook = free_starter; +#endif #if defined(_LIBC) /* Initialize the pthreads interface. */ if (__pthread_initialize != NULL) @@ -1525,6 +1534,8 @@ ptmalloc_init __MALLOC_P((void)) #endif #if defined(_LIBC) || defined(MALLOC_HOOKS) s = getenv("MALLOC_CHECK_"); + __malloc_hook = save_malloc_hook; + __free_hook = save_free_hook; if(s) { if(s[0]) mallopt(M_CHECK_ACTION, (int)(s[0] - '0')); malloc_check_init(); @@ -1598,7 +1609,8 @@ malloc_check_init() __free_hook = free_check; __realloc_hook = realloc_check; __memalign_hook = memalign_check; - fprintf(stderr, "Using debugging hooks\n"); + if(check_action == 1) + fprintf(stderr, "malloc: using debugging hooks\n"); } #endif @@ -1821,17 +1833,16 @@ grow_heap(h, diff) heap_info *h; long diff; /* arena_get() acquires an arena and locks the corresponding mutex. First, try the one last locked successfully by this thread. (This is the common case and handled with a macro for speed.) Then, loop - over the singly linked list of arenas. If no arena is readily - available, create a new one. */ + once over the circularly linked list of arenas. If no arena is + readily available, create a new one. */ #define arena_get(ptr, size) do { \ Void_t *vptr = NULL; \ ptr = (arena *)tsd_getspecific(arena_key, vptr); \ if(ptr && !mutex_trylock(&ptr->mutex)) { \ THREAD_STAT(++(ptr->stat_lock_direct)); \ - } else { \ + } else \ ptr = arena_get2(ptr, (size)); \ - } \ } while(0) static arena * @@ -1847,17 +1858,27 @@ arena_get2(a_tsd, size) arena *a_tsd; size_t size; int i; unsigned long misalign; - /* Check the singly-linked list for unlocked arenas. */ - if(a_tsd) { - for(a = a_tsd->next; a; a = a->next) { - if(!mutex_trylock(&a->mutex)) - goto done; + if(!a_tsd) + a = a_tsd = &main_arena; + else { + a = a_tsd->next; + if(!a) { + /* This can only happen while initializing the new arena. */ + (void)mutex_lock(&main_arena.mutex); + THREAD_STAT(++(main_arena.stat_lock_wait)); + return &main_arena; } } - for(a = &main_arena; a != a_tsd; a = a->next) { - if(!mutex_trylock(&a->mutex)) - goto done; - } + + /* Check the global, circularly linked list for available arenas. */ + do { + if(!mutex_trylock( |
