[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r16923 - in /fsf/trunk/libc: ./ elf/ libio/ locale/programs/ malloc/ stdlib/ sysdeps/powerpc/bits/ sysdeps/sh/sh4/bits/ sysd...
- To: commits@xxxxxxxxxx
- Subject: [Commits] r16923 - in /fsf/trunk/libc: ./ elf/ libio/ locale/programs/ malloc/ stdlib/ sysdeps/powerpc/bits/ sysdeps/sh/sh4/bits/ sysd...
- From: eglibc@xxxxxxxxxx
- Date: Wed, 01 Feb 2012 00:01:52 -0000
Author: eglibc
Date: Wed Feb 1 00:01:51 2012
New Revision: 16923
Log:
Import glibc-mainline for 2012-02-01
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/elf/dl-tls.c
fsf/trunk/libc/libio/libio.h
fsf/trunk/libc/locale/programs/config.h
fsf/trunk/libc/malloc/arena.c
fsf/trunk/libc/malloc/hooks.c
fsf/trunk/libc/malloc/malloc.c
fsf/trunk/libc/stdlib/strtol_l.c
fsf/trunk/libc/sysdeps/powerpc/bits/mathdef.h
fsf/trunk/libc/sysdeps/sh/sh4/bits/mathdef.h
fsf/trunk/libc/sysdeps/sparc/bits/mathdef.h
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Feb 1 00:01:51 2012
@@ -1,3 +1,37 @@
+2012-01-31 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/powerpc/bits/mathdef.h (float_t): Always define as
+ float.
+ * sysdeps/sh/sh4/bits/mathdef.h: Likewise.
+ * sysdeps/sparc/bits/mathdef.h: Likewise.
+
+2012-01-31 Marek Polacek <polacek@xxxxxxxxxx>
+
+ * libio/libio.h: Don't define _PARAMS.
+ * locale/programs/config.h: Don't define PARAMS.
+ * stdlib/strtol_l.c: Likewise.
+ (__strtol_l): Remove PARAMS from the prototype.
+
+2012-01-31 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ * malloc/malloc.c: Remove name translation. Don't use mixed-cap
+ names. Just use the correct names. Remove unnecessary wrapper
+ functions.
+ * malloc/arena.c: Likewise.
+ * malloc/hooks.c: Likewise.
+
+ * malloc/arena.c (arena_get2): Really don't call __get_nprocs if
+ ARENA_TEST says not to. Simplify test for creation of a new arena.
+ Partially based on a patch by Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>.
+
+2012-01-30 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ * elf/dl-tls.c (__tls_get_addr): Optimize by transforming all calls
+ into tail calls.
+ (update_get_addr): New function.
+ (tls_get_addr_tail): Take GET_ADDR_ARGS parameter, remove
+ GET_ADDR_MODULE parameter.
+
2012-01-30 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
* crypt/cert.c: Remove __STDC__ conditionals.
@@ -33,7 +67,6 @@
2012-01-30 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
* configure.in (libc_cv_cc_sse2avx): AC_SUBST.
- * configure: Regenerate.
* config.make.in (config-cflags-sse2avx): Define.
* sysdeps/x86_64/fpu/multiarch/Makefile (CFLAGS-slowexp-avx.c):
Fix typo.
Modified: fsf/trunk/libc/elf/dl-tls.c
==============================================================================
--- fsf/trunk/libc/elf/dl-tls.c (original)
+++ fsf/trunk/libc/elf/dl-tls.c Wed Feb 1 00:01:51 2012
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. Generic version.
- Copyright (C) 2002-2006,2008,2011 Free Software Foundation, Inc.
+ Copyright (C) 2002-2006,2008,2011,2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -509,6 +509,7 @@
of the following macros. */
# ifndef GET_ADDR_ARGS
# define GET_ADDR_ARGS tls_index *ti
+# define GET_ADDR_PARAM ti
# endif
# ifndef GET_ADDR_MODULE
# define GET_ADDR_MODULE ti->ti_module
@@ -690,13 +691,13 @@
static void *
__attribute_noinline__
-tls_get_addr_tail (dtv_t *dtv, struct link_map *the_map, size_t module)
+tls_get_addr_tail (GET_ADDR_ARGS, dtv_t *dtv, struct link_map *the_map)
{
/* The allocation was deferred. Do it now. */
if (the_map == NULL)
{
/* Find the link map for this module. */
- size_t idx = module;
+ size_t idx = GET_ADDR_MODULE;
struct dtv_slotinfo_list *listp = GL(dl_tls_dtv_slotinfo_list);
while (idx >= listp->len)
@@ -728,18 +729,34 @@
if (__builtin_expect (the_map->l_tls_offset
!= FORCED_DYNAMIC_TLS_OFFSET, 1))
{
- void *p = dtv[module].pointer.val;
+ void *p = dtv[GET_ADDR_MODULE].pointer.val;
if (__builtin_expect (p == TLS_DTV_UNALLOCATED, 0))
goto again;
- return p;
+ return (char *) p + GET_ADDR_OFFSET;
}
}
}
- void *p = dtv[module].pointer.val = allocate_and_init (the_map);
- dtv[module].pointer.is_static = false;
-
- return p;
+ void *p = dtv[GET_ADDR_MODULE].pointer.val = allocate_and_init (the_map);
+ dtv[GET_ADDR_MODULE].pointer.is_static = false;
+
+ return (char *) p + GET_ADDR_OFFSET;
+}
+
+
+static struct link_map *
+__attribute_noinline__
+update_get_addr (GET_ADDR_ARGS)
+{
+ struct link_map *the_map = _dl_update_slotinfo (GET_ADDR_MODULE);
+ dtv_t *dtv = THREAD_DTV ();
+
+ void *p = dtv[GET_ADDR_MODULE].pointer.val;
+
+ if (__builtin_expect (p == TLS_DTV_UNALLOCATED, 0))
+ return tls_get_addr_tail (GET_ADDR_PARAM, dtv, the_map);
+
+ return (char *) p + GET_ADDR_OFFSET;
}
@@ -749,19 +766,14 @@
__tls_get_addr (GET_ADDR_ARGS)
{
dtv_t *dtv = THREAD_DTV ();
- struct link_map *the_map = NULL;
- void *p;
if (__builtin_expect (dtv[0].counter != GL(dl_tls_generation), 0))
- {
- the_map = _dl_update_slotinfo (GET_ADDR_MODULE);
- dtv = THREAD_DTV ();
- }
-
- p = dtv[GET_ADDR_MODULE].pointer.val;
+ return update_get_addr (GET_ADDR_PARAM);
+
+ void *p = dtv[GET_ADDR_MODULE].pointer.val;
if (__builtin_expect (p == TLS_DTV_UNALLOCATED, 0))
- p = tls_get_addr_tail (dtv, the_map, GET_ADDR_MODULE);
+ return tls_get_addr_tail (GET_ADDR_PARAM, dtv, NULL);
return (char *) p + GET_ADDR_OFFSET;
}
Modified: fsf/trunk/libc/libio/libio.h
==============================================================================
--- fsf/trunk/libc/libio/libio.h (original)
+++ fsf/trunk/libc/libio/libio.h Wed Feb 1 00:01:51 2012
@@ -66,11 +66,6 @@
# define __PMT(p) p
# endif
#endif /*!__P*/
-
-/* For backward compatibility */
-#ifndef _PARAMS
-# define _PARAMS(protos) __P(protos)
-#endif /*!_PARAMS*/
#define _IO_UNIFIED_JUMPTABLES 1
#ifndef _G_HAVE_PRINTF_FP
Modified: fsf/trunk/libc/locale/programs/config.h
==============================================================================
--- fsf/trunk/libc/locale/programs/config.h (original)
+++ fsf/trunk/libc/locale/programs/config.h Wed Feb 1 00:01:51 2012
@@ -29,10 +29,6 @@
#define DEFAULT_CHARMAP "ANSI_X3.4-1968" /* ASCII */
-#ifndef PARAMS
-# define PARAMS(args) args
-#endif
-
/* This must be one higer than the last used LC_xxx category value. */
#define __LC_LAST 13
Modified: fsf/trunk/libc/malloc/arena.c
==============================================================================
--- fsf/trunk/libc/malloc/arena.c (original)
+++ fsf/trunk/libc/malloc/arena.c Wed Feb 1 00:01:51 2012
@@ -185,7 +185,7 @@
mALLOc() can be used again. */
(void)mutex_lock(&list_lock);
(void)mutex_unlock(&list_lock);
- return public_mALLOc(sz);
+ return __libc_malloc(sz);
}
}
@@ -413,19 +413,19 @@
if (! __builtin_expect (__libc_enable_secure, 0))
{
if (memcmp (envline, "TOP_PAD_", 8) == 0)
- mALLOPt(M_TOP_PAD, atoi(&envline[9]));
+ __libc_mallopt(M_TOP_PAD, atoi(&envline[9]));
else if (memcmp (envline, "PERTURB_", 8) == 0)
- mALLOPt(M_PERTURB, atoi(&envline[9]));
+ __libc_mallopt(M_PERTURB, atoi(&envline[9]));
}
break;
case 9:
if (! __builtin_expect (__libc_enable_secure, 0))
{
if (memcmp (envline, "MMAP_MAX_", 9) == 0)
- mALLOPt(M_MMAP_MAX, atoi(&envline[10]));
+ __libc_mallopt(M_MMAP_MAX, atoi(&envline[10]));
#ifdef PER_THREAD
else if (memcmp (envline, "ARENA_MAX", 9) == 0)
- mALLOPt(M_ARENA_MAX, atoi(&envline[10]));
+ __libc_mallopt(M_ARENA_MAX, atoi(&envline[10]));
#endif
}
break;
@@ -434,7 +434,7 @@
if (! __builtin_expect (__libc_enable_secure, 0))
{
if (memcmp (envline, "ARENA_TEST", 10) == 0)
- mALLOPt(M_ARENA_TEST, atoi(&envline[11]));
+ __libc_mallopt(M_ARENA_TEST, atoi(&envline[11]));
}
break;
#endif
@@ -442,9 +442,9 @@
if (! __builtin_expect (__libc_enable_secure, 0))
{
if (memcmp (envline, "TRIM_THRESHOLD_", 15) == 0)
- mALLOPt(M_TRIM_THRESHOLD, atoi(&envline[16]));
+ __libc_mallopt(M_TRIM_THRESHOLD, atoi(&envline[16]));
else if (memcmp (envline, "MMAP_THRESHOLD_", 15) == 0)
- mALLOPt(M_MMAP_THRESHOLD, atoi(&envline[16]));
+ __libc_mallopt(M_MMAP_THRESHOLD, atoi(&envline[16]));
}
break;
default:
@@ -453,7 +453,7 @@
}
}
if(s && s[0]) {
- mALLOPt(M_CHECK_ACTION, (int)(s[0] - '0'));
+ __libc_mallopt(M_CHECK_ACTION, (int)(s[0] - '0'));
if (check_action != 0)
__malloc_check_init();
}
@@ -543,39 +543,38 @@
p2 = MAP_FAILED;
if(aligned_heap_area) {
p2 = (char *)MMAP(aligned_heap_area, HEAP_MAX_SIZE, PROT_NONE,
- MAP_PRIVATE|MAP_NORESERVE);
+ MAP_NORESERVE);
aligned_heap_area = NULL;
if (p2 != MAP_FAILED && ((unsigned long)p2 & (HEAP_MAX_SIZE-1))) {
- munmap(p2, HEAP_MAX_SIZE);
+ __munmap(p2, HEAP_MAX_SIZE);
p2 = MAP_FAILED;
}
}
if(p2 == MAP_FAILED) {
- p1 = (char *)MMAP(0, HEAP_MAX_SIZE<<1, PROT_NONE,
- MAP_PRIVATE|MAP_NORESERVE);
+ p1 = (char *)MMAP(0, HEAP_MAX_SIZE<<1, PROT_NONE, MAP_NORESERVE);
if(p1 != MAP_FAILED) {
p2 = (char *)(((unsigned long)p1 + (HEAP_MAX_SIZE-1))
& ~(HEAP_MAX_SIZE-1));
ul = p2 - p1;
if (ul)
- munmap(p1, ul);
+ __munmap(p1, ul);
else
aligned_heap_area = p2 + HEAP_MAX_SIZE;
- munmap(p2 + HEAP_MAX_SIZE, HEAP_MAX_SIZE - ul);
+ __munmap(p2 + HEAP_MAX_SIZE, HEAP_MAX_SIZE - ul);
} else {
/* Try to take the chance that an allocation of only HEAP_MAX_SIZE
is already aligned. */
- p2 = (char *)MMAP(0, HEAP_MAX_SIZE, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE);
+ p2 = (char *)MMAP(0, HEAP_MAX_SIZE, PROT_NONE, MAP_NORESERVE);
if(p2 == MAP_FAILED)
return 0;
if((unsigned long)p2 & (HEAP_MAX_SIZE-1)) {
- munmap(p2, HEAP_MAX_SIZE);
+ __munmap(p2, HEAP_MAX_SIZE);
return 0;
}
}
}
- if(mprotect(p2, size, PROT_READ|PROT_WRITE) != 0) {
- munmap(p2, HEAP_MAX_SIZE);
+ if(__mprotect(p2, size, PROT_READ|PROT_WRITE) != 0) {
+ __munmap(p2, HEAP_MAX_SIZE);
return 0;
}
h = (heap_info *)p2;
@@ -599,9 +598,9 @@
if((unsigned long) new_size > (unsigned long) HEAP_MAX_SIZE)
return -1;
if((unsigned long) new_size > h->mprotect_size) {
- if (mprotect((char *)h + h->mprotect_size,
- (unsigned long) new_size - h->mprotect_size,
- PROT_READ|PROT_WRITE) != 0)
+ if (__mprotect((char *)h + h->mprotect_size,
+ (unsigned long) new_size - h->mprotect_size,
+ PROT_READ|PROT_WRITE) != 0)
return -2;
h->mprotect_size = new_size;
}
@@ -625,7 +624,7 @@
if (__builtin_expect (__libc_enable_secure, 0))
{
if((char *)MMAP((char *)h + new_size, diff, PROT_NONE,
- MAP_PRIVATE|MAP_FIXED) == (char *) MAP_FAILED)
+ MAP_FIXED) == (char *) MAP_FAILED)
return -2;
h->mprotect_size = new_size;
}
@@ -643,7 +642,7 @@
do { \
if ((char *)(heap) + HEAP_MAX_SIZE == aligned_heap_area) \
aligned_heap_area = NULL; \
- munmap((char*)(heap), HEAP_MAX_SIZE); \
+ __munmap((char*)(heap), HEAP_MAX_SIZE); \
} while (0)
static int
@@ -828,7 +827,7 @@
{
if (mp_.arena_max != 0)
narenas_limit = mp_.arena_max;
- else
+ else if (narenas > mp_.arena_test)
{
int n = __get_nprocs ();
@@ -842,7 +841,14 @@
}
repeat:;
size_t n = narenas;
- if (__builtin_expect (n <= mp_.arena_test || n < narenas_limit, 0))
+ /* NB: the following depends on the fact that (size_t)0 - 1 is a
+ very large number and that the underflow is OK. If arena_max
+ is set the value of arena_test is irrelevant. If arena_test
+ is set but narenas is not yet larger or equal to arena_test
+ narenas_limit is 0. There is no possibility for narenas to
+ be too big for the test to always fail since there is not
+ enough address space to create that many arenas. */
+ if (__builtin_expect (n <= narenas_limit - 1, 0))
{
if (catomic_compare_and_exchange_bool_acq (&narenas, n + 1, n))
goto repeat;
Modified: fsf/trunk/libc/malloc/hooks.c
==============================================================================
--- fsf/trunk/libc/malloc/hooks.c (original)
+++ fsf/trunk/libc/malloc/hooks.c Wed Feb 1 00:01:51 2012
@@ -30,7 +30,7 @@
{
__malloc_hook = NULL;
ptmalloc_init();
- return public_mALLOc(sz);
+ return __libc_malloc(sz);
}
static void*
@@ -39,7 +39,7 @@
__malloc_hook = NULL;
__realloc_hook = NULL;
ptmalloc_init();
- return public_rEALLOc(ptr, sz);
+ return __libc_realloc(ptr, sz);
}
static void*
@@ -47,7 +47,7 @@
{
__memalign_hook = NULL;
ptmalloc_init();
- return public_mEMALIGn(alignment, sz);
+ return __libc_memalign(alignment, sz);
}
/* Whether we are using malloc checking. */
@@ -389,13 +389,13 @@
};
void*
-public_gET_STATe(void)
+__malloc_get_state(void)
{
struct malloc_save_state* ms;
int i;
mbinptr b;
- ms = (struct malloc_save_state*)public_mALLOc(sizeof(*ms));
+ ms = (struct malloc_save_state*)__libc_malloc(sizeof(*ms));
if (!ms)
return 0;
(void)mutex_lock(&main_arena.mutex);
@@ -440,7 +440,7 @@
}
int
-public_sET_STATe(void* msptr)
+__malloc_set_state(void* msptr)
{
struct malloc_save_state* ms = (struct malloc_save_state*)msptr;
size_t i;
Modified: fsf/trunk/libc/malloc/malloc.c
==============================================================================
--- fsf/trunk/libc/malloc/malloc.c (original)
+++ fsf/trunk/libc/malloc/malloc.c Wed Feb 1 00:01:51 2012
@@ -387,38 +387,9 @@
#endif
-/*
- Two-phase name translation.
- All of the actual routines are given mangled names.
- When wrappers are used, they become the public callable versions.
-*/
-
-/* Special defines for the GNU C library. */
-#define public_cALLOc __libc_calloc
-#define public_fREe __libc_free
-#define public_cFREe __libc_cfree
-#define public_mALLOc __libc_malloc
-#define public_mEMALIGn __libc_memalign
-#define public_rEALLOc __libc_realloc
-#define public_vALLOc __libc_valloc
-#define public_pVALLOc __libc_pvalloc
-#define public_mALLINFo __libc_mallinfo
-#define public_mALLOPt __libc_mallopt
-#define public_mTRIm __malloc_trim
-#define public_mSTATs __malloc_stats
-#define public_mUSABLe __malloc_usable_size
-#define public_iCALLOc __libc_independent_calloc
-#define public_iCOMALLOc __libc_independent_comalloc
-#define public_gET_STATe __malloc_get_state
-#define public_sET_STATe __malloc_set_state
-#define open __open
-#define mmap __mmap
-#define munmap __munmap
-#define mremap __mremap
-#define mprotect __mprotect
+/* Definition for getting more memory from the OS. */
#define MORECORE (*__morecore)
#define MORECORE_FAILURE 0
-
void * __default_morecore (ptrdiff_t);
void *(*__morecore)(ptrdiff_t) = __default_morecore;
@@ -561,8 +532,8 @@
differs across systems, but is in all cases less than the maximum
representable value of a size_t.
*/
-void* public_mALLOc(size_t);
-libc_hidden_proto (public_mALLOc)
+void* __libc_malloc(size_t);
+libc_hidden_proto (__libc_malloc)
/*
free(void* p)
@@ -575,15 +546,15 @@
when possible, automatically trigger operations that give
back unused memory to the system, thus reducing program footprint.
*/
-void public_fREe(void*);
-libc_hidden_proto (public_fREe)
+void __libc_free(void*);
+libc_hidden_proto (__libc_free)
/*
calloc(size_t n_elements, size_t element_size);
Returns a pointer to n_elements * element_size bytes, with all locations
set to zero.
*/
-void* public_cALLOc(size_t, size_t);
+void* __libc_calloc(size_t, size_t);
/*
realloc(void* p, size_t n)
@@ -612,8 +583,8 @@
The old unix realloc convention of allowing the last-free'd chunk
to be used as an argument to realloc is not supported.
*/
-void* public_rEALLOc(void*, size_t);
-libc_hidden_proto (public_rEALLOc)
+void* __libc_realloc(void*, size_t);
+libc_hidden_proto (__libc_realloc)
/*
memalign(size_t alignment, size_t n);
@@ -627,15 +598,15 @@
Overreliance on memalign is a sure way to fragment space.
*/
-void* public_mEMALIGn(size_t, size_t);
-libc_hidden_proto (public_mEMALIGn)
+void* __libc_memalign(size_t, size_t);
+libc_hidden_proto (__libc_memalign)
/*
valloc(size_t n);
Equivalent to memalign(pagesize, n), where pagesize is the page
size of the system. If the pagesize is unknown, 4096 is used.
*/
-void* public_vALLOc(size_t);
+void* __libc_valloc(size_t);
@@ -660,7 +631,8 @@
M_MMAP_THRESHOLD -3 128*1024 any (or 0 if no MMAP support)
M_MMAP_MAX -4 65536 any (0 disables use of mmap)
*/
-int public_mALLOPt(int, int);
+int __libc_mallopt(int, int);
+libc_hidden_proto (__libc_mallopt)
/*
@@ -686,7 +658,7 @@
be kept as longs, the reported values may wrap around zero and
thus be inaccurate.
*/
-struct mallinfo public_mALLINFo(void);
+struct mallinfo __libc_mallinfo(void);
/*
@@ -694,17 +666,7 @@
Equivalent to valloc(minimum-page-that-holds(n)), that is,
round up n to nearest pagesize.
*/
-void* public_pVALLOc(size_t);
-
-/*
- cfree(void* p);
- Equivalent to free(p).
-
- cfree is needed/defined on some systems that pair it with calloc,
- for odd historical reasons (such as: cfree is used in example
- code in the first edition of K&R).
-*/
-void public_cFREe(void*);
+void* __libc_pvalloc(size_t);
/*
malloc_trim(size_t pad);
@@ -730,7 +692,7 @@
On systems that do not support "negative sbrks", it will always
return 0.
*/
-int public_mTRIm(size_t);
+int __malloc_trim(size_t);
/*
malloc_usable_size(void* p);
@@ -747,7 +709,7 @@
assert(malloc_usable_size(p) >= 256);
*/
-size_t public_mUSABLe(void*);
+size_t __malloc_usable_size(void*);
/*
malloc_stats();
@@ -769,7 +731,7 @@
More information can be obtained by calling mallinfo.
*/
-void public_mSTATs(void);
+void __malloc_stats(void);
/*
malloc_get_state(void);
@@ -777,7 +739,7 @@
Returns the state of all malloc variables in an opaque data
structure.
*/
-void* public_gET_STATe(void);
+void* __malloc_get_state(void);
/*
malloc_set_state(void* state);
@@ -785,7 +747,7 @@
Restore the state of all malloc variables from data obtained with
malloc_get_state().
*/
-int public_sET_STATe(void*);
+int __malloc_set_state(void*);
/*
posix_memalign(void **memptr, size_t alignment, size_t size);
@@ -1093,11 +1055,6 @@
static void* _int_memalign(mstate, size_t, size_t);
static void* _int_valloc(mstate, size_t);
static void* _int_pvalloc(mstate, size_t);
-static int mTRIm(mstate, size_t);
-static size_t mUSABLe(void*);
-static void mSTATs(void);
-static int mALLOPt(int, int);
-static struct mallinfo mALLINFo(mstate);
static void malloc_printerr(int action, const char *str, void *ptr);
static void* internal_function mem2mem_check(void *p, size_t sz);
@@ -1141,15 +1098,11 @@
#endif
#ifndef MAP_NORESERVE
-# ifdef MAP_AUTORESRV
-# define MAP_NORESERVE MAP_AUTORESRV
-# else
-# define MAP_NORESERVE 0
-# endif
+# define MAP_NORESERVE 0
#endif
#define MMAP(addr, size, prot, flags) \
- (mmap((addr), (size), (prot), (flags)|MAP_ANONYMOUS, -1, 0))
+ __mmap((addr), (size), (prot), (flags)|MAP_ANONYMOUS|MAP_PRIVATE, -1, 0)
/*
@@ -1584,7 +1537,7 @@
need to do so when getting memory from system, so we make
initial_top treat the bin as a legal but unusable chunk during the
interval between initialization and the first call to
- sYSMALLOc. (This is somewhat delicate, since it relies on
+ sysmalloc. (This is somewhat delicate, since it relies on
the 2 preceding words to be zero during this interval as well.)
*/
@@ -1854,8 +1807,8 @@
Other internal utilities operating on mstates
*/
-static void* sYSMALLOc(INTERNAL_SIZE_T, mstate);
-static int sYSTRIm(size_t, mstate);
+static void* sysmalloc(INTERNAL_SIZE_T, mstate);
+static int systrim(size_t, mstate);
static void malloc_consolidate(mstate);
@@ -2270,7 +2223,7 @@
be extended or replaced.
*/
-static void* sYSMALLOc(INTERNAL_SIZE_T nb, mstate av)
+static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av)
{
mchunkptr old_top; /* incoming value of av->top */
INTERNAL_SIZE_T old_size; /* its size */
@@ -2322,7 +2275,7 @@
/* Don't try if size wraps around 0 */
if ((unsigned long)(size) > (unsigned long)(nb)) {
- mm = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE));
+ mm = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, 0));
if (mm != MAP_FAILED) {
@@ -2485,7 +2438,7 @@
/* Don't try if size wraps around 0 */
if ((unsigned long)(size) > (unsigned long)(nb)) {
- char *mbrk = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE));
+ char *mbrk = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, 0));
if (mbrk != MAP_FAILED) {
@@ -2690,7 +2643,7 @@
/*
- sYSTRIm is an inverse of sorts to sYSMALLOc. It gives memory back
+ systrim is an inverse of sorts to sysmalloc. It gives memory back
to the system (via negative arguments to sbrk) if there is unused
memory at the `high' end of the malloc pool. It is called
automatically by free() when top space exceeds the trim
@@ -2698,7 +2651,7 @@
returns 1 if it actually released any memory, else 0.
*/
-static int sYSTRIm(size_t pad, mstate av)
+static int systrim(size_t pad, mstate av)
{
long top_size; /* Amount of top-most memory */
long extra; /* Amount to release */
@@ -2783,7 +2736,7 @@
/* If munmap failed the process virtual memory address space is in a
bad shape. Just leave the block hanging around, the process will
terminate shortly anyway since not much can be done. */
- munmap((char *)block, total_size);
+ __munmap((char *)block, total_size);
}
#if HAVE_MREMAP
@@ -2807,8 +2760,8 @@
if (size + offset == new_size)
return p;
- cp = (char *)mremap((char *)p - offset, size + offset, new_size,
- MREMAP_MAYMOVE);
+ cp = (char *)__mremap((char *)p - offset, size + offset, new_size,
+ MREMAP_MAYMOVE);
if (cp == MAP_FAILED) return 0;
@@ -2831,7 +2784,7 @@
/*------------------------ Public wrappers. --------------------------------*/
void*
-public_mALLOc(size_t bytes)
+__libc_malloc(size_t bytes)
{
mstate ar_ptr;
void *victim;
@@ -2870,10 +2823,10 @@
ar_ptr == arena_for_chunk(mem2chunk(victim)));
return victim;
}
-libc_hidden_def(public_mALLOc)
+libc_hidden_def(__libc_malloc)
void
-public_fREe(void* mem)
+__libc_free(void* mem)
{
mstate ar_ptr;
mchunkptr p; /* chunk corresponding to mem */
@@ -2907,10 +2860,10 @@
ar_ptr = arena_for_chunk(p);
_int_free(ar_ptr, p, 0);
}
-libc_hidden_def (public_fREe)
+libc_hidden_def (__libc_free)
void*
-public_rEALLOc(void* oldmem, size_t bytes)
+__libc_realloc(void* oldmem, size_t bytes)
{
mstate ar_ptr;
INTERNAL_SIZE_T nb; /* padded request size */
@@ -2923,11 +2876,11 @@
return (*hook)(oldmem, bytes, RETURN_ADDRESS (0));
#if REALLOC_ZERO_BYTES_FREES
- if (bytes == 0 && oldmem != NULL) { public_fREe(oldmem); return 0; }
+ if (bytes == 0 && oldmem != NULL) { __libc_free(oldmem); return 0; }
#endif
/* realloc of null is supposed to be same as malloc */
- if (oldmem == 0) return public_mALLOc(bytes);
+ if (oldmem == 0) return __libc_malloc(bytes);
/* chunk corresponding to oldmem */
const mchunkptr oldp = mem2chunk(oldmem);
@@ -2958,7 +2911,7 @@
/* Note the extra SIZE_SZ overhead. */
if(oldsize - SIZE_SZ >= nb) return oldmem; /* do nothing */
/* Must alloc, copy, free. */
- newmem = public_mALLOc(bytes);
+ newmem = __libc_malloc(bytes);
if (newmem == 0) return 0; /* propagate failure */
MALLOC_COPY(newmem, oldmem, oldsize - 2*SIZE_SZ);
munmap_chunk(oldp);
@@ -2991,7 +2944,7 @@
if (newp == NULL)
{
/* Try harder to allocate memory in other arenas. */
- newp = public_mALLOc(bytes);
+ newp = __libc_malloc(bytes);
if (newp != NULL)
{
MALLOC_COPY (newp, oldmem, oldsize - SIZE_SZ);
@@ -3001,10 +2954,10 @@
return newp;
}
-libc_hidden_def (public_rEALLOc)
+libc_hidden_def (__libc_realloc)
void*
-public_mEMALIGn(size_t alignment, size_t bytes)
+__libc_memalign(size_t alignment, size_t bytes)
{
mstate ar_ptr;
void *p;
@@ -3016,7 +2969,7 @@
return (*hook)(alignment, bytes, RETURN_ADDRESS (0));
/* If need less alignment than we give anyway, just relay to malloc */
- if (alignment <= MALLOC_ALIGNMENT) return public_mALLOc(bytes);
+ if (alignment <= MALLOC_ALIGNMENT) return __libc_malloc(bytes);
/* Otherwise, ensure that it is at least a minimum chunk size */
if (alignment < MINSIZE) alignment = MINSIZE;
@@ -3050,11 +3003,11 @@
return p;
}
/* For ISO C11. */
-weak_alias (public_mEMALIGn, aligned_alloc)
-libc_hidden_def (public_mEMALIGn)
+weak_alias (__libc_memalign, aligned_alloc)
+libc_hidden_def (__libc_memalign)
void*
-public_vALLOc(size_t bytes)
+__libc_valloc(size_t bytes)
{
mstate ar_ptr;
void *p;
@@ -3098,7 +3051,7 @@
}
void*
-public_pVALLOc(size_t bytes)
+__libc_pvalloc(size_t bytes)
{
mstate ar_ptr;
void *p;
@@ -3143,7 +3096,7 @@
}
void*
-public_cALLOc(size_t n, size_t elem_size)
+__libc_calloc(size_t n, size_t elem_size)
{
mstate av;
mchunkptr oldtop, p;
@@ -3273,64 +3226,6 @@
}
return mem;
-}
-
-
-int
-public_mTRIm(size_t s)
-{
- int result = 0;
-
- if(__malloc_initialized < 0)
- ptmalloc_init ();
-
- mstate ar_ptr = &main_arena;
- do
- {
- (void) mutex_lock (&ar_ptr->mutex);
- result |= mTRIm (ar_ptr, s);
- (void) mutex_unlock (&ar_ptr->mutex);
-
- ar_ptr = ar_ptr->next;
- }
- while (ar_ptr != &main_arena);
-
- return result;
-}
-
-size_t
-public_mUSABLe(void* m)
-{
- size_t result;
-
- result = mUSABLe(m);
- return result;
-}
-
-void
-public_mSTATs()
-{
- mSTATs();
-}
-
-struct mallinfo public_mALLINFo()
-{
- struct mallinfo m;
-
- if(__malloc_initialized < 0)
- ptmalloc_init ();
- (void)mutex_lock(&main_arena.mutex);
- m = mALLINFo(&main_arena);
- (void)mutex_unlock(&main_arena.mutex);
- return m;
-}
-
-int
-public_mALLOPt(int p, int v)
-{
- int result;
- result = mALLOPt(p, v);
- return result;
}
/*
@@ -3816,7 +3711,7 @@
Otherwise, relay to handle system-dependent cases
*/
else {
- void *p = sYSMALLOc(nb, av);
+ void *p = sysmalloc(nb, av);
if (p != NULL && __builtin_expect (perturb_byte, 0))
alloc_perturb (p, bytes);
return p;
@@ -4076,7 +3971,7 @@
#ifndef MORECORE_CANNOT_TRIM
if ((unsigned long)(chunksize(av->top)) >=
(unsigned long)(mp_.trim_threshold))
- sYSTRIm(mp_.top_pad, av);
+ systrim(mp_.top_pad, av);
#endif
} else {
/* Always try heap_trim(), even if the top chunk is not
@@ -4511,7 +4406,7 @@
------------------------------ malloc_trim ------------------------------
*/
-static int mTRIm(mstate av, size_t pad)
+static int mtrim(mstate av, size_t pad)
{
/* Ensure initialization/consolidation */
malloc_consolidate (av);
@@ -4559,18 +4454,42 @@
}
#ifndef MORECORE_CANNOT_TRIM
- return result | (av == &main_arena ? sYSTRIm (pad, av) : 0);
+ return result | (av == &main_arena ? systrim (pad, av) : 0);
#else
return result;
#endif
}
+int
+__malloc_trim(size_t s)
+{
+ int result = 0;
+
+ if(__malloc_initialized < 0)
+ ptmalloc_init ();
+
+ mstate ar_ptr = &main_arena;
+ do
+ {
+ (void) mutex_lock (&ar_ptr->mutex);
+ result |= mtrim (ar_ptr, s);
+ (void) mutex_unlock (&ar_ptr->mutex);
+
+ ar_ptr = ar_ptr->next;
+ }
+ while (ar_ptr != &main_arena);
+
+ return result;
+}
+
+
/*
------------------------- malloc_usable_size -------------------------
*/
-size_t mUSABLe(void* mem)
+static size_t
+musable(void* mem)
{
mchunkptr p;
if (mem != 0) {
@@ -4583,11 +4502,22 @@
return 0;
}
+
+size_t
+__malloc_usable_size(void* m)
+{
+ size_t result;
+
+ result = musable(m);
+ return result;
+}
+
/*
------------------------------ mallinfo ------------------------------
*/
-struct mallinfo mALLINFo(mstate av)
+static struct mallinfo
+int_mallinfo(mstate av)
{
struct mallinfo mi;
size_t i;
@@ -4642,11 +4572,25 @@
return mi;
}
+
+struct mallinfo __libc_mallinfo()
+{
+ struct mallinfo m;
+
+ if(__malloc_initialized < 0)
+ ptmalloc_init ();
+ (void)mutex_lock(&main_arena.mutex);
+ m = int_mallinfo(&main_arena);
+ (void)mutex_unlock(&main_arena.mutex);
+ return m;
+}
+
/*
------------------------------ malloc_stats ------------------------------
*/
-void mSTATs()
+void
+__malloc_stats()
{
int i;
mstate ar_ptr;
@@ -4663,7 +4607,7 @@
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
for (i=0, ar_ptr = &main_arena;; i++) {
(void)mutex_lock(&ar_ptr->mutex);
- mi = mALLINFo(ar_ptr);
+ mi = int_mallinfo(ar_ptr);
fprintf(stderr, "Arena %d:\n", i);
fprintf(stderr, "system bytes = %10u\n", (unsigned int)mi.arena);
fprintf(stderr, "in use bytes = %10u\n", (unsigned int)mi.uordblks);
@@ -4705,7 +4649,7 @@
------------------------------ mallopt ------------------------------
*/
-int mALLOPt(int param_number, int value)
+int __libc_mallopt(int param_number, int value)
{
mstate av = &main_arena;
int res = 1;
@@ -4772,6 +4716,7 @@
(void)mutex_unlock(&av->mutex);
return res;
}
+libc_hidden_def (__libc_mallopt)
/*
@@ -4962,7 +4907,7 @@
if (__builtin_expect (hook != NULL, 0))
mem = (*hook)(alignment, size, RETURN_ADDRESS (0));
else
- mem = public_mEMALIGn (alignment, size);
+ mem = __libc_memalign (alignment, size);
if (mem != NULL) {
*memptr = mem;
Modified: fsf/trunk/libc/stdlib/strtol_l.c
==============================================================================
--- fsf/trunk/libc/stdlib/strtol_l.c (original)
+++ fsf/trunk/libc/stdlib/strtol_l.c Wed Feb 1 00:01:51 2012
@@ -1,5 +1,6 @@
/* Convert string representing a number to integer value, using given locale.
- Copyright (C) 1997, 2002, 2004, 2006, 2007, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2002, 2004, 2006, 2007, 2010, 2012
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1997.
@@ -536,16 +537,10 @@
/* External user entry point. */
#if _LIBC - 0 == 0
-# undef PARAMS
-# if defined (__STDC__) && __STDC__
-# define PARAMS(Args) Args
-# else
-# define PARAMS(Args) ()
-# endif
/* Prototype. */
-extern INT __strtol_l PARAMS ((const STRING_TYPE *nptr, STRING_TYPE **endptr,
- int base));
+extern INT __strtol_l (const STRING_TYPE *nptr, STRING_TYPE **endptr,
+ int base);
#endif
Modified: fsf/trunk/libc/sysdeps/powerpc/bits/mathdef.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/bits/mathdef.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/bits/mathdef.h Wed Feb 1 00:01:51 2012
@@ -31,21 +31,9 @@
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
# define _MATH_H_MATHDEF 1
-# ifdef __GNUC__
-
-/* gcc leaves `float' expressions as-is. */
-typedef float float_t; /* `float' expressions are evaluated as
- `float'. */
-typedef double double_t; /* `double' expressions are evaluated as
- `double'. */
-
-# else
-
-/* Wild guess at types for float_t and double_t. */
-typedef double float_t;
+/* PowerPC has both `float' and `double' arithmetic. */
+typedef float float_t;
typedef double double_t;
-
-# endif
/* The values returned by `ilogb' for 0 and NaN respectively. */
# define FP_ILOGB0 (-2147483647)
Modified: fsf/trunk/libc/sysdeps/sh/sh4/bits/mathdef.h
==============================================================================
--- fsf/trunk/libc/sysdeps/sh/sh4/bits/mathdef.h (original)
+++ fsf/trunk/libc/sysdeps/sh/sh4/bits/mathdef.h Wed Feb 1 00:01:51 2012
@@ -31,21 +31,9 @@
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
# define _MATH_H_MATHDEF 1
-# ifdef __GNUC__
-
-/* gcc leaves `float' expressions as-is. */
-typedef float float_t; /* `float' expressions are evaluated as
- `float'. */
-typedef double double_t; /* `double' expressions are evaluated as
- `double'. */
-
-# else
-
-/* Wild guess at types for float_t and double_t. */
-typedef double float_t;
+/* SH has both `float' and `double' arithmetic. */
+typedef float float_t;
typedef double double_t;
-
-# endif
/* The values returned by `ilogb' for 0 and NaN respectively. */
# define FP_ILOGB0 0x80000001
Modified: fsf/trunk/libc/sysdeps/sparc/bits/mathdef.h
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/bits/mathdef.h (original)
+++ fsf/trunk/libc/sysdeps/sparc/bits/mathdef.h Wed Feb 1 00:01:51 2012
@@ -29,19 +29,9 @@
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
# define _MATH_H_MATHDEF 1
-# ifdef __GNUC__
-
-/* gcc leaves `float' expressions as-is. */
+/* SPARC has both `float' and `double' arithmetic. */
typedef float float_t;
typedef double double_t;
-
-# else
-
-/* Wild guess at types for float_t and double_t. */
-typedef double float_t;
-typedef double double_t;
-
-# endif
/* The values returned by `ilogb' for 0 and NaN respectively. */
# define FP_ILOGB0 (-2147483647)
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits