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

[commits] r2247 - in /fsf/trunk/libc: ./ malloc/ rt/ sysdeps/unix/sysv/linux/i386/



Author: eglibc
Date: Sat May 19 00:02:01 2007
New Revision: 2247

Log:
Import glibc-mainline for 2007-05-19

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/malloc/malloc.c
    fsf/trunk/libc/malloc/mcheck.c
    fsf/trunk/libc/rt/tst-shm.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/sync_file_range.S

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat May 19 00:02:01 2007
@@ -1,3 +1,15 @@
+2007-05-18  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* malloc/malloc.c (do_check_chunk): Correct check for mmaped block
+	not overlapping with arena.
+
+	* malloc/mcheck.c (reallochook): If size==0, free the block.
+
+	* rt/tst-shm.c: Use fstat64 instead of fstat.
+
+	* sysdeps/unix/sysv/linux/i386/sync_file_range.S: Fix case where
+	__NR_sync_file_range is not defined.
+
 2007-05-17  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	Dummy files to prevent stub versions from being used.

Modified: fsf/trunk/libc/malloc/malloc.c
==============================================================================
--- fsf/trunk/libc/malloc/malloc.c (original)
+++ fsf/trunk/libc/malloc/malloc.c Sat May 19 00:02:01 2007
@@ -2572,7 +2572,7 @@
 #if HAVE_MMAP
     /* address is outside main heap  */
     if (contiguous(av) && av->top != initial_top(av)) {
-      assert(((char*)p) < min_address || ((char*)p) > max_address);
+      assert(((char*)p) < min_address || ((char*)p) >= max_address);
     }
     /* chunk is page-aligned */
     assert(((p->prev_size + sz) & (mp_.pagesize-1)) == 0);

Modified: fsf/trunk/libc/malloc/mcheck.c
==============================================================================
--- fsf/trunk/libc/malloc/mcheck.c (original)
+++ fsf/trunk/libc/malloc/mcheck.c Sat May 19 00:02:01 2007
@@ -1,5 +1,5 @@
 /* Standard debugging hooks for `malloc'.
-   Copyright (C) 1990-1997,99,2000,01,02 Free Software Foundation, Inc.
+   Copyright (C) 1990-1997,1999,2000-2002,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written May 1989 by Mike Haertel.
 
@@ -264,6 +264,12 @@
 static __ptr_t
 reallochook (__ptr_t ptr, __malloc_size_t size, const __ptr_t caller)
 {
+  if (size == 0)
+    {
+      freehook (ptr, caller);
+      return NULL;
+    }
+
   struct hdr *hdr;
   __malloc_size_t osize;
 

Modified: fsf/trunk/libc/rt/tst-shm.c
==============================================================================
--- fsf/trunk/libc/rt/tst-shm.c (original)
+++ fsf/trunk/libc/rt/tst-shm.c Sat May 19 00:02:01 2007
@@ -60,7 +60,7 @@
 worker (int write_now)
 {
   struct timespec ts;
-  struct stat st;
+  struct stat64 st;
   int i;
   int fd = do_open ();
   char *mem;
@@ -68,8 +68,10 @@
   if (fd == -1)
     exit (fd);
 
-  if (fstat (fd, &st) == -1 || st.st_size != 4000)
+  if (fstat64 (fd, &st) == -1)
     error (EXIT_FAILURE, 0, "stat failed");
+  if (st.st_size != 4000)
+    error (EXIT_FAILURE, 0, "size incorrect");
 
   mem = mmap (NULL, 4000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
   if (mem == NULL)
@@ -131,7 +133,7 @@
   pid_t pid2;
   int status1;
   int status2;
-  struct stat st;
+  struct stat64 st;
 
   /* Create the shared memory object.  */
   fd = shm_open ("/shm-test", O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600);
@@ -155,10 +157,15 @@
       return 0;
     }
 
-  if (fstat (fd, &st) == -1 || st.st_size != 4000)
+  if (fstat64 (fd, &st) == -1)
     {
       shm_unlink ("/shm-test");
       error (EXIT_FAILURE, 0, "initial stat failed");
+    }
+  if (st.st_size != 4000)
+    {
+      shm_unlink ("/shm-test");
+      error (EXIT_FAILURE, 0, "initial size not correct");
     }
 
   /* Spawn to processes which will do the work.  */

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/sync_file_range.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/sync_file_range.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/sync_file_range.S Sat May 19 00:02:01 2007
@@ -1,5 +1,5 @@
 /* Selective file content synch'ing.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 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
@@ -63,10 +63,10 @@
 
 	cmpl	$-4095, %eax
 	jae	SYSCALL_ERROR_LABEL
-L(pseudo_end):
-	ret
 #else
 	movl	$-ENOSYS, %eax
 	jmp	SYSCALL_ERROR_LABEL
 #endif
+L(pseudo_end):
+	ret
 PSEUDO_END (sync_file_range)