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

[commits] r1725 - in /fsf/trunk/libc: ./ argp/ inet/ login/ math/ sysdeps/i386/fpu/ sysdeps/unix/sysv/linux/ sysdeps/x86_64/fpu/



Author: eglibc
Date: Fri Mar 16 00:01:30 2007
New Revision: 1725

Log:
Import glibc-mainline for 2007-03-16

Added:
    fsf/trunk/libc/argp/tst-argp2.c
    fsf/trunk/libc/inet/test-inet6_opt.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/argp/Makefile
    fsf/trunk/libc/argp/argp-help.c
    fsf/trunk/libc/inet/Makefile
    fsf/trunk/libc/inet/inet6_opt.c
    fsf/trunk/libc/login/utmp_file.c
    fsf/trunk/libc/math/libm-test.inc
    fsf/trunk/libc/sysdeps/i386/fpu/e_log.S
    fsf/trunk/libc/sysdeps/i386/fpu/e_logf.S
    fsf/trunk/libc/sysdeps/i386/fpu/e_logl.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/check_pf.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/ifaddrs.c
    fsf/trunk/libc/sysdeps/x86_64/fpu/e_log10l.S
    fsf/trunk/libc/sysdeps/x86_64/fpu/e_log2l.S
    fsf/trunk/libc/sysdeps/x86_64/fpu/e_logl.S
    fsf/trunk/libc/sysdeps/x86_64/fpu/s_log1pl.S

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri Mar 16 00:01:30 2007
@@ -1,3 +1,46 @@
+2007-03-15  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #3919]
+	* math/libm-test.inc (log_test): Test -Inf and NaN.
+	(log10_test, log1p_test, log2_test): Test -Inf.
+	* sysdeps/i386/fpu/e_log.S (__ieee754_log): Don't raise
+	FE_INVALID when argument is qNaN.
+	* sysdeps/i386/fpu/e_logl.S (__ieee754_logl): Likewise.
+	* sysdeps/i386/fpu/e_logf.S (__ieee754_logf): Likewise.
+	* sysdeps/x86_64/fpu/e_logl.S (__ieee754_logl): Likewise.
+	* sysdeps/x86_64/fpu/e_log10l.S (__ieee754_log10l): Replace
+	andb $1, %ah with testb $1, %ah, don't test for parity, instead
+	testb $4, %ah and jump if non-zero.
+	* sysdeps/x86_64/fpu/e_log2l.S (__ieee754_log2l): Likewise.
+	* sysdeps/x86_64/fpu/s_log1pl.S (__log1pl): Likewise.
+
+	[BZ #4101]
+	* argp/argp-help.c (hol_cluster_cmp): Fix comparisons used to find
+	ancestors with the same depths.
+	Patch by Niels Moeller <nisse@xxxxxxxxxxxxxx>.
+	(filter_doc): Don't crash if argp is NULL.
+	* argp/Makefile (tests): Add tst-argp2.
+	* argp/tst-argp2.c: New test.
+
+	[BZ #4130]
+	* login/utmp_file.c (setutent_file): Use O_LARGEFILE for
+	open_not_cancel_2.
+	(updwtmp_file): Likewise.
+
+	[BZ #4181]
+	* inet/inet6_opt.c (add_padding): Only insert padding if npad > 0.
+	(inet6_opt_append): Don't check extlen is big enough if extbuf
+	is NULL.
+	(inet6_opt_finish): Likewise.
+	* inet/Makefile (tests): Add test-inet6_opt.
+	* inet/test-inet6_opt.c: New test.
+
+	* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Never
+	reallocate the buffer, instead fail for MSG_TRUNC or for EBUSY
+	NLMSG_ERR.  Instead use a page sized buffer.
+	* sysdeps/unix/sysv/linux/check_pf.c (make_request): Use page sized
+	buffer.
+
 2007-03-14  Richard Henderson  <rth@xxxxxxxxxx>
 
 	* sysdeps/alpha/fpu/s_llround.c: New file.

Modified: fsf/trunk/libc/argp/Makefile
==============================================================================
--- fsf/trunk/libc/argp/Makefile (original)
+++ fsf/trunk/libc/argp/Makefile Fri Mar 16 00:01:30 2007
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 2002, 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2002, 2003, 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
@@ -26,7 +26,7 @@
 routines	= $(addprefix argp-, ba fmtstream fs-xinl help parse pv \
 				     pvh xinl eexst)
 
-tests		= argp-test tst-argp1 bug-argp1
+tests		= argp-test tst-argp1 bug-argp1 tst-argp2
 
 CFLAGS-argp-help.c = $(uses-callbacks) -fexceptions
 CFLAGS-argp-parse.c = $(uses-callbacks)

Modified: fsf/trunk/libc/argp/argp-help.c
==============================================================================
--- fsf/trunk/libc/argp/argp-help.c (original)
+++ fsf/trunk/libc/argp/argp-help.c Fri Mar 16 00:01:30 2007
@@ -1,5 +1,6 @@
 /* Hierarchial argument parsing help output
-   Copyright (C) 1995-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1995-2003, 2004, 2005, 2006, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@xxxxxxxxxxxxxx>.
 
@@ -672,9 +673,9 @@
 {
   /* If one cluster is deeper than the other, use its ancestor at the same
      level, so that finding the common ancestor is straightforward.  */
-  while (cl1->depth < cl2->depth)
+  while (cl1->depth > cl2->depth)
     cl1 = cl1->parent;
-  while (cl2->depth < cl1->depth)
+  while (cl2->depth > cl1->depth)
     cl2 = cl2->parent;
 
   /* Now reduce both clusters to their ancestors at the point where both have
@@ -987,7 +988,7 @@
 filter_doc (const char *doc, int key, const struct argp *argp,
 	    const struct argp_state *state)
 {
-  if (argp->help_filter)
+  if (argp && argp->help_filter)
     /* We must apply a user filter to this output.  */
     {
       void *input = __argp_input (argp, state);

Added: fsf/trunk/libc/argp/tst-argp2.c
==============================================================================
--- fsf/trunk/libc/argp/tst-argp2.c (added)
+++ fsf/trunk/libc/argp/tst-argp2.c Fri Mar 16 00:01:30 2007
@@ -1,0 +1,101 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2007.
+
+   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 <argp.h>
+
+static const struct argp_option opt1[] =
+  {
+    { "opt1", '1', "NUMBER", 0, "Option 1" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static const struct argp_option opt2[] =
+  {
+    { "opt2", '2', "NUMBER", 0, "Option 2" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static const struct argp_option opt3[] =
+  {
+    { "opt3", '3', "NUMBER", 0, "Option 3" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static const struct argp_option opt4[] =
+  {
+    { "opt4", '4', "NUMBER", 0, "Option 4" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static const struct argp_option opt5[] =
+  {
+    { "opt5", '5', "NUMBER", 0, "Option 5" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static struct argp argp5 =
+  {
+    opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL
+  };
+
+static struct argp argp4 =
+  {
+    opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL
+  };
+
+static struct argp argp3 =
+  {
+    opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL
+  };
+
+static struct argp_child children2[] =
+  {
+    { &argp4, 0, "child3", 3 },
+    { &argp5, 0, "child4", 4 },
+    { NULL, 0, NULL, 0 }
+  };
+
+static struct argp argp2 =
+  {
+    opt2, NULL, "args doc2", "doc2", children2, NULL, NULL
+  };
+
+static struct argp_child children1[] =
+  {
+    { &argp2, 0, "child1", 1 },
+    { &argp3, 0, "child2", 2 },
+    { NULL, 0, NULL, 0 }
+  };
+
+static struct argp argp1 =
+  {
+    opt1, NULL, "args doc1", "doc1", children1, NULL, NULL
+  };
+
+
+static int
+do_test (void)
+{
+  argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2");
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/inet/Makefile
==============================================================================
--- fsf/trunk/libc/inet/Makefile (original)
+++ fsf/trunk/libc/inet/Makefile Fri Mar 16 00:01:30 2007
@@ -52,7 +52,7 @@
 aux := check_pf ifreq
 
 tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \
-	 tst-gethnm test-ifaddrs bug-if1
+	 tst-gethnm test-ifaddrs bug-if1 test-inet6_opt
 
 include ../Rules
 

Modified: fsf/trunk/libc/inet/inet6_opt.c
==============================================================================
--- fsf/trunk/libc/inet/inet6_opt.c (original)
+++ fsf/trunk/libc/inet/inet6_opt.c Fri Mar 16 00:01:30 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2006.
 
@@ -51,7 +51,7 @@
 {
   if (npad == 1)
     extbuf[offset] = IP6OPT_PAD1;
-  else
+  else if (npad > 0)
     {
       struct ip6_opt *pad_opt = (struct ip6_opt *) (extbuf + offset);
 
@@ -102,21 +102,17 @@
   int data_offset = offset + sizeof (struct ip6_opt);
   int npad = (align - data_offset % align) & (align - 1);
 
-  /* Now we can check whether the buffer is large enough.  */
-  if (data_offset + npad + len > extlen)
-    return -1;
-
-  if (npad != 0)
-    {
-      if (extbuf != NULL)
-	add_padding (extbuf, offset, npad);
+  if (extbuf != NULL)
+    {
+      /* Now we can check whether the buffer is large enough.  */
+      if (data_offset + npad + len > extlen)
+	return -1;
+
+      add_padding (extbuf, offset, npad);
 
       offset += npad;
-    }
-
-  /* Now prepare the option itself.  */
-  if (extbuf != NULL)
-    {
+
+      /* Now prepare the option itself.  */
       struct ip6_opt *opt = (struct ip6_opt *) ((uint8_t *) extbuf + offset);
 
       opt->ip6o_type = type;
@@ -124,6 +120,8 @@
 
       *databufp = opt + 1;
     }
+  else
+    offset += npad;
 
   return offset + sizeof (struct ip6_opt) + len;
 }
@@ -145,12 +143,14 @@
   /* Required padding at the end.  */
   int npad = (8 - (offset & 7)) & 7;
 
-  /* Make sure the buffer is large enough.  */
-  if (offset + npad > extlen)
-    return -1;
-
   if (extbuf != NULL)
-    add_padding (extbuf, offset, npad);
+    {
+      /* Make sure the buffer is large enough.  */
+      if (offset + npad > extlen)
+	return -1;
+
+      add_padding (extbuf, offset, npad);
+    }
 
   return offset + npad;
 }

Added: fsf/trunk/libc/inet/test-inet6_opt.c
==============================================================================
--- fsf/trunk/libc/inet/test-inet6_opt.c (added)
+++ fsf/trunk/libc/inet/test-inet6_opt.c Fri Mar 16 00:01:30 2007
@@ -1,0 +1,207 @@
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define OPT_X	42
+#define OPT_Y	43
+#define OPT_Z	44
+
+static void *
+encode_inet6_opt (socklen_t *elp)
+{
+  void *eb = NULL;
+  socklen_t el;
+  int cl;
+  void *db;
+  int offset;
+  uint8_t val1;
+  uint16_t val2;
+  uint32_t val4;
+  uint64_t val8;
+
+  *elp = 0;
+#define CHECK() \
+  if (cl == -1)						\
+    {							\
+      printf ("cl == -1 on line %d\n", __LINE__);	\
+      free (eb);					\
+      return NULL;					\
+    }
+
+  /* Estimate the length */
+  cl = inet6_opt_init (NULL, 0);
+  CHECK ();
+  cl = inet6_opt_append (NULL, 0, cl, OPT_X, 12, 8, NULL);
+  CHECK ();
+  cl = inet6_opt_append (NULL, 0, cl, OPT_Y, 7, 4, NULL);
+  CHECK ();
+  cl = inet6_opt_append (NULL, 0, cl, OPT_Z, 7, 1, NULL);
+  CHECK ();
+  cl = inet6_opt_finish (NULL, 0, cl);
+  CHECK ();
+  el = cl;
+
+  eb = malloc (el + 8);
+  if (eb == NULL)
+    {
+      puts ("malloc failed");
+      return NULL;
+    }
+  /* Canary.  */
+  memcpy (eb + el, "deadbeef", 8);
+
+  cl = inet6_opt_init (eb, el);
+  CHECK ();
+
+  cl = inet6_opt_append (eb, el, cl, OPT_X, 12, 8, &db);
+  CHECK ();
+  val4 = 0x12345678;
+  offset = inet6_opt_set_val (db, 0, &val4, sizeof  (val4));
+  val8 = 0x0102030405060708LL;
+  inet6_opt_set_val (db, offset, &val8, sizeof  (val8));
+
+  cl = inet6_opt_append (eb, el, cl, OPT_Y, 7, 4, &db);
+  CHECK ();
+  val1 = 0x01;
+  offset = inet6_opt_set_val (db, 0, &val1, sizeof  (val1));
+  val2 = 0x1331;
+  offset = inet6_opt_set_val (db, offset, &val2, sizeof  (val2));
+  val4 = 0x01020304;
+  inet6_opt_set_val (db, offset, &val4, sizeof  (val4));
+
+  cl = inet6_opt_append (eb, el, cl, OPT_Z, 7, 1, &db);
+  CHECK ();
+  inet6_opt_set_val (db, 0, (void *) "abcdefg", 7);
+
+  cl = inet6_opt_finish (eb, el, cl);
+  CHECK ();
+
+  if (memcmp (eb + el, "deadbeef", 8) != 0)
+    {
+      puts ("Canary corrupted");
+      free (eb);
+      return NULL;
+    }
+  *elp = el;
+  return eb;
+}
+
+int
+decode_inet6_opt (void *eb, socklen_t el)
+{
+  int ret = 0;
+  int seq = 0;
+  int cl = 0;
+  int offset;
+  uint8_t type;
+  socklen_t len;
+  uint8_t val1;
+  uint16_t val2;
+  uint32_t val4;
+  uint64_t val8;
+  void *db;
+  char buf[8];
+
+  while ((cl = inet6_opt_next (eb, el, cl, &type, &len, &db)) != -1)
+    switch (type)
+      {
+      case OPT_X:
+	if (seq++ != 0)
+	  {
+	    puts ("OPT_X is not first");
+	    ret = 1;
+	  }
+	if (len != 12)
+	  {
+	    printf ("OPT_X's length %d != 12\n", len);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, 0, &val4, sizeof (val4));
+	if (val4 != 0x12345678)
+	  {
+	    printf ("OPT_X's val4 %x != 0x12345678\n", val4);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, offset, &val8, sizeof (val8));
+	if (offset != len || val8 != 0x0102030405060708LL)
+	  {
+	    printf ("OPT_X's val8 %llx != 0x0102030405060708\n",
+		    (long long) val8);
+	    ret = 1;
+	  }
+	break;
+      case OPT_Y:
+	if (seq++ != 1)
+	  {
+	    puts ("OPT_Y is not second");
+	    ret = 1;
+	  }
+	if (len != 7)
+	  {
+	    printf ("OPT_Y's length %d != 7\n", len);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, 0, &val1, sizeof (val1));
+	if (val1 != 0x01)
+	  {
+	    printf ("OPT_Y's val1 %x != 0x01\n", val1);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, offset, &val2, sizeof (val2));
+	if (val2 != 0x1331)
+	  {
+	    printf ("OPT_Y's val2 %x != 0x1331\n", val2);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, offset, &val4, sizeof (val4));
+	if (offset != len || val4 != 0x01020304)
+	  {
+	    printf ("OPT_Y's val4 %x != 0x01020304\n", val4);
+	    ret = 1;
+	  }
+	break;
+      case OPT_Z:
+	if (seq++ != 2)
+	  {
+	    puts ("OPT_Z is not third");
+	    ret = 1;
+	  }
+	if (len != 7)
+	  {
+	    printf ("OPT_Z's length %d != 7\n", len);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, 0, buf, 7);
+	if (offset != len || memcmp (buf, "abcdefg", 7) != 0)
+	  {
+	    buf[7] = '\0';
+	    printf ("OPT_Z's buf \"%s\" != \"abcdefg\"\n", buf);
+	    ret = 1;
+	  }
+	break;
+      default:
+	printf ("Unknown option %d\n", type);
+	ret = 1;
+	break;
+      }
+  if (seq != 3)
+    {
+      puts ("Didn't see all of OPT_X, OPT_Y and OPT_Z");
+      ret = 1;
+    }
+  return ret;
+}
+
+int
+main (void)
+{
+  void *eb;
+  socklen_t el;
+  eb = encode_inet6_opt (&el);
+  if (eb == NULL)
+    return 1;
+  if (decode_inet6_opt (eb, el))
+    return 1;
+  return 0;
+}

Modified: fsf/trunk/libc/login/utmp_file.c
==============================================================================
--- fsf/trunk/libc/login/utmp_file.c (original)
+++ fsf/trunk/libc/login/utmp_file.c Fri Mar 16 00:01:30 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2002, 2003, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>
    and Paul Janzen <pcj@xxxxxxxxxxxx>, 1996.
@@ -140,11 +140,11 @@
 
       file_name = TRANSFORM_UTMP_FILE_NAME (__libc_utmp_file_name);
 
-      file_fd = open_not_cancel_2 (file_name, O_RDWR);
+      file_fd = open_not_cancel_2 (file_name, O_RDWR | O_LARGEFILE);
       if (file_fd == -1)
 	{
 	  /* Hhm, read-write access did not work.  Try read-only.  */
-	  file_fd = open_not_cancel_2 (file_name, O_RDONLY);
+	  file_fd = open_not_cancel_2 (file_name, O_RDONLY | O_LARGEFILE);
 	  if (file_fd == -1)
 	    return 0;
 	}
@@ -459,7 +459,7 @@
   int fd;
 
   /* Open WTMP file.  */
-  fd = open_not_cancel_2 (file, O_WRONLY);
+  fd = open_not_cancel_2 (file, O_WRONLY | O_LARGEFILE);
   if (fd < 0)
     return -1;
 

Modified: fsf/trunk/libc/math/libm-test.inc
==============================================================================
--- fsf/trunk/libc/math/libm-test.inc (original)
+++ fsf/trunk/libc/math/libm-test.inc Fri Mar 16 00:01:30 2007
@@ -4127,7 +4127,9 @@
   TEST_f_f (log, 1, 0);
 
   TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (log, minus_infty, nan_value, INVALID_EXCEPTION);
   TEST_f_f (log, plus_infty, plus_infty);
+  TEST_f_f (log, nan_value, nan_value);
 
   TEST_f_f (log, M_El, 1);
   TEST_f_f (log, 1.0 / M_El, -1);
@@ -4157,6 +4159,7 @@
 
   /* log10 (x) == NaN plus invalid exception if x < 0.  */
   TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (log10, minus_infty, nan_value, INVALID_EXCEPTION);
 
   TEST_f_f (log10, plus_infty, plus_infty);
   TEST_f_f (log10, nan_value, nan_value);
@@ -4188,6 +4191,7 @@
 
   TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
   TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (log1p, minus_infty, nan_value, INVALID_EXCEPTION);
 
   TEST_f_f (log1p, plus_infty, plus_infty);
   TEST_f_f (log1p, nan_value, nan_value);
@@ -4218,6 +4222,7 @@
   TEST_f_f (log2, 1, 0);
 
   TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (log2, minus_infty, nan_value, INVALID_EXCEPTION);
 
   TEST_f_f (log2, plus_infty, plus_infty);
   TEST_f_f (log2, nan_value, nan_value);

Modified: fsf/trunk/libc/sysdeps/i386/fpu/e_log.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/e_log.S (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/e_log.S Fri Mar 16 00:01:30 2007
@@ -36,11 +36,15 @@
 ENTRY(__ieee754_log)
 	fldln2			// log(2)
 	fldl	4(%esp)		// x : log(2)
+	fxam
+	fnstsw
 #ifdef PIC
 	LOAD_PIC_REG (dx)
 #endif
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	sahf
+	jc	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -54,4 +58,9 @@
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	jp	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_log)

Modified: fsf/trunk/libc/sysdeps/i386/fpu/e_logf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/e_logf.S (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/e_logf.S Fri Mar 16 00:01:30 2007
@@ -37,11 +37,15 @@
 ENTRY(__ieee754_logf)
 	fldln2			// log(2)
 	flds	4(%esp)		// x : log(2)
+	fxam
+	fnstsw
 #ifdef PIC
 	LOAD_PIC_REG (dx)
 #endif
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	sahf
+	jc	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -55,4 +59,9 @@
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	jp	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_logf)

Modified: fsf/trunk/libc/sysdeps/i386/fpu/e_logl.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/e_logl.S (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/e_logl.S Fri Mar 16 00:01:30 2007
@@ -37,11 +37,15 @@
 ENTRY(__ieee754_logl)
 	fldln2			// log(2)
 	fldt	4(%esp)		// x : log(2)
+	fxam
+	fnstsw
 #ifdef PIC
 	LOAD_PIC_REG (dx)
 #endif
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	sahf
+	jc	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -55,4 +59,9 @@
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	jp	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_logl)

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/check_pf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/check_pf.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/check_pf.c Fri Mar 16 00:01:30 2007
@@ -1,5 +1,5 @@
 /* Determine protocol families for which interfaces exist.  Linux version.
-   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 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
@@ -71,17 +71,38 @@
   memset (&nladdr, '\0', sizeof (nladdr));
   nladdr.nl_family = AF_NETLINK;
 
+#ifdef PAGE_SIZE
+  /* Help the compiler optimize out the malloc call if PAGE_SIZE
+     is constant and smaller or equal to PTHREAD_STACK_MIN/4.  */
+  const size_t buf_size = PAGE_SIZE;
+#else
+  const size_t buf_size = __getpagesize ();
+#endif
+  bool use_malloc = false;
+  char *buf;
+
+  if (__libc_use_alloca (buf_size))
+    buf = alloca (buf_size);
+  else
+    {
+      buf = malloc (buf_size);
+      if (buf != NULL)
+	use_malloc = true;
+      else
+	goto out_fail;
+    }
+
+  struct iovec iov = { buf, buf_size };
+
   if (TEMP_FAILURE_RETRY (__sendto (fd, (void *) &req, sizeof (req), 0,
 				    (struct sockaddr *) &nladdr,
 				    sizeof (nladdr))) < 0)
-    return -1;
+    goto out_fail;
 
   *seen_ipv4 = false;
   *seen_ipv6 = false;
 
   bool done = false;
-  char buf[4096];
-  struct iovec iov = { buf, sizeof (buf) };
   struct in6ailist
   {
     struct in6addrinfo info;
@@ -101,10 +122,10 @@
 
       ssize_t read_len = TEMP_FAILURE_RETRY (__recvmsg (fd, &msg, 0));
       if (read_len < 0)
-	return -1;
+	goto out_fail;
 
       if (msg.msg_flags & MSG_TRUNC)
-	return -1;
+	goto out_fail;
 
       struct nlmsghdr *nlmh;
       for (nlmh = (struct nlmsghdr *) buf;
@@ -186,7 +207,7 @@
     {
       *in6ai = malloc (in6ailistlen * sizeof (**in6ai));
       if (*in6ai == NULL)
-	return -1;
+	goto out_fail;
 
       *in6ailen = in6ailistlen;
 
@@ -198,6 +219,13 @@
       while (in6ailist != NULL);
     }
 
+  if (use_malloc)
+    free (buf);
+  return 0;
+
+out_fail:
+  if (use_malloc)
+    free (buf);
   return 0;
 }
 

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/ifaddrs.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/ifaddrs.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/ifaddrs.c Fri Mar 16 00:01:30 2007
@@ -122,37 +122,36 @@
 __netlink_request (struct netlink_handle *h, int type)
 {
   struct netlink_res *nlm_next;
-  struct netlink_res **new_nlm_list;
-  static volatile size_t buf_size = 4096;
-  char *buf;
   struct sockaddr_nl nladdr;
   struct nlmsghdr *nlmh;
   ssize_t read_len;
   bool done = false;
+
+#ifdef PAGE_SIZE
+  /* Help the compiler optimize out the malloc call if PAGE_SIZE
+     is constant and smaller or equal to PTHREAD_STACK_MIN/4.  */
+  const size_t buf_size = PAGE_SIZE;
+#else
+  const size_t buf_size = __getpagesize ();
+#endif
   bool use_malloc = false;
-
-  if (__netlink_sendreq (h, type) < 0)
-    return -1;
-
-  size_t this_buf_size = buf_size;
-  size_t orig_this_buf_size = this_buf_size;
-  if (__libc_use_alloca (this_buf_size))
-    buf = alloca (this_buf_size);
+  char *buf;
+
+  if (__libc_use_alloca (buf_size))
+    buf = alloca (buf_size);
   else
     {
-      buf = malloc (this_buf_size);
+      buf = malloc (buf_size);
       if (buf != NULL)
 	use_malloc = true;
       else
 	goto out_fail;
     }
 
-  struct iovec iov = { buf, this_buf_size };
-
-  if (h->nlm_list != NULL)
-    new_nlm_list = &h->end_ptr->next;
-  else
-    new_nlm_list = &h->nlm_list;
+  struct iovec iov = { buf, buf_size };
+
+  if (__netlink_sendreq (h, type) < 0)
+    goto out_fail;
 
   while (! done)
     {
@@ -172,48 +171,7 @@
 	continue;
 
       if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0))
-	{
-	  if (this_buf_size >= SIZE_MAX / 2)
-	    goto out_fail;
-
-	  nlm_next = *new_nlm_list;
-	  while (nlm_next != NULL)
-	    {
-	      struct netlink_res *tmpptr;
-
-	      tmpptr = nlm_next->next;
-	      free (nlm_next);
-	      nlm_next = tmpptr;
-	    }
-	  *new_nlm_list = NULL;
-
-	  if (__libc_use_alloca (2 * this_buf_size))
-	    buf = extend_alloca (buf, this_buf_size, 2 * this_buf_size);
-	  else
-	    {
-	      this_buf_size *= 2;
-
-	      char *new_buf = realloc (use_malloc ? buf : NULL, this_buf_size);
-	      if (new_buf == NULL)
-		goto out_fail;
-	      buf = new_buf;
-
-	      use_malloc = true;
-	    }
-	  buf_size = this_buf_size;
-
-	  iov.iov_base = buf;
-	  iov.iov_len = this_buf_size;
-
-	  /* Increase sequence number, so that we can distinguish
-	     between old and new request messages.  */
-	  h->seq++;
-
-	  if (__netlink_sendreq (h, type) < 0)
-	    goto out_fail;
-
-	  continue;
-	}
+	goto out_fail;
 
       size_t count = 0;
       size_t remaining_len = read_len;
@@ -237,36 +195,6 @@
 	      struct nlmsgerr *nlerr = (struct nlmsgerr *) NLMSG_DATA (nlmh);
 	      if (nlmh->nlmsg_len < NLMSG_LENGTH (sizeof (struct nlmsgerr)))
 		errno = EIO;
-	      else if (nlerr->error == -EBUSY
-		       && orig_this_buf_size != this_buf_size)
-		{
-		  /* If EBUSY and MSG_TRUNC was seen, try again with a new
-		     netlink socket.  */
-		  struct netlink_handle hold = *h;
-		  if (__netlink_open (h) < 0)
-		    {
-		      *h = hold;
-		      goto out_fail;
-		    }
-		  __netlink_close (&hold);
-		  orig_this_buf_size = this_buf_size;
-		  nlm_next = *new_nlm_list;
-		  while (nlm_next != NULL)
-		    {
-		      struct netlink_res *tmpptr;
-
-		      tmpptr = nlm_next->next;
-		      free (nlm_next);
-		      nlm_next = tmpptr;
-		    }
-		  *new_nlm_list = NULL;
-		  count = 0;
-		  h->seq++;
-
-		  if (__netlink_sendreq (h, type) < 0)
-		    goto out_fail;
-		  break;
-		}
 	      else
 		errno = -nlerr->error;
 	      goto out_fail;

Modified: fsf/trunk/libc/sysdeps/x86_64/fpu/e_log10l.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/fpu/e_log10l.S (original)
+++ fsf/trunk/libc/sysdeps/x86_64/fpu/e_log10l.S Fri Mar 16 00:01:30 2007
@@ -42,7 +42,7 @@
 	fxam
 	fnstsw
 	fld	%st		// x : x : log10(2)
-	andb	$1,%ah
+	testb	$1, %ah
 	jnz	3f		// in case x is NaN or ±Inf
 4:	fsubl	MO(one)		// x-1 : x : log10(2)
 	fld	%st		// x-1 : x-1 : x : log10(2)
@@ -59,7 +59,8 @@
 	fyl2x			// log10(x)
 	ret
 
-3:	jp	4b		// in case x is ±Inf
+3:	testb	$4, %ah
+	jnz	4b		// in case x is ±Inf
 	fstp	%st(1)
 	fstp	%st(1)
 	ret

Modified: fsf/trunk/libc/sysdeps/x86_64/fpu/e_log2l.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/fpu/e_log2l.S (original)
+++ fsf/trunk/libc/sysdeps/x86_64/fpu/e_log2l.S Fri Mar 16 00:01:30 2007
@@ -39,7 +39,7 @@
 	fxam
 	fnstsw
 	fld	%st		// x : x : 1
-	andb	$1,%ah
+	testb	$1, %ah
 	jnz	3f		// in case x is NaN or ±Inf
 4:	fsub	%st(2), %st	// x-1 : x : 1
 	fld	%st		// x-1 : x-1 : x : 1
@@ -56,7 +56,8 @@
 	fyl2x			// log(x)
 	ret
 
-3:	jp	4b		// in case x is ±Inf
+3:	testb	$4, %ah
+	jnz	4b		// in case x is ±Inf
 	fstp	%st(1)
 	fstp	%st(1)
 	ret

Modified: fsf/trunk/libc/sysdeps/x86_64/fpu/e_logl.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/fpu/e_logl.S (original)
+++ fsf/trunk/libc/sysdeps/x86_64/fpu/e_logl.S Fri Mar 16 00:01:30 2007
@@ -38,8 +38,12 @@
 ENTRY(__ieee754_logl)
 	fldln2			// log(2)
 	fldt	8(%rsp)		// x : log(2)
+	fxam
+	fnstsw
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	testb	$1, %ah
+	jnz	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -53,4 +57,10 @@
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	testb	$4, %ah
+	jnz	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_logl)

Modified: fsf/trunk/libc/sysdeps/x86_64/fpu/s_log1pl.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/fpu/s_log1pl.S (original)
+++ fsf/trunk/libc/sysdeps/x86_64/fpu/s_log1pl.S Fri Mar 16 00:01:30 2007
@@ -45,7 +45,7 @@
 	fxam
 	fnstsw
 	fld	%st
-	andb	$1,%ah
+	testb	$1, %ah
 	jnz	3f		// in case x is NaN or ±Inf
 4:
 	fabs
@@ -62,7 +62,8 @@
 2:	fyl2xp1
 	ret
 
-3:	jp	4b		// in case x is ±Inf
+3:	testb	$4, %ah
+	jnz	4b		// in case x is ±Inf
 	fstp	%st(1)
 	fstp	%st(1)
 	ret