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

[commits] r1534 - in /fsf/trunk/libc: ./ io/ nptl/ nptl/sysdeps/pthread/ nscd/ stdio-common/ stdlib/ sysdeps/i386/fpu/ sysdeps/unix/sy...



Author: eglibc
Date: Thu Feb 22 00:01:32 2007
New Revision: 1534

Log:
Import glibc-mainline for 2007-02-22

Added:
    fsf/trunk/libc/io/bug-ftw5.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/posix_madvise.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/io/Makefile
    fsf/trunk/libc/io/ftw.c
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h
    fsf/trunk/libc/nscd/grpcache.c
    fsf/trunk/libc/nscd/hstcache.c
    fsf/trunk/libc/nscd/pwdcache.c
    fsf/trunk/libc/nscd/servicescache.c
    fsf/trunk/libc/stdio-common/printf_fp.c
    fsf/trunk/libc/stdio-common/tfformat.c
    fsf/trunk/libc/stdlib/strtod_l.c
    fsf/trunk/libc/sysdeps/i386/fpu/e_fmod.S
    fsf/trunk/libc/sysdeps/i386/fpu/e_fmodf.S
    fsf/trunk/libc/sysdeps/i386/fpu/e_fmodl.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/syscalls.list

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Feb 22 00:01:32 2007
@@ -1,3 +1,39 @@
+2007-02-21  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* stdlib/strtod_l.c (____STRTOF_INTERNAL): Add branch predictions
+	and fix some typos.
+	Optimize use of TOLOWER.
+
+	[BZ #3325]
+	* sysdeps/i386/fpu/e_fmodf.S: Revert last changes, keep using fprem.
+	* sysdeps/i386/fpu/e_fmodl.c: Likewise.
+	* sysdeps/i386/fpu/e_fmod.S: Likewise.
+
+	[BZ #3458]
+	* sysdeps/unix/sysv/linux/posix_madvise.c: New file.
+	* sysdeps/unix/sysv/linux/syscalls.list: Remove posix_madvise entry.
+
+	[BZ #4076]
+	* io/ftw.c (ftw_startup): Handle special case of FTW_CHDIR in /.
+	(open_dir_stream): Likewise.
+	* io/Makefile (tests): Add bug-ftw5.
+	io/bug-ftw5.c: New file.
+
+	* nscd/hstcache.c (cache_addhst): Remove unnecessary conditional.
+	* nscd/servicescache.c (cache_addserv): Likewise.
+
+	* nscd/grpcache.c (cache_addgr): In case a record changed on
+	refresh, adjust key_copy.
+
+	[BZ #4074]
+	* nscd/pwdcache.c (cache_addpw): In case a record changed on
+	refresh, adjust key_copy.
+
+	[BZ #4070]
+	* stdio-common/printf_fp.c (___printf_fp): Handle a few more
+	special cases.
+	* stdio-common/tfformat.c (sprint_doubles): Some more tests.
+
 2007-02-19  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* stdio-common/printf_fp.c (___printf_fp): Cleanups and minor

Modified: fsf/trunk/libc/io/Makefile
==============================================================================
--- fsf/trunk/libc/io/Makefile (original)
+++ fsf/trunk/libc/io/Makefile Thu Feb 22 00:01:32 2007
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2002,2003,2005,2006 Free Software Foundation, Inc.
+# Copyright (C) 1992-2002,2003,2005,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
@@ -66,7 +66,7 @@
 		   tst-openat tst-unlinkat tst-fstatat tst-futimesat \
 		   tst-renameat tst-fchownat tst-fchmodat tst-faccessat \
 		   tst-symlinkat tst-linkat tst-readlinkat tst-mkdirat \
-		   tst-mknodat tst-mkfifoat tst-ttyname_r
+		   tst-mknodat tst-mkfifoat tst-ttyname_r bug-ftw5
 
 distribute	:= ftwtest-sh
 

Added: fsf/trunk/libc/io/bug-ftw5.c
==============================================================================
--- fsf/trunk/libc/io/bug-ftw5.c (added)
+++ fsf/trunk/libc/io/bug-ftw5.c Thu Feb 22 00:01:32 2007
@@ -1,0 +1,25 @@
+#include <errno.h>
+#include <ftw.h>
+#include <stdio.h>
+
+static int
+fn (const char *file, const struct stat *sb, int flag, struct FTW *s)
+{
+  puts (file);
+  return FTW_STOP;
+}
+
+static int
+do_test (void)
+{
+  if (nftw ("/", fn, 0, FTW_CHDIR | FTW_ACTIONRETVAL) < 0)
+    {
+      printf ("nftw / FTW_CHDIR: %m\n");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/io/ftw.c
==============================================================================
--- fsf/trunk/libc/io/ftw.c (original)
+++ fsf/trunk/libc/io/ftw.c Thu Feb 22 00:01:32 2007
@@ -1,5 +1,5 @@
 /* File tree walker functions.
-   Copyright (C) 1996-2003, 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-2003, 2004, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -348,8 +348,17 @@
 	}
       else
 	{
-	  const char *name = ((data->flags & FTW_CHDIR)
-			      ? data->dirbuf + data->ftw.base: data->dirbuf);
+	  const char *name;
+
+	  if (data->flags & FTW_CHDIR)
+	    {
+	      name = data->dirbuf + data->ftw.base;
+	      if (name[0] == '\0')
+		name = ".";
+	    }
+	  else
+	    name = data->dirbuf;
+
 	  dirp->stream = __opendir (name);
 	}
 
@@ -721,9 +730,16 @@
   /* Get stat info for start directory.  */
   if (result == 0)
     {
-      const char *name = ((data.flags & FTW_CHDIR)
-			  ? data.dirbuf + data.ftw.base
-			  : data.dirbuf);
+      const char *name;
+
+      if (data.flags & FTW_CHDIR)
+	{
+	  name = data.dirbuf + data.ftw.base;
+	  if (name[0] == '\0')
+	    name = ".";
+	}
+      else
+	name = data.dirbuf;
 
       if (((flags & FTW_PHYS)
 	   ? LXSTAT (_STAT_VER, name, &st)

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Thu Feb 22 00:01:32 2007
@@ -1,3 +1,8 @@
+2007-02-21  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/pthread/pthread-functions.h: Correct last patch, correct
+	PTHFCT_CALL definition.
+
 2007-02-18  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* sysdeps/pthread/pthread-functions.h: If PTR_DEMANGLE is not

Modified: fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h Thu Feb 22 00:01:32 2007
@@ -106,13 +106,13 @@
 
 #ifdef PTR_DEMANGLE
 # define PTHFCT_CALL(fct, params) \
-  __libc_pthread_functions.fct params
-#else
-# define PTHFCT_CALL(fct, params) \
   ({ __typeof (__libc_pthread_functions.fct) __p;			      \
      __p = __libc_pthread_functions.fct;				      \
      PTR_DEMANGLE (__p);						      \
      __p params; })
+#else
+# define PTHFCT_CALL(fct, params) \
+  __libc_pthread_functions.fct params
 #endif
 
 #endif	/* pthread-functions.h */

Modified: fsf/trunk/libc/nscd/grpcache.c
==============================================================================
--- fsf/trunk/libc/nscd/grpcache.c (original)
+++ fsf/trunk/libc/nscd/grpcache.c Thu Feb 22 00:01:32 2007
@@ -279,6 +279,7 @@
 		  /* Adjust pointers into the memory block.  */
 		  gr_name = (char *) newp + (gr_name - (char *) dataset);
 		  cp = (char *) newp + (cp - (char *) dataset);
+		  key_copy = (char *) newp + (key_copy - (char *) dataset);
 
 		  dataset = memcpy (newp, dataset, total + n);
 		  alloca_used = false;

Modified: fsf/trunk/libc/nscd/hstcache.c
==============================================================================
--- fsf/trunk/libc/nscd/hstcache.c (original)
+++ fsf/trunk/libc/nscd/hstcache.c Thu Feb 22 00:01:32 2007
@@ -311,8 +311,8 @@
 		  /* Adjust pointers into the memory block.  */
 		  addresses = (char *) newp + (addresses - (char *) dataset);
 		  aliases = (char *) newp + (aliases - (char *) dataset);
-		  if (key_copy != NULL)
-		    key_copy = (char *) newp + (key_copy - (char *) dataset);
+		  assert (key_copy != NULL);
+		  key_copy = (char *) newp + (key_copy - (char *) dataset);
 
 		  dataset = memcpy (newp, dataset, total + req->key_len);
 		  alloca_used = false;

Modified: fsf/trunk/libc/nscd/pwdcache.c
==============================================================================
--- fsf/trunk/libc/nscd/pwdcache.c (original)
+++ fsf/trunk/libc/nscd/pwdcache.c Thu Feb 22 00:01:32 2007
@@ -274,6 +274,7 @@
 		{
 		  /* Adjust pointer into the memory block.  */
 		  cp = (char *) newp + (cp - (char *) dataset);
+		  key_copy = (char *) newp + (key_copy - (char *) dataset);
 
 		  dataset = memcpy (newp, dataset, total + n);
 		  alloca_used = false;

Modified: fsf/trunk/libc/nscd/servicescache.c
==============================================================================
--- fsf/trunk/libc/nscd/servicescache.c (original)
+++ fsf/trunk/libc/nscd/servicescache.c Thu Feb 22 00:01:32 2007
@@ -264,8 +264,8 @@
 		{
 		  /* Adjust pointers into the memory block.  */
 		  aliases = (char *) newp + (aliases - (char *) dataset);
-		  if (key_copy != NULL)
-		    key_copy = (char *) newp + (key_copy - (char *) dataset);
+		  assert (key_copy != NULL);
+		  key_copy = (char *) newp + (key_copy - (char *) dataset);
 
 		  dataset = memcpy (newp, dataset, total + req->key_len);
 		  alloca_used = false;

Modified: fsf/trunk/libc/stdio-common/printf_fp.c
==============================================================================
--- fsf/trunk/libc/stdio-common/printf_fp.c (original)
+++ fsf/trunk/libc/stdio-common/printf_fp.c Thu Feb 22 00:01:32 2007
@@ -926,7 +926,8 @@
 
     /* Generate the needed number of fractional digits.	 */
     int fracdig_no = 0;
-    while (fracdig_no < fracdig_min
+    int added_zeros = 0;
+    while (fracdig_no < fracdig_min + added_zeros
 	   || (fracdig_no < fracdig_max && (fracsize > 1 || frac[0] != 0)))
       {
 	++fracdig_no;
@@ -937,7 +938,7 @@
 	  {
 	    ++fracdig_max;
 	    if (fracdig_min > 0)
-	      ++fracdig_min;
+	      ++added_zeros;
 	  }
       }
 
@@ -974,11 +975,23 @@
 	  {
 	    /* Process fractional digits.  Terminate if not rounded or
 	       radix character is reached.  */
+	    int removed = 0;
 	    while (*--wtp != decimalwc && *wtp == L'9')
-	      *wtp = L'0';
+	      {
+		*wtp = L'0';
+		++removed;
+	      }
+	    if (removed == fracdig_min && added_zeros > 0)
+	      --added_zeros;
 	    if (*wtp != decimalwc)
 	      /* Round up.  */
 	      (*wtp)++;
+	    else if (__builtin_expect (spec == 'g' && type == 'f' && info->alt,
+				       0))
+	      /* This is a special case: the rounded number is 1.0,
+		 the format is 'g' or 'G', and the alternative format
+		 is selected.  This means the result mist be "1.".  */
+	      --added_zeros;
 	  }
 
 	if (fracdig_no == 0 || *wtp == decimalwc)
@@ -1045,7 +1058,7 @@
 
   do_expo:
     /* Now remove unnecessary '0' at the end of the string.  */
-    while (fracdig_no > fracdig_min && *(wcp - 1) == L'0')
+    while (fracdig_no > fracdig_min + added_zeros && *(wcp - 1) == L'0')
       {
 	--wcp;
 	--fracdig_no;
@@ -1063,26 +1076,41 @@
     /* Write the exponent if it is needed.  */
     if (type != 'f')
       {
-	*wcp++ = (wchar_t) type;
-	*wcp++ = expsign ? L'-' : L'+';
-
-	/* Find the magnitude of the exponent.	*/
-	expscale = 10;
-	while (expscale <= exponent)
-	  expscale *= 10;
-
-	if (exponent < 10)
-	  /* Exponent always has at least two digits.  */
-	  *wcp++ = L'0';
+	if (__builtin_expect (expsign != 0 && exponent == 4 && spec == 'g', 0))
+	  {
+	    /* This is another special case.  The exponent of the number is
+	       really smaller than -4, which requires the 'e'/'E' format.
+	       But after rounding the number has an exponent of -4.  */
+	    assert (wcp >= wstartp + 2);
+	    assert (wstartp[0] == L'1');
+	    __wmemcpy (wstartp, L"0.0001", 6);
+	    wstartp[1] = decimalwc;
+	    wmemset (wstartp + 6, L'0', wcp - (wstartp + 2));
+	    wcp += 4;
+	  }
 	else
-	  do
-	    {
-	      expscale /= 10;
-	      *wcp++ = L'0' + (exponent / expscale);
-	      exponent %= expscale;
-	    }
-	  while (expscale > 10);
-	*wcp++ = L'0' + exponent;
+	  {
+	    *wcp++ = (wchar_t) type;
+	    *wcp++ = expsign ? L'-' : L'+';
+
+	    /* Find the magnitude of the exponent.	*/
+	    expscale = 10;
+	    while (expscale <= exponent)
+	      expscale *= 10;
+
+	    if (exponent < 10)
+	      /* Exponent always has at least two digits.  */
+	      *wcp++ = L'0';
+	    else
+	      do
+		{
+		  expscale /= 10;
+		  *wcp++ = L'0' + (exponent / expscale);
+		  exponent %= expscale;
+		}
+	      while (expscale > 10);
+	    *wcp++ = L'0' + exponent;
+	  }
       }
 
     /* Compute number of characters which must be filled with the padding

Modified: fsf/trunk/libc/stdio-common/tfformat.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tfformat.c (original)
+++ fsf/trunk/libc/stdio-common/tfformat.c Thu Feb 22 00:01:32 2007
@@ -4012,6 +4012,14 @@
   {__LINE__, 16,			"0x1.0p+4", "%.1a"},
   {__LINE__, 16,			"0x1.00000000000000000000p+4", "%.20a"},
   {__LINE__, 4444.88888888,		"4445", "%2.F"},
+  {__LINE__, 0.956,			"1", "%.0g"},
+  {__LINE__, 1.0956,			"1.", "%#.0g"},
+  {__LINE__, 0.956,			"1.", "%#.0g"},
+  {__LINE__, 0.0956,			"0.1", "%#.0g"},
+  {__LINE__, 0.00956,			"0.01", "%#.0g"},
+  {__LINE__, 0.000956,			"0.001", "%#.0g"},
+  {__LINE__, 0.000098,			"0.0001", "%#.0g"},
+  {__LINE__, 0.0000996,			"0.00010", "%#.2g"},
 
   {0 }
 
@@ -4023,13 +4031,8 @@
 
 int required_precision = 13;
 
-#if defined(__STDC__) || defined(__cplusplus)
 static int
 matches (register char *result, register const char *desired)
-#else
-int matches(result, desired)
-     register char *result; register const char *desired;
-#endif
 {
     int digits_seen = 0;
     for (;; result++, desired++) {
@@ -4080,7 +4083,7 @@
 
   /* And one special test.  */
   {
-    const char ref[] = "1.7763568394002504646778106689453125e-15";
+    static const char ref[] = "1.7763568394002504646778106689453125e-15";
     int i;
     d = 1.0;
     for (i = 1; i < 50; ++i)

Modified: fsf/trunk/libc/stdlib/strtod_l.c
==============================================================================
--- fsf/trunk/libc/stdlib/strtod_l.c (original)
+++ fsf/trunk/libc/stdlib/strtod_l.c Thu Feb 22 00:01:32 2007
@@ -482,7 +482,7 @@
 
   struct locale_data *current = loc->__locales[LC_NUMERIC];
 
-  if (group)
+  if (__builtin_expect (group, 0))
     {
       grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
       if (*grouping <= 0 || *grouping == CHAR_MAX)
@@ -548,7 +548,7 @@
       && (wint_t) cp[1] >= L'0' && (wint_t) cp[1] <= L'9')
     {
       /* We accept it.  This funny construct is here only to indent
-	 the code directly.  */
+	 the code correctly.  */
     }
 #else
   for (cnt = 0; decimal[cnt] != '\0'; ++cnt)
@@ -557,13 +557,15 @@
   if (decimal[cnt] == '\0' && cp[cnt] >= '0' && cp[cnt] <= '9')
     {
       /* We accept it.  This funny construct is here only to indent
-	 the code directly.  */
+	 the code correctly.  */
     }
 #endif
   else if (c < L_('0') || c > L_('9'))
     {
       /* Check for `INF' or `INFINITY'.  */
-      if (TOLOWER_C (c) == L_('i') && STRNCASECMP (cp, L_("inf"), 3) == 0)
+      CHAR_TYPE lowc = TOLOWER_C (c);
+
+      if (lowc == L_('i') && STRNCASECMP (cp, L_("inf"), 3) == 0)
 	{
 	  /* Return +/- infinity.  */
 	  if (endptr != NULL)
@@ -574,7 +576,7 @@
 	  return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
 	}
 
-      if (TOLOWER_C (c) == L_('n') && STRNCASECMP (cp, L_("nan"), 3) == 0)
+      if (lowc == L_('n') && STRNCASECMP (cp, L_("nan"), 3) == 0)
 	{
 	  /* Return NaN.  */
 	  FLOAT retval = NAN;
@@ -588,7 +590,8 @@
 	      do
 		++cp;
 	      while ((*cp >= L_('0') && *cp <= L_('9'))
-		     || (TOLOWER (*cp) >= L_('a') && TOLOWER (*cp) <= L_('z'))
+		     || ({ CHAR_TYPE lo = TOLOWER (*cp);
+			   lo >= L_('a') && lo <= L_('z'); })
 		     || *cp == L_('_'));
 
 	      if (*cp != L_(')'))
@@ -640,7 +643,7 @@
   while (c == L'0' || ((wint_t) thousands != L'\0' && c == (wint_t) thousands))
     c = *++cp;
 #else
-  if (thousands == NULL)
+  if (__builtin_expect (thousands == NULL, 1))
     while (c == '0')
       c = *++cp;
   else
@@ -664,9 +667,9 @@
 
   /* If no other digit but a '0' is found the result is 0.0.
      Return current read pointer.  */
+  CHAR_TYPE lowc = TOLOWER (c);
   if (!((c >= L_('0') && c <= L_('9'))
-	|| (base == 16 && ((CHAR_TYPE) TOLOWER (c) >= L_('a')
-			   && (CHAR_TYPE) TOLOWER (c) <= L_('f')))
+	|| (base == 16 && lowc >= L_('a') && lowc <= L_('f'))
 	|| (
 #ifdef USE_WIDE_CHAR
 	    c == (wint_t) decimal
@@ -682,11 +685,11 @@
 	    && (base != 16
 		|| cp != start_of_digits
 		|| (cp[decimal_len] >= L_('0') && cp[decimal_len] <= L_('9'))
-		|| ((CHAR_TYPE) TOLOWER (cp[decimal_len]) >= L_('a')
-		    && (CHAR_TYPE) TOLOWER (cp[decimal_len]) <= L_('f'))))
+		|| ({ CHAR_TYPE lo = TOLOWER (cp[decimal_len]);
+		      lo >= L_('a') && lo <= L_('f'); })))
 	|| (base == 16 && (cp != start_of_digits
-			   && (CHAR_TYPE) TOLOWER (c) == L_('p')))
-	|| (base != 16 && (CHAR_TYPE) TOLOWER (c) == L_('e'))))
+			   && lowc == L_('p')))
+	|| (base != 16 && lowc == L_('e'))))
     {
 #ifdef USE_WIDE_CHAR
       tp = __correctly_grouped_prefixwc (start_of_digits, cp, thousands,
@@ -707,17 +710,19 @@
   while (1)
     {
       if ((c >= L_('0') && c <= L_('9'))
-	  || (base == 16 && (wint_t) TOLOWER (c) >= L_('a')
-	      && (wint_t) TOLOWER (c) <= L_('f')))
+	  || (base == 16
+	      && ({ CHAR_TYPE lo = TOLOWER (c);
+		    lo >= L_('a') && lo <= L_('f'); })))
 	++dig_no;
       else
 	{
 #ifdef USE_WIDE_CHAR
-	  if ((wint_t) thousands == L'\0' || c != (wint_t) thousands)
+	  if (__builtin_expect ((wint_t) thousands == L'\0', 1)
+	      || c != (wint_t) thousands)
 	    /* Not a digit or separator: end of the integer part.  */
 	    break;
 #else
-	  if (thousands == NULL)
+	  if (__builtin_expect (thousands == NULL, 1))
 	    break;
 	  else
 	    {
@@ -733,7 +738,7 @@
       c = *++cp;
     }
 
-  if (grouping && cp > start_of_digits)
+  if (__builtin_expect (grouping != NULL, 0) && cp > start_of_digits)
     {
       /* Check the grouping of the digits.  */
 #ifdef USE_WIDE_CHAR
@@ -794,7 +799,8 @@
       cp += decimal_len;
       c = *cp;
       while ((c >= L_('0') && c <= L_('9')) ||
-	     (base == 16 && TOLOWER (c) >= L_('a') && TOLOWER (c) <= L_('f')))
+	     (base == 16 && ({ CHAR_TYPE lo = TOLOWER (c);
+			       lo >= L_('a') && lo <= L_('f'); })))
 	{
 	  if (c != L_('0') && lead_zero == -1)
 	    lead_zero = dig_no - int_no;
@@ -807,8 +813,9 @@
   expp = cp;
 
   /* Read exponent.  */
-  if ((base == 16 && TOLOWER (c) == L_('p'))
-      || (base != 16 && TOLOWER (c) == L_('e')))
+  lowc = TOLOWER (c);
+  if ((base == 16 && lowc == L_('p'))
+      || (base != 16 && lowc == L_('e')))
     {
       int exp_negative = 0;
 
@@ -840,7 +847,7 @@
 	      exponent *= 10;
 	      exponent += c - L_('0');
 
-	      if (exponent > exp_limit)
+	      if (__builtin_expect (exponent > exp_limit, 0))
 		/* The exponent is too large/small to represent a valid
 		   number.  */
 		{
@@ -1024,13 +1031,13 @@
     exponent -= incr;
   }
 
-  if (int_no + exponent > MAX_10_EXP + 1)
+  if (__builtin_expect (int_no + exponent > MAX_10_EXP + 1, 0))
     {
       __set_errno (ERANGE);
       return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
     }
 
-  if (exponent < MIN_10_EXP - (DIG + 1))
+  if (__builtin_expect (exponent < MIN_10_EXP - (DIG + 1), 0))
     {
       __set_errno (ERANGE);
       return 0.0;
@@ -1094,7 +1101,7 @@
 
       /* Now we know the exponent of the number in base two.
 	 Check it against the maximum possible exponent.  */
-      if (bits > MAX_EXP)
+      if (__builtin_expect (bits > MAX_EXP, 0))
 	{
 	  __set_errno (ERANGE);
 	  return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;

Modified: fsf/trunk/libc/sysdeps/i386/fpu/e_fmod.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/e_fmod.S (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/e_fmod.S Thu Feb 22 00:01:32 2007
@@ -10,7 +10,7 @@
 ENTRY(__ieee754_fmod)
 	fldl	12(%esp)
 	fldl	4(%esp)
-1:	fprem1
+1:	fprem
 	fstsw	%ax
 	sahf
 	jp	1b

Modified: fsf/trunk/libc/sysdeps/i386/fpu/e_fmodf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/e_fmodf.S (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/e_fmodf.S Thu Feb 22 00:01:32 2007
@@ -11,7 +11,7 @@
 ENTRY(__ieee754_fmodf)
 	flds	8(%esp)
 	flds	4(%esp)
-1:	fprem1
+1:	fprem
 	fstsw	%ax
 	sahf
 	jp	1b

Modified: fsf/trunk/libc/sysdeps/i386/fpu/e_fmodl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/e_fmodl.c (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/e_fmodl.c Thu Feb 22 00:01:32 2007
@@ -12,7 +12,7 @@
 {
   long double res;
 
-  asm ("1:\tfprem1\n"
+  asm ("1:\tfprem\n"
        "fstsw   %%ax\n"
        "sahf\n"
        "jp      1b\n"

Added: fsf/trunk/libc/sysdeps/unix/sysv/linux/posix_madvise.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/posix_madvise.c (added)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/posix_madvise.c Thu Feb 22 00:01:32 2007
@@ -1,0 +1,38 @@
+/* Copyright (C) 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <sys/mman.h>
+
+
+int
+posix_madvise (void *addr, size_t len, int advice)
+{
+  /* We have one problem: the kernel's MADV_DONTNEED does not
+     correspond to POSIX's POSIX_MADV_DONTNEED.  The former simply
+     discards changes made to the memory without writing it back to
+     disk, if this would be necessary.  The POSIX behavior does not
+     allow this.  There is no functionality mapping the POSIX behavior
+     so far so we ignore that advice for now.  */
+  if (advice == POSIX_MADV_DONTNEED)
+    return 0;
+
+  INTERNAL_SYSCALL_DECL (err);
+  int result = INTERNAL_SYSCALL (madvise, err, 3, addr, len, advice);
+  return INTERNAL_SYSCALL_ERRNO (result, err);
+}

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/syscalls.list
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/syscalls.list (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/syscalls.list Thu Feb 22 00:01:32 2007
@@ -32,7 +32,6 @@
 iopl		-	iopl		i:i	iopl
 klogctl		EXTRA	syslog		i:isi	klogctl
 lchown		-	lchown		i:sii	__lchown	lchown
-posix_madvise	-	madvise		Vi:pii	posix_madvise
 madvise		-	madvise		i:pii	madvise
 mincore		-	mincore		i:anV	mincore
 mlock		-	mlock		i:bn	mlock