source: clfs-sysroot/patches/glibc-2.6-branch_update-1.patch@ 5e550a1

Last change on this file since 5e550a1 was 00520f6, checked in by Joe Ciccone <jciccone@…>, 17 years ago

Update patches.

  • Property mode set to 100644
File size: 5.8 KB
  • libc/malloc/arena.c

    Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
    Date: 06-05-2007
    Initial Package Version: 2.6
    Origin: Upstream
    Upstream Status: Applied
    Description: This is a branch update for Glibc-2.6, and should be
                 rechecked periodically. See the 'Changelog' and 'localedata/ChangeLog'
                 for specific details.
    
    2007-05-21  Jakub Jelinek  <jakub@redhat.com>
    
    	* malloc/hooks.c (MALLOC_STATE_VERSION): Bump.
    	(public_sET_STATe): If ms->version < 3, put all chunks into
    	unsorted chunks and clear {fd,bk}_nextsize fields of largebin
    	chunks.
    	* malloc/malloc.c (do_check_malloc_state): Don't assert
    	n_mmaps is not greater than n_mmaps_max.
    
    	* malloc/malloc.c [MALLOC_DEBUG]: Revert 2007-05-13 changes.
    	* malloc/hooks.c: Likewise.
    	* malloc/arena.c: Likewise.
    	* malloc/Makefile (CFLAGS-malloc.c): Revert accidental
    	2007-05-07 commit.
    
    old new ptmalloc_init_minimal (void)  
    370370  mp_.top_pad        = DEFAULT_TOP_PAD;
    371371#endif
    372372  mp_.n_mmaps_max    = DEFAULT_MMAP_MAX;
    373 #if MALLOC_DEBUG
    374   mp_.n_mmaps_cmax   = DEFAULT_MMAP_MAX;
    375 #endif
    376373  mp_.mmap_threshold = DEFAULT_MMAP_THRESHOLD;
    377374  mp_.trim_threshold = DEFAULT_TRIM_THRESHOLD;
    378375  mp_.pagesize       = malloc_getpagesize;
  • libc/malloc/malloc.c

    old new struct malloc_par {  
    23582358  /* Memory map support */
    23592359  int              n_mmaps;
    23602360  int              n_mmaps_max;
    2361 #if MALLOC_DEBUG
    2362   int              n_mmaps_cmax;
    2363 #endif
    23642361  int              max_n_mmaps;
    23652362  /* the mmap_threshold is dynamic, until the user sets
    23662363     it manually, at which point we need to disable any
    static void do_check_malloc_state(mstate  
    28762873  assert(total <= (unsigned long)(mp_.max_total_mem));
    28772874  assert(mp_.n_mmaps >= 0);
    28782875#endif
    2879   assert(mp_.n_mmaps <= mp_.n_mmaps_cmax);
    2880   assert(mp_.n_mmaps_max <= mp_.n_mmaps_cmax);
    28812876  assert(mp_.n_mmaps <= mp_.max_n_mmaps);
    28822877
    28832878  assert((unsigned long)(av->system_mem) <=
    munmap_chunk(p) mchunkptr p;  
    34753470    }
    34763471
    34773472  mp_.n_mmaps--;
    3478 #if MALLOC_DEBUG
    3479   if (mp_.n_mmaps_cmax > mp_.n_mmaps_max)
    3480     {
    3481       assert (mp_.n_mmaps_cmax == mp_.n_mmaps + 1);
    3482       mp_.n_mmaps_cmax = mp_.n_mmaps;
    3483     }
    3484 #endif
    34853473  mp_.mmapped_mem -= total_size;
    34863474
    34873475  int ret __attribute__ ((unused)) = munmap((char *)block, total_size);
    mstate av; size_t n_elements; size_t* si  
    53975385  mp_.n_mmaps_max = 0;
    53985386  mem = _int_malloc(av, size);
    53995387  mp_.n_mmaps_max = mmx;   /* reset mmap */
    5400 #if MALLOC_DEBUG
    5401   mp_.n_mmaps_cmax = mmx;
    5402 #endif
    54035388  if (mem == 0)
    54045389    return 0;
    54055390
    int mALLOPt(param_number, value) int par  
    57255710      res = 0;
    57265711    else
    57275712#endif
    5728       {
    5729 #if MALLOC_DEBUG
    5730         if (mp_.n_mmaps <= value)
    5731           mp_.n_mmaps_cmax = value;
    5732         else
    5733           mp_.n_mmaps_cmax = mp_.n_mmaps;
    5734 #endif
    5735 
    5736         mp_.n_mmaps_max = value;
    5737         mp_.no_dyn_threshold = 1;
    5738       }
     5713      mp_.n_mmaps_max = value;
     5714      mp_.no_dyn_threshold = 1;
    57395715    break;
    57405716
    57415717  case M_CHECK_ACTION:
  • libc/malloc/hooks.c

    old new free_starter(mem, caller) Void_t* mem; c  
    496496   then the hooks are reset to 0.  */
    497497
    498498#define MALLOC_STATE_MAGIC   0x444c4541l
    499 #define MALLOC_STATE_VERSION (0*0x100l + 2l) /* major*0x100 + minor */
     499#define MALLOC_STATE_VERSION (0*0x100l + 3l) /* major*0x100 + minor */
    500500
    501501struct malloc_save_state {
    502502  long          magic;
    struct malloc_save_state {  
    507507  unsigned long trim_threshold;
    508508  unsigned long top_pad;
    509509  unsigned int  n_mmaps_max;
    510 #if MALLOC_DEBUG
    511   unsigned int  n_mmaps_cmax;
    512 #endif
    513510  unsigned long mmap_threshold;
    514511  int           check_action;
    515512  unsigned long max_sbrked_mem;
    public_gET_STATe(void)  
    553550  ms->trim_threshold = mp_.trim_threshold;
    554551  ms->top_pad = mp_.top_pad;
    555552  ms->n_mmaps_max = mp_.n_mmaps_max;
    556 #if MALLOC_DEBUG
    557   ms->n_mmaps_cmax = mp_.n_mmaps_cmax;
    558 #endif
    559553  ms->mmap_threshold = mp_.mmap_threshold;
    560554  ms->check_action = check_action;
    561555  ms->max_sbrked_mem = main_arena.max_system_mem;
    public_sET_STATe(Void_t* msptr)  
    601595      assert(ms->av[2*i+3] == 0);
    602596      first(b) = last(b) = b;
    603597    } else {
    604       if(i<NSMALLBINS || (largebin_index(chunksize(ms->av[2*i+2]))==i &&
    605                           largebin_index(chunksize(ms->av[2*i+3]))==i)) {
     598      if(ms->version >= 3 &&
     599         (i<NSMALLBINS || (largebin_index(chunksize(ms->av[2*i+2]))==i &&
     600                           largebin_index(chunksize(ms->av[2*i+3]))==i))) {
    606601        first(b) = ms->av[2*i+2];
    607602        last(b) = ms->av[2*i+3];
    608603        /* Make sure the links to the bins within the heap are correct.  */
    public_sET_STATe(Void_t* msptr)  
    622617      }
    623618    }
    624619  }
     620  if (ms->version < 3) {
     621    /* Clear fd_nextsize and bk_nextsize fields.  */
     622    b = unsorted_chunks(&main_arena)->fd;
     623    while (b != unsorted_chunks(&main_arena)) {
     624      if (!in_smallbin_range(chunksize(b))) {
     625        b->fd_nextsize = NULL;
     626        b->bk_nextsize = NULL;
     627      }
     628      b = b->fd;
     629    }
     630  }
    625631  mp_.sbrk_base = ms->sbrk_base;
    626632  main_arena.system_mem = ms->sbrked_mem_bytes;
    627633  mp_.trim_threshold = ms->trim_threshold;
    628634  mp_.top_pad = ms->top_pad;
    629635  mp_.n_mmaps_max = ms->n_mmaps_max;
    630 #if MALLOC_DEBUG
    631   mp_.n_mmaps_cmax = ms->n_mmaps_cmax;
    632 #endif
    633636  mp_.mmap_threshold = ms->mmap_threshold;
    634637  check_action = ms->check_action;
    635638  main_arena.max_system_mem = ms->max_sbrked_mem;
  • libc/malloc/Makefile

    old new $(objpfx)memusagestat: $(memusagestat-mo  
    104104include ../Rules
    105105
    106106CFLAGS-mcheck-init.c = $(PIC-ccflag)
    107 CFLAGS-malloc.c += -DMALLOC_DEBUG
    108107
    109108$(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
    110109        -rm -f $@
Note: See TracBrowser for help on using the repository browser.