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

[Commits] r22864 - in /fsf/trunk/libc: ./ benchtests/ libio/ nscd/ stdio-common/



Author: eglibc
Date: Tue Apr 16 00:01:44 2013
New Revision: 22864

Log:
Import glibc-mainline for 2013-04-16

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/benchtests/Makefile
    fsf/trunk/libc/libio/tst-fwrite-error.c
    fsf/trunk/libc/nscd/grpcache.c
    fsf/trunk/libc/nscd/initgrcache.c
    fsf/trunk/libc/nscd/nscd.c
    fsf/trunk/libc/nscd/pwdcache.c
    fsf/trunk/libc/nscd/servicescache.c
    fsf/trunk/libc/stdio-common/tstdiomisc.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Apr 16 00:01:44 2013
@@ -1,3 +1,32 @@
+2013-04-15  Thomas Schwinge  <thomas@xxxxxxxxxxxxxxxx>
+
+	* stdio-common/tstdiomisc.c: Fix coding-style violation.
+
+2013-04-15  Andreas Schwab  <schwab@xxxxxxx>
+
+	* nscd/grpcache.c (cache_addgr): Properly check for short write.
+	* nscd/initgrcache.c (addinitgroupsX): Likewise.
+	* nscd/pwdcache.c (cache_addpw): Likewise.
+	* nscd/servicescache.c (cache_addserv): Likewise.  Don't write
+	more than recsize.
+
+2013-04-15  Siddhesh Poyarekar  <siddhesh@xxxxxxxxxx>
+
+	* benchtests/Makefile (bench): Write all output to
+	bench-out.tmp together.
+
+2013-04-15  Andreas Schwab  <schwab@xxxxxxx>
+
+	* nscd/nscd.c (main): Don't fork again after closing files.
+
+2013-04-15  Siddhesh Poyarekar  <siddhesh@xxxxxxxxxx>
+
+	* libio/tst-fwrite-error.c (do_test): Fix BUF array definition.
+
+	* benchtests/Rules (bench-deps): Collect dependencies into a
+	single variable.  Add Makefile to dependencies.
+	($(objpfx)bench-%.c): Depend on bench-deps.
+
 2013-04-12  Roland McGrath  <roland@xxxxxxxxxxxxx>
 	    Xavier Roche  <roche+kml2@xxxxxxxxxxx>
 

Modified: fsf/trunk/libc/benchtests/Makefile
==============================================================================
--- fsf/trunk/libc/benchtests/Makefile (original)
+++ fsf/trunk/libc/benchtests/Makefile Tue Apr 16 00:01:44 2013
@@ -114,15 +114,17 @@
 
 binaries-bench := $(addprefix $(objpfx)bench-,$(bench))
 
+bench-deps := bench-skeleton.c Makefile
+
 run-bench = $(test-wrapper-env) \
 	    GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
 	    $($*-ENV) $(rtld-prefix) $${run}
 
 bench: $(binaries-bench)
-	for run in $^; do \
-	  echo "Running $${run}"; \
-	  $(run-bench) >>  $(objpfx)bench.out-tmp; \
-	done; \
+	{ for run in $^; do \
+	  echo "Running $${run}" >&2; \
+	  $(run-bench); \
+	done; } > $(objpfx)bench.out-tmp; \
 	if [ -f $(objpfx)bench.out ]; then \
 	  mv -f $(objpfx)bench.out $(objpfx)bench.out.old; \
 	fi; \
@@ -133,7 +135,7 @@
   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
 	$(+link)
 
-$(objpfx)bench-%.c: %-inputs bench-skeleton.c
+$(objpfx)bench-%.c: %-inputs $(bench-deps)
 	{ if [ -n "$($*-INCLUDE)" ]; then \
 	  cat $($*-INCLUDE); \
 	fi; \

Modified: fsf/trunk/libc/libio/tst-fwrite-error.c
==============================================================================
--- fsf/trunk/libc/libio/tst-fwrite-error.c (original)
+++ fsf/trunk/libc/libio/tst-fwrite-error.c Tue Apr 16 00:01:44 2013
@@ -36,7 +36,7 @@
       return 1;
     }
 
-  char buf[5] = "world";
+  char buf[] = "world";
   setvbuf (fp, NULL, _IONBF, 0);
   close (fd);
   unlink (tmpl);

Modified: fsf/trunk/libc/nscd/grpcache.c
==============================================================================
--- fsf/trunk/libc/nscd/grpcache.c (original)
+++ fsf/trunk/libc/nscd/grpcache.c Tue Apr 16 00:01:44 2013
@@ -75,8 +75,8 @@
 	     const void *key, struct group *grp, uid_t owner,
 	     struct hashentry *const he, struct datahead *dh, int errval)
 {
+  bool all_written = true;
   ssize_t total;
-  ssize_t written;
   time_t t = time (NULL);
 
   /* We allocate all data in one memory block: the iov vector,
@@ -105,7 +105,7 @@
 	  /* Reload with the same time-to-live value.  */
 	  timeout = dh->timeout = t + db->postimeout;
 
-	  written = total = 0;
+	  total = 0;
 	}
       else
 	{
@@ -113,11 +113,10 @@
 	     case.  */
 	  total = sizeof (notfound);
 
-	  if (fd != -1)
-	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
-						MSG_NOSIGNAL));
-	  else
-	    written = total;
+	  if (fd != -1
+	      && TEMP_FAILURE_RETRY (send (fd, &notfound, total,
+					   MSG_NOSIGNAL)) != total)
+	    all_written = false;
 
 	  /* If we have a transient error or cannot permanently store
 	     the result, so be it.  */
@@ -197,9 +196,9 @@
 	  gr_mem_len_total += gr_mem_len[gr_mem_cnt];
 	}
 
-      written = total = (offsetof (struct dataset, strdata)
-			 + gr_mem_cnt * sizeof (uint32_t)
-			 + gr_name_len + gr_passwd_len + gr_mem_len_total);
+      total = (offsetof (struct dataset, strdata)
+	       + gr_mem_cnt * sizeof (uint32_t)
+	       + gr_name_len + gr_passwd_len + gr_mem_len_total);
 
       /* If we refill the cache, first assume the reconrd did not
 	 change.  Allocate memory on the cache since it is likely
@@ -328,20 +327,27 @@
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
 			  + db->head->data_size));
-	      written = sendfileall (fd, db->wr_fd,
-				     (char *) &dataset->resp
-				     - (char *) db->head, dataset->head.recsize);
+	      ssize_t written = sendfileall (fd, db->wr_fd,
+					     (char *) &dataset->resp
+					     - (char *) db->head,
+					     dataset->head.recsize);
+	      if (written != dataset->head.recsize)
+		{
 # ifndef __ASSUME_SENDFILE
-	      if (written == -1 && errno == ENOSYS)
-		goto use_write;
+		  if (written == -1 && errno == ENOSYS)
+		    goto use_write;
 # endif
+		  all_written = false;
+		}
 	    }
 	  else
 # ifndef __ASSUME_SENDFILE
 	  use_write:
 # endif
 #endif
-	    written = writeall (fd, &dataset->resp, dataset->head.recsize);
+	    if (writeall (fd, &dataset->resp, dataset->head.recsize)
+		!= dataset->head.recsize)
+	      all_written = false;
 	}
 
       /* Add the record to the database.  But only if it has not been
@@ -401,7 +407,7 @@
 	}
     }
 
-  if (__builtin_expect (written != total, 0) && debug_level > 0)
+  if (__builtin_expect (!all_written, 0) && debug_level > 0)
     {
       char buf[256];
       dbg_log (_("short write in %s: %s"),  __FUNCTION__,

Modified: fsf/trunk/libc/nscd/initgrcache.c
==============================================================================
--- fsf/trunk/libc/nscd/initgrcache.c (original)
+++ fsf/trunk/libc/nscd/initgrcache.c Tue Apr 16 00:01:44 2013
@@ -171,15 +171,16 @@
 	nip = nip->next;
     }
 
+  bool all_written;
   ssize_t total;
-  ssize_t written;
   time_t timeout;
  out:
+  all_written = true;
   timeout = MAX_TIMEOUT_VALUE;
   if (!any_success)
     {
       /* Nothing found.  Create a negative result record.  */
-      written = total = sizeof (notfound);
+      total = sizeof (notfound);
 
       if (he != NULL && all_tryagain)
 	{
@@ -197,9 +198,10 @@
 	{
 	  /* We have no data.  This means we send the standard reply for this
 	     case.  */
-	  if (fd != -1)
-	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
-						MSG_NOSIGNAL));
+	  if (fd != -1
+	      && TEMP_FAILURE_RETRY (send (fd, &notfound, total,
+					   MSG_NOSIGNAL)) != total)
+	    all_written = false;
 
 	  /* If we have a transient error or cannot permanently store
 	     the result, so be it.  */
@@ -251,8 +253,7 @@
   else
     {
 
-      written = total = (offsetof (struct dataset, strdata)
-			 + start * sizeof (int32_t));
+      total = offsetof (struct dataset, strdata) + start * sizeof (int32_t);
 
       /* If we refill the cache, first assume the reconrd did not
 	 change.  Allocate memory on the cache since it is likely
@@ -365,20 +366,27 @@
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
 			  + db->head->data_size));
-	      written = sendfileall (fd, db->wr_fd,
-				     (char *) &dataset->resp
-				     - (char *) db->head, dataset->head.recsize);
+	      ssize_t written = sendfileall (fd, db->wr_fd,
+					     (char *) &dataset->resp
+					     - (char *) db->head,
+					     dataset->head.recsize);
+	      if (written != dataset->head.recsize)
+		{
 # ifndef __ASSUME_SENDFILE
-	      if (written == -1 && errno == ENOSYS)
-		goto use_write;
+		  if (written == -1 && errno == ENOSYS)
+		    goto use_write;
 # endif
+		  all_written = false;
+		}
 	    }
 	  else
 # ifndef __ASSUME_SENDFILE
 	  use_write:
 # endif
 #endif
-	    written = writeall (fd, &dataset->resp, dataset->head.recsize);
+	    if (writeall (fd, &dataset->resp, dataset->head.recsize)
+		!= dataset->head.recsize)
+	      all_written = false;
 	}
 
 
@@ -405,7 +413,7 @@
 
   free (groups);
 
-  if (__builtin_expect (written != total, 0) && debug_level > 0)
+  if (__builtin_expect (!all_written, 0) && debug_level > 0)
     {
       char buf[256];
       dbg_log (_("short write in %s: %s"), __FUNCTION__,

Modified: fsf/trunk/libc/nscd/nscd.c
==============================================================================
--- fsf/trunk/libc/nscd/nscd.c (original)
+++ fsf/trunk/libc/nscd/nscd.c Tue Apr 16 00:01:44 2013
@@ -252,15 +252,6 @@
 	for (i = min_close_fd; i < getdtablesize (); i++)
 	  close (i);
 
-      if (run_mode == RUN_DAEMONIZE)
-	{
-	  pid = fork ();
-	  if (pid == -1)
-	    error (EXIT_FAILURE, errno, _("cannot fork"));
-	  if (pid != 0)
-	    exit (0);
-	}
-
       setsid ();
 
       if (chdir ("/") != 0)

Modified: fsf/trunk/libc/nscd/pwdcache.c
==============================================================================
--- fsf/trunk/libc/nscd/pwdcache.c (original)
+++ fsf/trunk/libc/nscd/pwdcache.c Tue Apr 16 00:01:44 2013
@@ -81,8 +81,8 @@
 	     const void *key, struct passwd *pwd, uid_t owner,
 	     struct hashentry *const he, struct datahead *dh, int errval)
 {
+  bool all_written = true;
   ssize_t total;
-  ssize_t written;
   time_t t = time (NULL);
 
   /* We allocate all data in one memory block: the iov vector,
@@ -111,17 +111,18 @@
 	  /* Reload with the same time-to-live value.  */
 	  timeout = dh->timeout = t + db->postimeout;
 
-	  written = total = 0;
+	  total = 0;
 	}
       else
 	{
 	  /* We have no data.  This means we send the standard reply for this
 	     case.  */
-	  written = total = sizeof (notfound);
-
-	  if (fd != -1)
-	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
-						MSG_NOSIGNAL));
+	  total = sizeof (notfound);
+
+	  if (fd != -1
+	      && TEMP_FAILURE_RETRY (send (fd, &notfound, total,
+					   MSG_NOSIGNAL)) != total)
+	    all_written = false;
 
 	  /* If we have a transient error or cannot permanently store
 	     the result, so be it.  */
@@ -189,9 +190,9 @@
       n = snprintf (buf, buf_len, "%d%c%n%s", pwd->pw_uid, '\0',
 		    &key_offset, (char *) key) + 1;
 
-      written = total = (offsetof (struct dataset, strdata)
-			 + pw_name_len + pw_passwd_len
-			 + pw_gecos_len + pw_dir_len + pw_shell_len);
+      total = (offsetof (struct dataset, strdata)
+	       + pw_name_len + pw_passwd_len
+	       + pw_gecos_len + pw_dir_len + pw_shell_len);
 
       /* If we refill the cache, first assume the reconrd did not
 	 change.  Allocate memory on the cache since it is likely
@@ -304,20 +305,27 @@
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
 			  + db->head->data_size));
-	      written = sendfileall (fd, db->wr_fd,
-				     (char *) &dataset->resp
-				     - (char *) db->head, dataset->head.recsize );
+	      ssize_t written = sendfileall (fd, db->wr_fd,
+					     (char *) &dataset->resp
+					     - (char *) db->head,
+					     dataset->head.recsize);
+	      if (written != dataset->head.recsize)
+		{
 # ifndef __ASSUME_SENDFILE
-	      if (written == -1 && errno == ENOSYS)
-		goto use_write;
+		  if (written == -1 && errno == ENOSYS)
+		    goto use_write;
 # endif
+		  all_written = false;
+		}
 	    }
 	  else
 # ifndef __ASSUME_SENDFILE
 	  use_write:
 # endif
 #endif
-	    written = writeall (fd, &dataset->resp, dataset->head.recsize);
+	    if (writeall (fd, &dataset->resp, dataset->head.recsize)
+		!= dataset->head.recsize)
+	      all_written = false;
 	}
 
 
@@ -377,7 +385,7 @@
 	}
     }
 
-  if (__builtin_expect (written != total, 0) && debug_level > 0)
+  if (__builtin_expect (!all_written, 0) && debug_level > 0)
     {
       char buf[256];
       dbg_log (_("short write in %s: %s"),  __FUNCTION__,

Modified: fsf/trunk/libc/nscd/servicescache.c
==============================================================================
--- fsf/trunk/libc/nscd/servicescache.c (original)
+++ fsf/trunk/libc/nscd/servicescache.c Tue Apr 16 00:01:44 2013
@@ -65,8 +65,8 @@
 	       const void *key, struct servent *serv, uid_t owner,
 	       struct hashentry *const he, struct datahead *dh, int errval)
 {
+  bool all_written = true;
   ssize_t total;
-  ssize_t written;
   time_t t = time (NULL);
 
   /* We allocate all data in one memory block: the iov vector,
@@ -95,17 +95,18 @@
 	  /* Reload with the same time-to-live value.  */
 	  timeout = dh->timeout = t + db->postimeout;
 
-	  written = total = 0;
+	  total = 0;
 	}
       else
 	{
 	  /* We have no data.  This means we send the standard reply for this
 	     case.  */
-	  written = total = sizeof (notfound);
-
-	  if (fd != -1)
-	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
-						MSG_NOSIGNAL));
+	  total = sizeof (notfound);
+
+	  if (fd != -1
+	      && TEMP_FAILURE_RETRY (send (fd, &notfound, total,
+					   MSG_NOSIGNAL)) != total)
+	    all_written = false;
 
 	  /* If we have a transient error or cannot permanently store
 	     the result, so be it.  */
@@ -182,7 +183,6 @@
 		+ s_name_len
 		+ s_proto_len
 		+ s_aliases_cnt * sizeof (uint32_t));
-      written = total;
 
       /* If we refill the cache, first assume the reconrd did not
 	 change.  Allocate memory on the cache since it is likely
@@ -290,25 +290,32 @@
 	    {
 	      assert (db->wr_fd != -1);
 	      assert ((char *) &dataset->resp > (char *) db->data);
-	      assert ((char *) &dataset->resp - (char *) db->head
+	      assert ((char *) dataset - (char *) db->head
 		      + total
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
 			  + db->head->data_size));
-	      written = sendfileall (fd, db->wr_fd,
-				     (char *) &dataset->resp
-				     - (char *) db->head, total);
+	      ssize_t written = sendfileall (fd, db->wr_fd,
+					     (char *) &dataset->resp
+					     - (char *) db->head,
+					     dataset->head.recsize);
+	      if (written != dataset->head.recsize)
+		{
 # ifndef __ASSUME_SENDFILE
-	      if (written == -1 && errno == ENOSYS)
-		goto use_write;
+		  if (written == -1 && errno == ENOSYS)
+		    goto use_write;
 # endif
+		  all_written = false;
+		}
 	    }
 	  else
 # ifndef __ASSUME_SENDFILE
 	  use_write:
 # endif
 #endif
-	    written = writeall (fd, &dataset->resp, total);
+	    if (writeall (fd, &dataset->resp, dataset->head.recsize)
+		!= dataset->head.recsize)
+	      all_written = false;
 	}
 
       /* Add the record to the database.  But only if it has not been
@@ -332,7 +339,7 @@
 	}
     }
 
-  if (__builtin_expect (written != total, 0) && debug_level > 0)
+  if (__builtin_expect (!all_written, 0) && debug_level > 0)
     {
       char buf[256];
       dbg_log (_("short write in %s: %s"),  __FUNCTION__,

Modified: fsf/trunk/libc/stdio-common/tstdiomisc.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tstdiomisc.c (original)
+++ fsf/trunk/libc/stdio-common/tstdiomisc.c Tue Apr 16 00:01:44 2013
@@ -50,10 +50,10 @@
 volatile long double lqnanval;
 /* A sNaN is only guaranteed to be representable in variables with static (or
    thread-local) storage duration.  */
-static volatile double snanval = __builtin_nans("");
-static volatile double msnanval = -__builtin_nans("");
-static volatile long double lsnanval = __builtin_nansl("");
-static volatile long double lmsnanval = -__builtin_nansl("");
+static volatile double snanval = __builtin_nans ("");
+static volatile double msnanval = -__builtin_nans ("");
+static volatile long double lsnanval = __builtin_nansl ("");
+static volatile long double lmsnanval = -__builtin_nansl ("");
 volatile double infval;
 volatile long double linfval;
 

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits