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

[commits] r10104 - in /fsf/trunk/libc: ./ bits/ malloc/ sysdeps/posix/ sysdeps/unix/sysv/linux/



Author: eglibc
Date: Fri Mar 26 00:03:15 2010
New Revision: 10104

Log:
Import glibc-mainline for 2010-03-26

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/bits/time.h
    fsf/trunk/libc/malloc/malloc.c
    fsf/trunk/libc/malloc/tst-mallocstate.c
    fsf/trunk/libc/sysdeps/posix/cuserid.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/clock_getres.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/clock_gettime.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/clock_settime.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri Mar 26 00:03:15 2010
@@ -1,5 +1,20 @@
+2010-03-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #11389]
+	* bits/time.h: Define CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE, and
+	CLOCK_MONOTONIC_COARSE.
+	* sysdeps/unix/sysv/linux/clock_getres.c: Handle CLOCK_MONOTONIC_RAW,
+	CLOCK_REALTIME_COARSE, and CLOCK_MONOTONIC_COARSE.
+	* sysdeps/unix/sysv/linux/clock_gettime.c: Likewise.
+	* sysdeps/unix/sysv/linux/clock_settime.c: Likewise.
+
+2010-03-25  Andreas Schwab  <schwab@xxxxxxxxxx>
+
+	* sysdeps/posix/cuserid.c: Fix typo.
+
 2010-03-16  Chris Demetriou  <cgd@xxxxxxxxxx>
 
+	[BZ #11394]
 	* locale/programs/simple-hash.c: Include inttypes.h.
 	(hashval_t): Defined to be uint32_t.
 	* locale/programs/simple_hash.h: Include inttypes.h.

Modified: fsf/trunk/libc/bits/time.h
==============================================================================
--- fsf/trunk/libc/bits/time.h (original)
+++ fsf/trunk/libc/bits/time.h Fri Mar 26 00:03:15 2010
@@ -1,5 +1,5 @@
 /* System-dependent timing definitions.  Generic version.
-   Copyright (C) 1996,1997,1999-2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1999-2002,2003,2010 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
@@ -50,6 +50,12 @@
 #   define CLOCK_PROCESS_CPUTIME_ID	2
 /* Thread-specific CPU-time clock.  */
 #   define CLOCK_THREAD_CPUTIME_ID	3
+/* Monotonic system-wide clock, not adjusted for frequency scaling.  */
+#   define CLOCK_MONOTONIC_RAW		4
+/* Identifier for system-wide realtime clock, updated only on ticks.  */
+#   define CLOCK_REALTIME_COARSE	5
+/* Monotonic system-wide clock, updated only on ticks.  */
+#   define CLOCK_MONOTONIC_COARSE	6
 
 /* Flag to indicate time is absolute.  */
 #   define TIMER_ABSTIME		1

Modified: fsf/trunk/libc/malloc/malloc.c
==============================================================================
--- fsf/trunk/libc/malloc/malloc.c (original)
+++ fsf/trunk/libc/malloc/malloc.c Fri Mar 26 00:03:15 2010
@@ -4852,7 +4852,8 @@
       free_perturb (chunk2mem(p), size - SIZE_SZ);
 
     set_fastchunks(av);
-    fb = &fastbin (av, fastbin_index(size));
+    unsigned int idx = fastbin_index(size);
+    fb = &fastbin (av, idx);
 
 #ifdef ATOMIC_FASTBINS
     mchunkptr fd;
@@ -4866,6 +4867,12 @@
 	    errstr = "double free or corruption (fasttop)";
 	    goto errout;
 	  }
+	if (old != NULL
+	    && __builtin_expect (fastbin_index(chunksize(old)) != idx, 0))
+	  {
+	    errstr = "invalid fastbin entry (free)";
+	    goto errout;
+	  }
 	p->fd = fd = old;
       }
     while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd);
@@ -4875,6 +4882,12 @@
     if (__builtin_expect (*fb == p, 0))
       {
 	errstr = "double free or corruption (fasttop)";
+	goto errout;
+      }
+    if (*fb != NULL
+	&& __builtin_expect (fastbin_index(chunksize(*fb)) != idx, 0))
+      {
+	errstr = "invalid fastbin entry (free)";
 	goto errout;
       }
 

Modified: fsf/trunk/libc/malloc/tst-mallocstate.c
==============================================================================
--- fsf/trunk/libc/malloc/tst-mallocstate.c (original)
+++ fsf/trunk/libc/malloc/tst-mallocstate.c Fri Mar 26 00:03:15 2010
@@ -51,6 +51,7 @@
 
   for (i=0; i<100; ++i)
     {
+printf("round %li\n", i);
       save_state = malloc_get_state ();
       if (save_state == NULL)
 	{
@@ -64,13 +65,18 @@
 	merror ("realloc (i*4) failed.");
       free (save_state);
     }
+puts("done");
 
   p1 = realloc (p1, 40);
+puts("after realloc");
   free (p2);
+puts("after free 1");
   p2 = malloc (10);
+puts("after malloc");
   if (p2 == NULL)
     merror ("malloc (10) failed.");
   free (p1);
+puts("after free 2");
 
   return errors != 0;
 }

Modified: fsf/trunk/libc/sysdeps/posix/cuserid.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/cuserid.c (original)
+++ fsf/trunk/libc/sysdeps/posix/cuserid.c Fri Mar 26 00:03:15 2010
@@ -44,6 +44,6 @@
 
   if (s == NULL)
     s = name;
-  s[L_userid - 1] = '\0';
+  s[L_cuserid - 1] = '\0';
   return strncpy (s, pwptr->pw_name, L_cuserid - 1);
 }

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/clock_getres.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/clock_getres.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/clock_getres.c Fri Mar 26 00:03:15 2010
@@ -1,5 +1,5 @@
 /* clock_getres -- Get the resolution of a POSIX clockid_t.  Linux version.
-   Copyright (C) 2003,2004,2005,2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2003,2004,2005,2006,2008,2010 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
@@ -44,6 +44,9 @@
   SYSDEP_GETRES_CPUTIME							      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
+  case CLOCK_MONOTONIC_RAW:						      \
+  case CLOCK_REALTIME_COARSE:						      \
+  case CLOCK_MONOTONIC_COARSE:						      \
     SYSCALL_GETRES
 
 # define __libc_missing_posix_timers 0
@@ -80,6 +83,9 @@
   SYSDEP_GETRES_CPUTIME							      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
+  case CLOCK_MONOTONIC_RAW:						      \
+  case CLOCK_REALTIME_COARSE:						      \
+  case CLOCK_MONOTONIC_COARSE:						      \
     retval = maybe_syscall_getres (clock_id, res);			      \
     if (retval == 0)							      \
       break;								      \

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/clock_gettime.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/clock_gettime.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/clock_gettime.c Fri Mar 26 00:03:15 2010
@@ -1,5 +1,5 @@
 /* clock_gettime -- Get current time from a POSIX clockid_t.  Linux version.
-   Copyright (C) 2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 2003,2004,2005,2006,2007,2010 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
@@ -80,6 +80,9 @@
   SYSDEP_GETTIME_CPUTIME						      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
+  case CLOCK_MONOTONIC_RAW:						      \
+  case CLOCK_REALTIME_COARSE:						      \
+  case CLOCK_MONOTONIC_COARSE:						      \
     retval = maybe_syscall_gettime (clock_id, tp);			      \
     if (retval == 0)							      \
       break;								      \

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/clock_settime.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/clock_settime.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/clock_settime.c Fri Mar 26 00:03:15 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006, 2010 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
@@ -45,7 +45,7 @@
       INTERNAL_SYSCALL_DECL (err);
       int r = INTERNAL_SYSCALL (clock_settime, err, 2, clock_id, tp);
       if (!INTERNAL_SYSCALL_ERROR_P (r, err))
-        return 0;
+	return 0;
 
       e = INTERNAL_SYSCALL_ERRNO (r, err);
 # ifndef __ASSUME_POSIX_TIMERS
@@ -90,6 +90,7 @@
 /* The REALTIME clock might be available.  Try the syscall first.  */
 # define SYSDEP_SETTIME \
   case CLOCK_REALTIME:							      \
+  case CLOCK_REALTIME_COARSE:						      \
     {									      \
       int e = EINVAL;							      \
 									      \