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

[commits] r8317 - in /fsf/trunk/libc: ./ locale/programs/ localedata/ malloc/ stdlib/



Author: eglibc
Date: Sun Apr 19 00:05:27 2009
New Revision: 8317

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

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/locale/programs/locarchive.c
    fsf/trunk/libc/localedata/ChangeLog
    fsf/trunk/libc/localedata/SUPPORTED
    fsf/trunk/libc/malloc/malloc.c
    fsf/trunk/libc/stdlib/strfmon_l.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sun Apr 19 00:05:27 2009
@@ -1,3 +1,15 @@
+2009-04-18  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* stdlib/strfmon_l.c (__vstrfmon_l): Don't wrap when computing width.
+	Numerically stable check for valid width.
+
+	* locale/programs/locarchive.c (open_archive): Map the entire file
+	and not just the administrative data.
+	(add_locale): When we find a hash sum match compare the content
+	to be sure.
+
+	* malloc/malloc.c (malloc_info): Output address space information.
+
 2009-04-17  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* malloc/malloc.c (malloc_info): Also output system memory information.

Modified: fsf/trunk/libc/locale/programs/locarchive.c
==============================================================================
--- fsf/trunk/libc/locale/programs/locarchive.c (original)
+++ fsf/trunk/libc/locale/programs/locarchive.c Sun Apr 19 00:05:27 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -380,7 +380,7 @@
 	    = ((char *) ah->addr
 	       + oldnamehashtab[oldlocrecarray[cnt - 1].cnt].name_offset);
 
-	  add_alias (&new_ah, 
+	  add_alias (&new_ah,
 		     ((char *) ah->addr
 		      + oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset),
 		     0, oldname, &last_locrec_offset);
@@ -517,9 +517,9 @@
   ah->len = (head.sumhash_offset
 	     + head.sumhash_size * sizeof (struct sumhashent));
 
-  /* Now we know how large the administrative information part is.
-     Map all of it.  */
-  ah->addr = mmap64 (NULL, ah->len, PROT_READ | (readonly ? 0 : PROT_WRITE),
+  /* Map the entire file.  We might need to compare the category data
+     in the file with the newly added data.  */
+  ah->addr = mmap64 (NULL, st.st_size, PROT_READ | (readonly ? 0 : PROT_WRITE),
 		     MAP_SHARED, fd, 0);
   if (ah->addr == MAP_FAILED)
     {
@@ -760,10 +760,32 @@
 	  {
 	    if (memcmp (data[cnt].sum, sumhashtab[idx].sum, 16) == 0)
 	      {
-		/* Found it.  */
-		file_offsets[cnt] = sumhashtab[idx].file_offset;
-		--num_new_offsets;
-		break;
+		/* Check the content, there could be a collision of
+		   the hash sum.
+
+		   Unfortunately the sumhashent record does not include
+		   the size of the stored data.  So we have to search for
+		   it.  */
+		locrecent = (struct locrecent *) ((char *) ah->addr
+						  + head->locrectab_offset);
+		size_t iloc;
+		for (iloc = 0; iloc < head->locrectab_used; ++iloc)
+		  if (locrecent[iloc].refs != 0
+		      && (locrecent[iloc].record[cnt].offset
+			  == sumhashtab[idx].file_offset))
+		    break;
+
+		if (iloc != head->locrectab_used
+		    && data[cnt].size == locrecent[iloc].record[cnt].len
+		    && memcmp (data[cnt].addr,
+			       (char *) ah->addr + sumhashtab[idx].file_offset,
+			       data[cnt].size) == 0)
+		  {
+		    /* Found it.  */
+		    file_offsets[cnt] = sumhashtab[idx].file_offset;
+		    --num_new_offsets;
+		    break;
+		  }
 	      }
 
 	    idx += incr;

Modified: fsf/trunk/libc/localedata/ChangeLog
==============================================================================
--- fsf/trunk/libc/localedata/ChangeLog (original)
+++ fsf/trunk/libc/localedata/ChangeLog Sun Apr 19 00:05:27 2009
@@ -1,3 +1,7 @@
+2009-04-18  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* SUPPORTED: Add ks_IN.
+
 2009-04-07  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* locales/ks_IN@devanagari: Replace duplicated information with copy.

Modified: fsf/trunk/libc/localedata/SUPPORTED
==============================================================================
--- fsf/trunk/libc/localedata/SUPPORTED (original)
+++ fsf/trunk/libc/localedata/SUPPORTED Sun Apr 19 00:05:27 2009
@@ -258,6 +258,7 @@
 kn_IN/UTF-8 \
 ko_KR.EUC-KR/EUC-KR \
 ko_KR.UTF-8/UTF-8 \
+ks_IN/UTF-8 \
 ks_IN@devanagari/UTF-8 \
 ku_TR.UTF-8/UTF-8 \
 ku_TR/ISO-8859-9 \

Modified: fsf/trunk/libc/malloc/malloc.c
==============================================================================
--- fsf/trunk/libc/malloc/malloc.c (original)
+++ fsf/trunk/libc/malloc/malloc.c Sun Apr 19 00:05:27 2009
@@ -6251,6 +6251,8 @@
   size_t total_fastavail = 0;
   size_t total_system = 0;
   size_t total_max_system = 0;
+  size_t total_aspace = 0;
+  size_t total_aspace_mprotect = 0;
 
   void mi_arena (mstate ar_ptr)
   {
@@ -6363,10 +6365,31 @@
 	     "</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
 	     "<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
 	     "<system type=\"current\" size=\"%zu\"/>\n"
-	     "<system type=\"max\" size=\"%zu\"/>\n"
-	     "</heap>\n",
+	     "<system type=\"max\" size=\"%zu\"/>\n",
 	     nfastblocks, fastavail, nblocks, avail,
 	     ar_ptr->system_mem, ar_ptr->max_system_mem);
+
+    if (ar_ptr != &main_arena)
+      {
+	heap_info *heap = heap_for_ptr(top(ar_ptr));
+	fprintf (fp,
+		 "<aspace type=\"total\" size=\"%zu\"/>\n"
+		 "<aspace type=\"mprotect\" size=\"%zu\"/>\n",
+		 heap->size, heap->mprotect_size);
+	total_aspace += heap->size;
+	total_aspace_mprotect += heap->mprotect_size;
+      }
+    else
+      {
+	fprintf (fp,
+		 "<aspace type=\"total\" size=\"%zu\"/>\n"
+		 "<aspace type=\"mprotect\" size=\"%zu\"/>\n",
+		 ar_ptr->system_mem, ar_ptr->system_mem);
+	total_aspace += ar_ptr->system_mem;
+	total_aspace_mprotect += ar_ptr->system_mem;
+      }
+
+    fputs ("</heap>\n", fp);
   }
 
   fputs ("<malloc version=\"1\">\n", fp);
@@ -6385,9 +6408,12 @@
 	   "<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
 	   "<system type=\"current\" size=\"%zu\n/>\n"
 	   "<system type=\"max\" size=\"%zu\n/>\n"
+	   "<aspace type=\"total\" size=\"%zu\"/>\n"
+	   "<aspace type=\"mprotect\" size=\"%zu\"/>\n"
 	   "</malloc>\n",
 	   total_nfastblocks, total_fastavail, total_nblocks, total_avail,
-	   total_system, total_max_system);
+	   total_system, total_max_system,
+	   total_aspace, total_aspace_mprotect);
 
   return 0;
 }

Modified: fsf/trunk/libc/stdlib/strfmon_l.c
==============================================================================
--- fsf/trunk/libc/stdlib/strfmon_l.c (original)
+++ fsf/trunk/libc/stdlib/strfmon_l.c Sun Apr 19 00:05:27 2009
@@ -1,5 +1,5 @@
 /* Formatting a monetary value according to the given locale.
-   Copyright (C) 1996, 1997, 2002, 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,2002,2004,2006,2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -133,7 +133,7 @@
       int done;
       const char *currency_symbol;
       size_t currency_symbol_len;
-      int width;
+      long int width;
       char *startp;
       const void *ptr;
       char space_char;
@@ -221,13 +221,21 @@
 
 	  while (isdigit (*++fmt))
 	    {
-	      width *= 10;
-	      width += to_digit (*fmt);
+	      int val = to_digit (*fmt);
+
+	      if (width > LONG_MAX / 10
+		  || (width == LONG_MAX && val > LONG_MAX % 10))
+		{
+		  __set_errno (E2BIG);
+		  return -1;
+		}
+
+	      width = width * 10 + val;
 	    }
 
 	  /* If we don't have enough room for the demanded width we
 	     can stop now and return an error.  */
-	  if (dest + width >= s + maxsize)
+	  if (width >= maxsize - (dest - s))
 	    {
 	      __set_errno (E2BIG);
 	      return -1;
@@ -560,7 +568,7 @@
 		out_char (space_char);
 	      out_nstring (currency_symbol, currency_symbol_len);
 	    }
-	    
+
 	  if (sign_posn == 4)
 	    {
 	      if (sep_by_space == 2)
@@ -589,9 +597,8 @@
 	    while (dest - startp < width);
 	  else
 	    {
-	      int dist = width - (dest - startp);
-	      char *cp;
-	      for (cp = dest - 1; cp >= startp; --cp)
+	      long int dist = width - (dest - startp);
+	      for (char *cp = dest - 1; cp >= startp; --cp)
 		cp[dist] = cp[0];
 
 	      dest += dist;