[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r9381 - in /branches/eglibc-2_10: libc/ libc/malloc/ ports/ ports/sysdeps/unix/sysv/linux/mips/mips64/n32/ ports/sysdeps/uni...



Author: joseph
Date: Mon Nov 30 17:44:26 2009
New Revision: 9381

Log:
Merge changes between r9288 and r9380 from /fsf/glibc-2_10-branch.

Added:
    branches/eglibc-2_10/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise.c
      - copied unchanged from r9380, fsf/glibc-2_10-branch/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise.c
    branches/eglibc-2_10/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c
      - copied unchanged from r9380, fsf/glibc-2_10-branch/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c
    branches/eglibc-2_10/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c
      - copied unchanged from r9380, fsf/glibc-2_10-branch/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c
Modified:
    branches/eglibc-2_10/libc/ChangeLog
    branches/eglibc-2_10/libc/malloc/hooks.c
    branches/eglibc-2_10/ports/ChangeLog.mips
    branches/eglibc-2_10/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list

Modified: branches/eglibc-2_10/libc/ChangeLog
==============================================================================
--- branches/eglibc-2_10/libc/ChangeLog (original)
+++ branches/eglibc-2_10/libc/ChangeLog Mon Nov 30 17:44:26 2009
@@ -1,3 +1,8 @@
+2009-11-01  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* malloc/hooks.c (free_check): Restore locking and call _int_free
+	appropriately.
+
 2009-10-28  Roland McGrath  <roland@xxxxxxxxxx>
 
 	* Makefile (dist-prepare): New target.

Modified: branches/eglibc-2_10/libc/malloc/hooks.c
==============================================================================
--- branches/eglibc-2_10/libc/malloc/hooks.c (original)
+++ branches/eglibc-2_10/libc/malloc/hooks.c Mon Nov 30 17:44:26 2009
@@ -162,8 +162,8 @@
 	 ((char*)p + sz)>=(mp_.sbrk_base+main_arena.system_mem) )) ||
        sz<MINSIZE || sz&MALLOC_ALIGN_MASK || !inuse(p) ||
        ( !prev_inuse(p) && (p->prev_size&MALLOC_ALIGN_MASK ||
-                            (contig && (char*)prev_chunk(p)<mp_.sbrk_base) ||
-                            next_chunk(prev_chunk(p))!=p) ))
+			    (contig && (char*)prev_chunk(p)<mp_.sbrk_base) ||
+			    next_chunk(prev_chunk(p))!=p) ))
       return NULL;
     magic = MAGICBYTE(p);
     for(sz += SIZE_SZ-1; (c = ((unsigned char*)p)[sz]) != magic; sz -= c) {
@@ -177,9 +177,9 @@
        first. */
     offset = (unsigned long)mem & page_mask;
     if((offset!=MALLOC_ALIGNMENT && offset!=0 && offset!=0x10 &&
-        offset!=0x20 && offset!=0x40 && offset!=0x80 && offset!=0x100 &&
-        offset!=0x200 && offset!=0x400 && offset!=0x800 && offset!=0x1000 &&
-        offset<0x2000) ||
+	offset!=0x20 && offset!=0x40 && offset!=0x80 && offset!=0x100 &&
+	offset!=0x200 && offset!=0x400 && offset!=0x800 && offset!=0x1000 &&
+	offset<0x2000) ||
        !chunk_is_mmapped(p) || (p->size & PREV_INUSE) ||
        ( (((unsigned long)p - p->prev_size) & page_mask) != 0 ) ||
        ( (sz = chunksize(p)), ((p->prev_size + sz) & page_mask) != 0 ) )
@@ -276,13 +276,17 @@
   mchunkptr p;
 
   if(!mem) return;
+  (void)mutex_lock(&main_arena.mutex);
   p = mem2chunk_check(mem, NULL);
   if(!p) {
+    (void)mutex_unlock(&main_arena.mutex);
+
     malloc_printerr(check_action, "free(): invalid pointer", mem);
     return;
   }
 #if HAVE_MMAP
   if (chunk_is_mmapped(p)) {
+    (void)mutex_unlock(&main_arena.mutex);
     munmap_chunk(p);
     return;
   }
@@ -291,12 +295,11 @@
   memset(mem, 0, chunksize(p) - (SIZE_SZ+1));
 #endif
 #ifdef ATOMIC_FASTBINS
-  _int_free(&main_arena, p, 0);
-#else
-  (void)mutex_lock(&main_arena.mutex);
+  _int_free(&main_arena, p, 1);
+#else
   _int_free(&main_arena, p);
+#endif
   (void)mutex_unlock(&main_arena.mutex);
-#endif
 }
 
 static Void_t*
@@ -345,13 +348,13 @@
       if(oldsize - SIZE_SZ >= nb)
 	newmem = oldmem; /* do nothing */
       else {
-        /* Must alloc, copy, free. */
-        if (top_check() >= 0)
+	/* Must alloc, copy, free. */
+	if (top_check() >= 0)
 	  newmem = _int_malloc(&main_arena, bytes+1);
-        if (newmem) {
-          MALLOC_COPY(BOUNDED_N(newmem, bytes+1), oldmem, oldsize - 2*SIZE_SZ);
-          munmap_chunk(oldp);
-        }
+	if (newmem) {
+	  MALLOC_COPY(BOUNDED_N(newmem, bytes+1), oldmem, oldsize - 2*SIZE_SZ);
+	  munmap_chunk(oldp);
+	}
       }
     }
   } else {
@@ -367,7 +370,7 @@
     nb = chunksize(newp);
     if(oldp<newp || oldp>=chunk_at_offset(newp, nb)) {
       memset((char*)oldmem + 2*sizeof(mbinptr), 0,
-             oldsize - (2*sizeof(mbinptr)+2*SIZE_SZ+1));
+	     oldsize - (2*sizeof(mbinptr)+2*SIZE_SZ+1));
     } else if(nb > oldsize+SIZE_SZ) {
       memset((char*)BOUNDED_N(chunk2mem(newp), bytes) + oldsize,
 	     0, nb - (oldsize+SIZE_SZ));
@@ -626,7 +629,7 @@
 	mark_bin(&main_arena, i);
       } else {
 	/* Oops, index computation from chunksize must have changed.
-           Link the whole list into unsorted_chunks.  */
+	   Link the whole list into unsorted_chunks.  */
 	first(b) = last(b) = b;
 	b = unsorted_chunks(&main_arena);
 	ms->av[2*i+2]->bk = b;
@@ -667,7 +670,7 @@
     /* Check whether it is safe to enable malloc checking, or whether
        it is necessary to disable it.  */
     if (ms->using_malloc_checking && !using_malloc_checking &&
-        !disallow_malloc_check)
+	!disallow_malloc_check)
       __malloc_check_init ();
     else if (!ms->using_malloc_checking && using_malloc_checking) {
       __malloc_hook = NULL;

Modified: branches/eglibc-2_10/ports/ChangeLog.mips
==============================================================================
--- branches/eglibc-2_10/ports/ChangeLog.mips (original)
+++ branches/eglibc-2_10/ports/ChangeLog.mips Mon Nov 30 17:44:26 2009
@@ -1,3 +1,11 @@
+2009-12-01  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
+	(posix_fadvise): Remove.
+	* sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise.c,
+	sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c,
+	sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c: New.
+
 2009-11-06  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/mips/bits/fcntl.h (fallocate): Fix types

Modified: branches/eglibc-2_10/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
==============================================================================
--- branches/eglibc-2_10/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list (original)
+++ branches/eglibc-2_10/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list Mon Nov 30 17:44:26 2009
@@ -2,6 +2,5 @@
 
 readahead	-	readahead	i:iii	__readahead	readahead
 sync_file_range	-	sync_file_range	i:iiii	sync_file_range
-posix_fadvise	-	fadvise64	i:iiii	posix_fadvise
 ftruncate	-	ftruncate	i:ii	__ftruncate	ftruncate ftruncate64 __ftruncate64
 truncate	-	truncate	i:si	truncate	truncate64