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

[commits] r8260 - in /fsf/trunk/libc: ./ stdio-common/ sysdeps/unix/sysv/linux/



Author: eglibc
Date: Fri Apr 10 00:04:27 2009
New Revision: 8260

Log:
Import glibc-mainline for 2009-04-10

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/stdio-common/vfprintf.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/preadv.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/pwritev.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri Apr 10 00:04:27 2009
@@ -1,3 +1,15 @@
+2009-04-09  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* stdio-common/vfprintf.c (vfprintf): Slightly more compact code.
+	Simplified code and possible copy problem fixed.
+
+	* sysdeps/unix/sysv/linux/preadv.c: Avoid prototype for static
+	function if it is not defined.  Add some necessary casts.
+	* sysdeps/unix/sysv/linux/pwritev.c: Likewise.
+
+	* sysdeps/unix/sysv/linux/kernel-features.h: SPARC and IA64 also
+	have preadv/pwritev in 2.6.30.
+
 2009-04-08  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* malloc/malloc.c (malloc_info): New function.

Modified: fsf/trunk/libc/stdio-common/vfprintf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/vfprintf.c (original)
+++ fsf/trunk/libc/stdio-common/vfprintf.c Fri Apr 10 00:04:27 2009
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008
-   Free Software Foundation, Inc.
+/* Copyright (C) 1991-2008, 2009   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
@@ -1663,24 +1662,10 @@
 	  {
 	    /* Extend the array of format specifiers.  */
 	    struct printf_spec *old = specs;
-
-	    nspecs_max *= 2;
-	    specs = alloca (nspecs_max * sizeof (struct printf_spec));
-
-	    if (specs == &old[nspecs])
-	      /* Stack grows up, OLD was the last thing allocated;
-		 extend it.  */
-	      nspecs_max += nspecs_max / 2;
-	    else
-	      {
-		/* Copy the old array's elements to the new space.  */
-		memcpy (specs, old, nspecs * sizeof (struct printf_spec));
-		if (old == &specs[nspecs])
-		  /* Stack grows down, OLD was just below the new
-		     SPECS.  We can use that space when the new space
-		     runs out.  */
-		  nspecs_max += nspecs_max / 2;
-	      }
+	    specs = extend_alloca (specs, nspecs_max, 2 * nspecs_max);
+
+	    /* Copy the old array's elements to the new space.  */
+	    memmove (specs, old, nspecs * sizeof (struct printf_spec));
 	  }
 
 	/* Parse the format specifier.  */
@@ -1743,13 +1728,21 @@
 	  args_value[cnt].mem = va_arg (ap_save, type);			      \
 	  break
 
-	T (PA_CHAR, pa_int, int); /* Promoted.  */
 	T (PA_WCHAR, pa_wchar, wint_t);
-	T (PA_INT|PA_FLAG_SHORT, pa_int, int); /* Promoted.  */
+	case PA_CHAR:				/* Promoted.  */
+	case PA_INT|PA_FLAG_SHORT:		/* Promoted.  */
+#if LONG_MAX == INT_MAX
+	case PA_INT|PA_FLAG_LONG:
+#endif
 	T (PA_INT, pa_int, int);
-	T (PA_INT|PA_FLAG_LONG, pa_long_int, long int);
+#if LONG_MAX == LONG_LONG_MAX
+	case PA_INT|PA_FLAG_LONG:
+#endif
 	T (PA_INT|PA_FLAG_LONG_LONG, pa_long_long_int, long long int);
-	T (PA_FLOAT, pa_double, double);	/* Promoted.  */
+#if LONG_MAX != INT_MAX && LONG_MAX != LONG_LONG_MAX
+# error "he?"
+#endif
+	case PA_FLOAT:				/* Promoted.  */
 	T (PA_DOUBLE, pa_double, double);
 	case PA_DOUBLE|PA_FLAG_LONG_DOUBLE:
 	  if (__ldbl_is_dbl)
@@ -1760,8 +1753,8 @@
 	  else
 	    args_value[cnt].pa_long_double = va_arg (ap_save, long double);
 	  break;
-	T (PA_STRING, pa_string, const char *);
-	T (PA_WSTRING, pa_wstring, const wchar_t *);
+	case PA_STRING:				/* All pointers are the same */
+	case PA_WSTRING:			/* All pointers are the same */
 	T (PA_POINTER, pa_pointer, void *);
 #undef T
 	default:

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h Fri Apr 10 00:04:27 2009
@@ -532,7 +532,8 @@
 
 /* Support for preadv and pwritev was added in 2.6.30.  */
 #if __LINUX_KERNEL_VERSION >= 0x02061e \
-    && (defined __i386__ || defined __x86_64__ || defined __powerpc__)
+    && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
+	|| defined __ia64__ || defined __sparc__)
 # define __ASSUME_PREADV	1
 # define __ASSUME_PWRITEV	1
 #endif

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/preadv.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/preadv.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/preadv.c Fri Apr 10 00:04:27 2009
@@ -29,6 +29,7 @@
 #include <sys/syscall.h>
 #include <kernel-features.h>
 
+
 #ifndef PREADV
 # define PREADV preadv
 # define PREADV_REPLACEMENT __atomic_preadv_replacement
@@ -36,8 +37,10 @@
 # define OFF_T off_t
 #endif
 
+#ifndef __ASSUME_PREADV
 static ssize_t PREADV_REPLACEMENT (int, __const struct iovec *,
 				   int, OFF_T) internal_function;
+#endif
 
 
 ssize_t
@@ -51,14 +54,16 @@
   ssize_t result;
 
   if (SINGLE_THREAD_P)
-    result = INLINE_SYSCALL (preadv, 5, fd, vector, count, offset >> 32,
-			     offset & 0xffffffff);
+    result = INLINE_SYSCALL (preadv, 5, fd, vector, count,
+			     (off_t) ((off64_t) offset >> 32),
+			     (off_t) (offset & 0xffffffff));
   else
     {
       int oldtype = LIBC_CANCEL_ASYNC ();
 
-      result = INLINE_SYSCALL (preadv, 5, fd, vector, count, offset >> 32,
-			       offset & 0xffffffff);
+      result = INLINE_SYSCALL (preadv, 5, fd, vector, count,
+			       (off_t) ((off64_t) offset >> 32),
+			       (off_t) (offset & 0xffffffff));
 
       LIBC_CANCEL_RESET (oldtype);
     }

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/pwritev.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/pwritev.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/pwritev.c Fri Apr 10 00:04:27 2009
@@ -29,6 +29,7 @@
 #include <sys/syscall.h>
 #include <kernel-features.h>
 
+
 #ifndef PWRITEV
 # define PWRITEV pwritev
 # define PWRITEV_REPLACEMENT __atomic_pwritev_replacement
@@ -36,8 +37,10 @@
 # define OFF_T off_t
 #endif
 
+#ifndef __ASSUME_PWRITEV
 static ssize_t PWRITEV_REPLACEMENT (int, __const struct iovec *,
 				    int, OFF_T) internal_function;
+#endif
 
 
 ssize_t
@@ -51,14 +54,16 @@
   ssize_t result;
 
   if (SINGLE_THREAD_P)
-    result = INLINE_SYSCALL (pwritev, 5, fd, vector, count, offset >> 32,
-			     offset & 0xffffffff);
+    result = INLINE_SYSCALL (pwritev, 5, fd, vector, count,
+			     (off_t) ((off64_t) offset >> 32),
+			     (off_t) (offset & 0xffffffff));
   else
     {
       int oldtype = LIBC_CANCEL_ASYNC ();
 
-      result = INLINE_SYSCALL (pwritev, 5, fd, vector, count, offset >> 32,
-			       offset & 0xffffffff);
+      result = INLINE_SYSCALL (pwritev, 5, fd, vector, count,
+			       (off_t) ((off64_t) offset >> 32),
+			       (off_t) (offset & 0xffffffff));
 
       LIBC_CANCEL_RESET (oldtype);
     }