summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2009-09-03 09:58:30 +0200
committerAndreas Schwab <schwab@redhat.com>2009-09-03 09:58:30 +0200
commit3f3be09ae7ae17e7dbbaf9777161cf98d283cb73 (patch)
tree9bcc52e4ca8c32cb4dc10a2272fdb67f79c76be3
parent00cf698f76b531ceeca6ad151d5b59674dd5bb80 (diff)
parent01034d7590f0db29a689d0037cf9b837e38e7482 (diff)
downloadglibc-3f3be09ae7ae17e7dbbaf9777161cf98d283cb73.tar.gz
glibc-3f3be09ae7ae17e7dbbaf9777161cf98d283cb73.tar.xz
glibc-3f3be09ae7ae17e7dbbaf9777161cf98d283cb73.zip
Merge commit 'origin/master' into fedora/master
-rw-r--r--ChangeLog23
-rw-r--r--hesiod/nss_hesiod/hesiod-grp.c8
-rw-r--r--libio/Makefile2
-rw-r--r--libio/bug-wsetpos.c75
-rw-r--r--libio/wfileops.c49
-rw-r--r--nptl/ChangeLog8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/timer_create.c3
-rw-r--r--sysdeps/x86_64/multiarch/s_fma.c4
-rw-r--r--sysdeps/x86_64/multiarch/s_fmaf.c4
-rw-r--r--sysdeps/x86_64/multiarch/strcasestr-c.c3
-rw-r--r--sysdeps/x86_64/multiarch/strstr-c.c3
11 files changed, 134 insertions, 48 deletions
diff --git a/ChangeLog b/ChangeLog
index cdedb9c6b0..d7eb6eb6ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2009-09-01  Andreas Schwab  <schwab@redhat.com>
+
+	* hesiod/nss_hesiod/hesiod-grp.c (internal_gid_from_group): Fix
+	parsing of group entry.
+
+2009-09-02  Andreas Schwab  <schwab@redhat.com>
+
+	* libio/wfileops.c (_IO_wfile_seekoff): Account for readahead in
+	external buffer.  Always discard readahead in internal buffer.
+	* libio/Makefile (tests): Add bug-wsetpos.
+	* libio/bug-wsetpos.c: New file.
+
+2009-09-02  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/x86_64/multiarch/strstr-c.c (__strstr_sse42, __strstr_sse2):
+	Add attribute_hidden.
+	* sysdeps/x86_64/multiarch/strcasestr-c.c (__strcasestr_sse42,
+	__strcasestr_sse2): Likewise.
+	* sysdeps/x86_64/multiarch/s_fma.c (__fma_sse2): Add attribute_hidden.
+	(__fma_fma): Make static.
+	* sysdeps/x86_64/multiarch/s_fmaf.c (__fmaf_sse2): Add attribute_hidden.
+	(__fmaf_fma): Make static.
+
 2009-08-31  Andreas Schwab  <schwab@redhat.com>
 
 	* libio/wfileops.c (_IO_wfile_seekoff): Remove dead code and
diff --git a/hesiod/nss_hesiod/hesiod-grp.c b/hesiod/nss_hesiod/hesiod-grp.c
index 50c53f7893..f0c8c31e06 100644
--- a/hesiod/nss_hesiod/hesiod-grp.c
+++ b/hesiod/nss_hesiod/hesiod-grp.c
@@ -139,21 +139,19 @@ internal_gid_from_group (void *context, const char *groupname, gid_t *group)
     {
       char *p = *grp_res;
 
+      /* Skip to third field.  */
       while (*p != '\0' && *p != ':')
 	++p;
-      while (*p != '\0' && *p == ':')
+      if (*p != '\0')
 	++p;
       while (*p != '\0' && *p != ':')
 	++p;
-      while (*p != '\0' && *p == ':')
-	++p;
-      if (*p == ':')
+      if (*p != '\0')
 	{
 	  char *endp;
 	  char *q = ++p;
 	  long int val;
 
-	  q = p;
 	  while (*q != '\0' && *q != ':')
 	    ++q;
 
diff --git a/libio/Makefile b/libio/Makefile
index 501e80c2ee..83b9458dc2 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -58,7 +58,7 @@ tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc   \
 	tst-memstream1 tst-memstream2 \
 	tst-wmemstream1 tst-wmemstream2 \
 	bug-memstream1 bug-wmemstream1 \
-	tst-setvbuf1 tst-popen1 tst-fgetwc
+	tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos
 test-srcs = test-freopen
 
 all: # Make this the default target; it will be defined in Rules.
diff --git a/libio/bug-wsetpos.c b/libio/bug-wsetpos.c
new file mode 100644
index 0000000000..ccb22a4b62
--- /dev/null
+++ b/libio/bug-wsetpos.c
@@ -0,0 +1,75 @@
+/* Test program for fsetpos on a wide character stream.  */
+
+#include <assert.h>
+#include <stdio.h>
+#include <wchar.h>
+
+static void do_prepare (void);
+#define PREPARE(argc, argv) do_prepare ()
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+#include <test-skeleton.c>
+
+static const char pattern[] = "12345";
+static char *temp_file;
+
+static void
+do_prepare (void)
+{
+  int fd = create_temp_file ("bug-wsetpos.", &temp_file);
+  if (fd == -1)
+    {
+      printf ("cannot create temporary file: %m\n");
+      exit (1);
+    }
+  write (fd, pattern, sizeof (pattern));
+  close (fd);
+}
+
+static int
+do_test (void)
+{
+  FILE *fp = fopen (temp_file, "r");
+  fpos_t pos;
+  wchar_t c;
+
+  if (fp == NULL)
+    {
+      printf ("fdopen: %m\n");
+      return 1;
+    }
+
+  c = fgetwc (fp); assert (c == L'1');
+  c = fgetwc (fp); assert (c == L'2');
+
+  if (fgetpos (fp, &pos) == EOF)
+    {
+      printf ("fgetpos: %m\n");
+      return 1;
+    }
+
+  rewind (fp);
+  if (ferror (fp))
+    {
+      printf ("rewind: %m\n");
+      return 1;
+    }
+
+  c = fgetwc (fp); assert (c == L'1');
+
+  if (fsetpos (fp, &pos) == EOF)
+    {
+      printf ("fsetpos: %m\n");
+      return 1;
+    }
+
+  c = fgetwc (fp);
+  if (c != L'3')
+    {
+      puts ("fsetpos failed");
+      return 1;
+    }
+
+  puts ("Test succeeded.");
+  return 0;
+}
diff --git a/libio/wfileops.c b/libio/wfileops.c
index be8ae78bfb..5bc08bedfb 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -631,8 +631,12 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
       clen = (*cv->__codecvt_do_encoding) (cv);
 
       if (clen > 0)
-	offset -= (fp->_wide_data->_IO_read_end
-		   - fp->_wide_data->_IO_read_ptr) * clen;
+	{
+	  offset -= (fp->_wide_data->_IO_read_end
+		     - fp->_wide_data->_IO_read_ptr) * clen;
+	  /* Adjust by readahead in external buffer.  */
+	  offset -= fp->_IO_read_end - fp->_IO_read_ptr;
+	}
       else
 	{
 	  int nread;
@@ -690,39 +694,11 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
 		    fp->_IO_buf_base + (offset - start_offset),
 		    fp->_IO_read_end);
 	  _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
-
-	  /* Now set the pointer for the internal buffer.  This
-	     might be an iterative process.  Though the read
-	     pointer is somewhere in the current external buffer
-	     this does not mean we can convert this whole buffer
-	     at once fitting in the internal buffer.  */
-	  fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
-	  read_ptr_copy = fp->_IO_read_base;
-	  fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_base;
-	  do
-	    {
-	      wchar_t buffer[1024];
-	      wchar_t *ignore;
-	      status = (*cd->__codecvt_do_in) (cd,
-					       &fp->_wide_data->_IO_state,
-					       read_ptr_copy,
-					       fp->_IO_read_ptr,
-					       &read_ptr_copy,
-					       buffer,
-					       buffer
-					       + (sizeof (buffer)
-						  / sizeof (buffer[0])),
-					       &ignore);
-	      if (status != __codecvt_ok && status != __codecvt_partial)
-		{
-		  fp->_flags |= _IO_ERR_SEEN;
-		  goto dumb;
-		}
-	    }
-	  while (read_ptr_copy != fp->_IO_read_ptr);
-
-	  fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_base;
-
+	  _IO_wsetg (fp, fp->_wide_data->_IO_buf_base,
+		     fp->_wide_data->_IO_buf_base,
+		     fp->_wide_data->_IO_buf_base);
+	  _IO_wsetp (fp, fp->_wide_data->_IO_buf_base,
+		     fp->_wide_data->_IO_buf_base);
 	  _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
 	  goto resync;
 	}
@@ -760,6 +736,9 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
   _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta,
 	    fp->_IO_buf_base + count);
   _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+  _IO_wsetg (fp, fp->_wide_data->_IO_buf_base,
+	     fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base);
+  _IO_wsetp (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base);
   fp->_offset = result + count;
   _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
   return offset;
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 42f1b67992..b537413ce6 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,11 @@
+2009-09-02  Suzuki K P  <suzuki@in.ibm.com>
+	    Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #7094]
+	* sysdeps/unix/sysv/linux/timer_create.c (timer_create):
+	Initialize the sigev_notify field for newly created timer to make sure
+	the timer gets deleted from the active timer's list upon timer_delete.
+
 2009-08-27  Andrew Stubbs  <ams@codesourcery.com>
 
 	* sysdeps/unix/sysv/linux/sh/lowlevellock.S (__lll_timedlock_wait):
diff --git a/nptl/sysdeps/unix/sysv/linux/timer_create.c b/nptl/sysdeps/unix/sysv/linux/timer_create.c
index a07234d7d1..cdf127cb44 100644
--- a/nptl/sysdeps/unix/sysv/linux/timer_create.c
+++ b/nptl/sysdeps/unix/sysv/linux/timer_create.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003,2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003,2004, 2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -167,6 +167,7 @@ timer_create (clock_id, evp, timerid)
 	      /* Copy the thread parameters the user provided.  */
 	      newp->sival = evp->sigev_value;
 	      newp->thrfunc = evp->sigev_notify_function;
+	      newp->sigev_notify = SIGEV_THREAD;
 
 	      /* We cannot simply copy the thread attributes since the
 		 implementation might keep internal information for
diff --git a/sysdeps/x86_64/multiarch/s_fma.c b/sysdeps/x86_64/multiarch/s_fma.c
index 40601e9a68..cfecf9b41d 100644
--- a/sysdeps/x86_64/multiarch/s_fma.c
+++ b/sysdeps/x86_64/multiarch/s_fma.c
@@ -24,10 +24,10 @@
 
 #ifdef HAVE_AVX_SUPPORT
 
-extern double __fma_sse2 (double x, double y, double z);
+extern double __fma_sse2 (double x, double y, double z) attribute_hidden;
 
 
-double
+static double
 __fma_fma (double x, double y, double z)
 {
   asm ("vfmadd213sd %3, %2, %0" : "=x" (x) : "0" (x), "x" (y), "xm" (z));
diff --git a/sysdeps/x86_64/multiarch/s_fmaf.c b/sysdeps/x86_64/multiarch/s_fmaf.c
index f3d37f8f4a..de1c4b6f41 100644
--- a/sysdeps/x86_64/multiarch/s_fmaf.c
+++ b/sysdeps/x86_64/multiarch/s_fmaf.c
@@ -23,10 +23,10 @@
 
 #ifdef HAVE_AVX_SUPPORT
 
-extern float __fmaf_sse2 (float x, float y, float z);
+extern float __fmaf_sse2 (float x, float y, float z) attribute_hidden;
 
 
-float
+static float
 __fmaf_fma (float x, float y, float z)
 {
   asm ("vfmadd213ss %3, %2, %0" : "=x" (x) : "0" (x), "x" (y), "xm" (z));
diff --git a/sysdeps/x86_64/multiarch/strcasestr-c.c b/sysdeps/x86_64/multiarch/strcasestr-c.c
index e6879531bc..3cb5557b67 100644
--- a/sysdeps/x86_64/multiarch/strcasestr-c.c
+++ b/sysdeps/x86_64/multiarch/strcasestr-c.c
@@ -7,7 +7,8 @@
 
 #include "string/strcasestr.c"
 
-extern char *__strcasestr_sse42 (const char *, const char *);
+extern char *__strcasestr_sse42 (const char *, const char *) attribute_hidden;
+extern __typeof (__strcasestr_sse2) __strcasestr_sse2 attribute_hidden;
 
 #if 1
 libc_ifunc (__strcasestr,
diff --git a/sysdeps/x86_64/multiarch/strstr-c.c b/sysdeps/x86_64/multiarch/strstr-c.c
index cff99b71ef..d593089a87 100644
--- a/sysdeps/x86_64/multiarch/strstr-c.c
+++ b/sysdeps/x86_64/multiarch/strstr-c.c
@@ -7,6 +7,7 @@
 
 #include "string/strstr.c"
 
-extern char *__strstr_sse42 (const char *, const char *);
+extern char *__strstr_sse42 (const char *, const char *) attribute_hidden;
+extern __typeof (__strstr_sse2) __strstr_sse2 attribute_hidden;
 
 libc_ifunc (strstr, HAS_SSE4_2 ? __strstr_sse42 : __strstr_sse2);