From: DJ Delorie Date: Thu, 11 Aug 2016 22:42:42 +0000 (-0400) Subject: Merge branch 'master' into dj/malloc X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=528795b01909b0c41ec3049fa115a107c8898a20;p=thirdparty%2Fglibc.git Merge branch 'master' into dj/malloc --- 528795b01909b0c41ec3049fa115a107c8898a20 diff --cc malloc/malloc.c index 7c090aa90f0,bb52b3e1773..1fa9487f188 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@@ -320,83 -297,7 +315,25 @@@ __malloc_assert (const char *assertion } #endif +#if 0 +static void +_m_printf(const char *fmt, ...) +{ + char buf[1024]; + va_list argp; + int tid = (unsigned int)syscall(__NR_gettid); + + snprintf(buf, sizeof(buf)-1, "\033[%dm%5x: ", (tid % 6) + 31, tid & 0xfffff); + + va_start (argp, fmt); + vsnprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), fmt, argp); + va_end (argp); + + strcat(buf+strlen(buf), "\033[0m"); + write(2, buf, strlen(buf)); +} +#endif - /* - INTERNAL_SIZE_T is the word-size used for internal bookkeeping - of chunk sizes. - - The default version is the same as size_t. - - While not strictly necessary, it is best to define this as an - unsigned type, even if size_t is a signed type. This may avoid some - artificial size limitations on some systems. - - On a 64-bit machine, you may be able to reduce malloc overhead by - defining INTERNAL_SIZE_T to be a 32 bit `unsigned int' at the - expense of not being able to handle more than 2^32 of malloced - space. If this limitation is acceptable, you are encouraged to set - this unless you are on a platform requiring 16byte alignments. In - this case the alignment requirements turn out to negate any - potential advantages of decreasing size_t word size. - - Implementors: Beware of the possible combinations of: - - INTERNAL_SIZE_T might be signed or unsigned, might be 32 or 64 bits, - and might be the same width as int or as long - - size_t might have different width and signedness as INTERNAL_SIZE_T - - int and long might be 32 or 64 bits, and might be the same width - To deal with this, most comparisons and difference computations - among INTERNAL_SIZE_Ts should cast them to unsigned long, being - aware of the fact that casting an unsigned int to a wider long does - not sign-extend. (This also makes checking for negative numbers - awkward.) Some of these casts result in harmless compiler warnings - on some systems. - */ - - #ifndef INTERNAL_SIZE_T - #define INTERNAL_SIZE_T size_t - #endif - - /* The corresponding word size */ - #define SIZE_SZ (sizeof(INTERNAL_SIZE_T)) - - - /* - MALLOC_ALIGNMENT is the minimum alignment for malloc'ed chunks. - It must be a power of two at least 2 * SIZE_SZ, even on machines - for which smaller alignments would suffice. It may be defined as - larger than this though. Note however that code and data structures - are optimized for the case of 8-byte alignment. - */ - - - #ifndef MALLOC_ALIGNMENT - # define MALLOC_ALIGNMENT (2 * SIZE_SZ < __alignof__ (long double) \ - ? __alignof__ (long double) : 2 * SIZE_SZ) - #endif - - /* The corresponding bit mask value */ - #define MALLOC_ALIGN_MASK (MALLOC_ALIGNMENT - 1) - - - /* REALLOC_ZERO_BYTES_FREES should be set if a call to realloc with zero bytes should be the same as a call to free.