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

[commits] r10216 - in /fsf/trunk/libc: ./ nptl/ nptl/sysdeps/pthread/ nptl/sysdeps/unix/sysv/linux/ nscd/ posix/ resolv/nss_dns/



Author: eglibc
Date: Sat Apr 10 00:03:22 2010
New Revision: 10216

Log:
Import glibc-mainline for 2010-04-10

Added:
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/pthread_getname.c
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/pthread_setname.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/Makeconfig
    fsf/trunk/libc/Makefile
    fsf/trunk/libc/Makerules
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/Makefile
    fsf/trunk/libc/nptl/Versions
    fsf/trunk/libc/nptl/sysdeps/pthread/pthread.h
    fsf/trunk/libc/nscd/aicache.c
    fsf/trunk/libc/posix/Makefile
    fsf/trunk/libc/resolv/nss_dns/dns-host.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Apr 10 00:03:22 2010
@@ -1,3 +1,20 @@
+2010-04-09  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/aicache.c (addhstaiX): Correct passing memory to address
+	list to gethostbyname4_r functions.
+
+	* resolv/nss_dns/dns-host.c (gaih_getanswer_slice): Optimize
+	copying of h_name.
+
+2010-04-09  Roland McGrath  <roland@xxxxxxxxxx>
+
+	* Makerules ($(common-objpfx)libc-abis.h): Depend on libc-abis.stamp.
+	($(common-objpfx)libc-abis.stamp): New target, rule moved from
+	libc-abis.h target.  Use a stamp file to avoid repeating no-op
+	move-if-change on every run.
+
+	* posix/Makefile (tst-chmod-ARGS): Pass $(objdir), not `pwd`.
+
 2010-04-08  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	[BZ #10915]
@@ -11,14 +28,6 @@
 
 	* malloc/malloc.c (_int_malloc): Return NULL if printing error message
 	returns.
-
-2010-03-30  Daniel Jacobowitz  <dan@xxxxxxxxxxxxxxxx>
-
-	* Makeconfig (+common-includes): Define.
-	(+includes): Use @$(common-objpfx)includes.
-	* Makefile (postclean): Remove includes and includes.mk.
-	* Makerules ($(common-objpfx)includes.mk): Include and create
-	includes.mk.  Create includes.
 
 2010-04-07  Andreas Schwab  <schwab@xxxxxxxxxx>
 
@@ -268,6 +277,7 @@
 
 2010-03-25  Andreas Schwab  <schwab@xxxxxxxxxx>
 
+	[BZ #11001]
 	* sysdeps/posix/getaddrinfo.c (gaih_inet): Reset no_data before
 	each action.
 

Modified: fsf/trunk/libc/Makeconfig
==============================================================================
--- fsf/trunk/libc/Makeconfig (original)
+++ fsf/trunk/libc/Makeconfig Sat Apr 10 00:03:22 2010
@@ -670,10 +670,9 @@
 # library source directory, in the include directory, and in the
 # current directory.
 +sysdep-includes = $(addprefix -I,$(+sysdep_dirs))
-+common-includes = $(+sysdep-includes) $(includes) $(sysincludes)
 +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
-	    @$(common-objpfx)includes \
-	    $(patsubst %/,-I%,$(..)) $(libio-include) -I.
+	    $(+sysdep-includes) $(includes) \
+	    $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
 
 # Since libio has several internal header files, we use a -I instead
 # of many little headers in the include directory.

Modified: fsf/trunk/libc/Makefile
==============================================================================
--- fsf/trunk/libc/Makefile (original)
+++ fsf/trunk/libc/Makefile Sat Apr 10 00:03:22 2010
@@ -227,7 +227,7 @@
 parent-clean: parent-mostlyclean common-clean
 
 postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
-	    $(addprefix $(objpfx),sysd-dirs sysd-rules includes includes.mk) \
+	    $(addprefix $(objpfx),sysd-dirs sysd-rules) \
 	    $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
 
 clean: parent-clean

Modified: fsf/trunk/libc/Makerules
==============================================================================
--- fsf/trunk/libc/Makerules (original)
+++ fsf/trunk/libc/Makerules Sat Apr 10 00:03:22 2010
@@ -111,14 +111,16 @@
 
 ifndef avoid-generated
 before-compile := $(common-objpfx)libc-abis.h $(before-compile)
-$(common-objpfx)libc-abis.h: $(..)scripts/gen-libc-abis \
+$(common-objpfx)libc-abis.h: $(common-objpfx)libc-abis.stamp; @:
+$(common-objpfx)libc-abis.stamp: $(..)scripts/gen-libc-abis \
 			     $(firstword $(wildcard $(sysdirs:=/libc-abis)) \
 					 $(..)libc-abis) \
 			     $(..)Makerules
 	$(SHELL) $< \
 		 $(base-machine)-$(config-vendor)-$(config-os) \
-		 < $(word 2,$^) > $@T
-	$(move-if-change) $@T $@
+		 < $(word 2,$^) > $(@:.stamp=.h)T
+	$(move-if-change) $(@:.stamp=.h)T $(@:.stamp=.h)
+	touch $@
 common-generated += $(common-objpfx)libc-abis.h
 endif # avoid-generated
 
@@ -266,20 +268,6 @@
 # Don't do deps until this exists, because it provides rules to make the deps.
 no_deps=t
 endif
-
--include $(common-objpfx)includes.mk
-ifneq ($(+common-includes),$(saved-includes))
-# Recreate includes.mk (and includes).
-includes-force = FORCE
-FORCE:
-endif
-$(common-objpfx)includes.mk: $(includes-force)
-	-@rm -f $@T $(common-objpfx)includesT
-	for inc in $(+common-includes); do echo "$$inc"; done \
-	  > $(common-objpfx)includesT
-	mv -f $(common-objpfx)includesT $(common-objpfx)includes
-	echo 'saved-includes := $(+common-includes)' > $@T
-	mv -f $@T $@
 
 define o-iterator-doit
 $(objpfx)%$o: %.S $(before-compile); $$(compile-command.S)

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Sat Apr 10 00:03:22 2010
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2010-4-8
+GNU C Library NEWS -- history of user-visible changes.  2010-4-9
 Copyright (C) 1992-2009, 2010 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -10,13 +10,15 @@
 * The following bugs are resolved with this release:
 
   3662, 4457, 5553, 10162, 10401, 10414, 10554, 10824, 10864, 10915, 10918,
-  10936, 10939, 10958, 10968, 10969, 10972, 10992, 11000, 11007, 11010,
-  11027, 11039, 11040, 11041, 11043, 11046, 11056, 11070, 11093, 11115,
-  11120, 11125, 11126, 11127, 11134, 11141, 11149, 11183, 11184, 11185,
-  11186, 11187, 11188, 11189, 11190, 11191, 11192, 11193, 11194, 11200,
-  11230, 11235, 11242, 11254, 11258, 11271, 11272, 11276, 11279, 11287,
-  11292, 11319, 11332, 11333, 11387, 11389, 11394, 11397, 11410, 11438,
-  11449, 11470, 11471
+  10936, 10939, 10958, 10968, 10969, 10972, 10992, 11000, 11001, 11007,
+  11010, 11027, 11039, 11040, 11041, 11043, 11046, 11056, 11070, 11093,
+  11115, 11120, 11125, 11126, 11127, 11134, 11141, 11149, 11183, 11184,
+  11185, 11186, 11187, 11188, 11189, 11190, 11191, 11192, 11193, 11194,
+  11200, 11230, 11235, 11242, 11254, 11258, 11271, 11272, 11276, 11279,
+  11287, 11292, 11319, 11332, 11333, 11387, 11389, 11390, 11394, 11397,
+  11410, 11438, 11449, 11470, 11471
+
+* New interfaces: pthread_getname_np, pthread_setname_np
 
 * New Linux interface: recvmmsg
 

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Sat Apr 10 00:03:22 2010
@@ -1,3 +1,14 @@
+2010-04-09  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #11390]
+	* sysdeps/unix/sysv/linux/pthread_getname.c: New file.
+	* sysdeps/unix/sysv/linux/pthread_setname.c: New file.
+	* nptl/sysdeps/pthread/pthread.h: Declare pthread_getname and
+	pthread_setname.
+	* Makefile (libpthread-routines): Add pthread_getname and
+	pthread_setname.
+	* Versions: Export pthread_getname and pthread_setname for GLIBC_2.12.
+
 2010-04-05  Thomas Schwinge  <thomas@xxxxxxxxxxxxx>
 
 	* sysdeps/pthread/unwind-resume.c: Moved to main tree sysdeps/gnu/.

Modified: fsf/trunk/libc/nptl/Makefile
==============================================================================
--- fsf/trunk/libc/nptl/Makefile (original)
+++ fsf/trunk/libc/nptl/Makefile Sat Apr 10 00:03:22 2010
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2008,2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2008,2009,2010 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
@@ -124,7 +124,9 @@
 		      pthread_mutexattr_setprotocol \
 		      pthread_mutexattr_getprioceiling \
 		      pthread_mutexattr_setprioceiling tpp \
-		      pthread_mutex_getprioceiling pthread_mutex_setprioceiling
+		      pthread_mutex_getprioceiling \
+		      pthread_mutex_setprioceiling \
+		      pthread_setname pthread_getname
 #		      pthread_setuid pthread_seteuid pthread_setreuid \
 #		      pthread_setresuid \
 #		      pthread_setgid pthread_setegid pthread_setregid \

Modified: fsf/trunk/libc/nptl/Versions
==============================================================================
--- fsf/trunk/libc/nptl/Versions (original)
+++ fsf/trunk/libc/nptl/Versions Sat Apr 10 00:03:22 2010
@@ -247,6 +247,8 @@
   GLIBC_2.12 {
     pthread_mutex_consistent; pthread_mutexattr_getrobust;
     pthread_mutexattr_setrobust;
+
+    pthread_setname_np; pthread_getname_np;
   };
 
   GLIBC_PRIVATE {

Modified: fsf/trunk/libc/nptl/sysdeps/pthread/pthread.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/pthread/pthread.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/pthread/pthread.h Sat Apr 10 00:03:22 2010
@@ -425,6 +425,18 @@
      __THROW;
 
 
+#ifdef __USE_GNU
+/* Get thread name visible in the kernel and its interfaces.  */
+extern int pthread_getname_np (pthread_t __target_thread, char *__buf,
+			       size_t __buflen)
+     __THROW __nonnull ((2));
+
+/* Set thread name visible in the kernel and its interfaces.  */
+extern int pthread_setname_np (pthread_t __target_thread, __const char *__name)
+     __THROW __nonnull ((2));
+#endif
+
+
 #ifdef __USE_UNIX98
 /* Determine level of concurrency.  */
 extern int pthread_getconcurrency (void) __THROW;

Added: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/pthread_getname.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/pthread_getname.c (added)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/pthread_getname.c Sat Apr 10 00:03:22 2010
@@ -1,0 +1,64 @@
+/* pthread_getname_np -- Get  thread name.  Linux version
+   Copyright (C) 2010 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; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <pthreadP.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/prctl.h>
+
+#include <not-cancel.h>
+
+
+int
+pthread_getname_np (th, buf, len)
+     pthread_t th;
+     char *buf;
+     size_t len;
+{
+  const struct pthread *pd = (const struct pthread *) th;
+
+  /* Unfortunately the kernel headers do not export the TASK_COMM_LEN
+     macro.  So we have to define it here.  */
+#define TASK_COMM_LEN 16
+  if (len < TASK_COMM_LEN)
+    return ERANGE;
+
+  if (th == THREAD_SELF)
+    return prctl (PR_GET_NAME, buf) ? errno : 0;
+
+#define FMT "/proc/self/task/%u/comm"
+  char fname[sizeof (FMT) + 8];
+  sprintf (fname, FMT, (unsigned int) pd->tid);
+
+  int fd = open_not_cancel_2 (fname, O_RDONLY);
+  if (fd == -1)
+    return errno;
+
+  int res = 0;
+  ssize_t n = TEMP_FAILURE_RETRY (read_not_cancel (fd, buf, len));
+  if (n < 0)
+    res = errno;
+
+  close_not_cancel_no_status (fd);
+
+  return res;
+}

Added: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/pthread_setname.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/pthread_setname.c (added)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/pthread_setname.c Sat Apr 10 00:03:22 2010
@@ -1,0 +1,66 @@
+/* pthread_setname_np -- Set  thread name.  Linux version
+   Copyright (C) 2010 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; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <pthreadP.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/prctl.h>
+
+#include <not-cancel.h>
+
+
+int
+pthread_setname_np (th, name)
+     pthread_t th;
+     const char *name;
+{
+  const struct pthread *pd = (const struct pthread *) th;
+
+  /* Unfortunately the kernel headers do not export the TASK_COMM_LEN
+     macro.  So we have to define it here.  */
+#define TASK_COMM_LEN 16
+  size_t name_len = strlen (name);
+  if (name_len >= TASK_COMM_LEN)
+    return ERANGE;
+
+  if (pd == THREAD_SELF)
+    return prctl (PR_SET_NAME, name) ? errno : 0;
+
+#define FMT "/proc/self/task/%u/comm"
+  char fname[sizeof (FMT) + 8];
+  sprintf (fname, FMT, (unsigned int) pd->tid);
+
+  int fd = open_not_cancel_2 (fname, O_RDWR);
+  if (fd == -1)
+    return errno;
+
+  int res = 0;
+  ssize_t n = TEMP_FAILURE_RETRY (write_not_cancel (fd, name, name_len));
+  if (n < 0)
+    res = errno;
+  else if (n != name_len)
+    res = EIO;
+
+  close_not_cancel_no_status (fd);
+
+  return res;
+}

Modified: fsf/trunk/libc/nscd/aicache.c
==============================================================================
--- fsf/trunk/libc/nscd/aicache.c (original)
+++ fsf/trunk/libc/nscd/aicache.c Sat Apr 10 00:03:22 2010
@@ -1,5 +1,5 @@
 /* Cache handling for host lookup.
-   Copyright (C) 2004-2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2004-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2004.
 
@@ -111,7 +111,7 @@
   int old_res_options = _res.options;
   _res.options &= ~RES_USE_INET6;
 
-  size_t tmpbuf6len = 512;
+  size_t tmpbuf6len = 1024;
   char *tmpbuf6 = alloca (tmpbuf6len);
   size_t tmpbuf4len = 0;
   char *tmpbuf4 = NULL;
@@ -133,9 +133,11 @@
 							 "gethostbyname4_r");
       if (fct4 != NULL)
 	{
-	  struct gaih_addrtuple *at = NULL;
+	  struct gaih_addrtuple atmem;
+	  struct gaih_addrtuple *at;
 	  while (1)
 	    {
+	      at = &atmem;
 	      rc6 = 0;
 	      herrno = 0;
 	      status[1] = DL_CALL_FCT (fct4, (key, &at, tmpbuf6, tmpbuf6len,
@@ -153,7 +155,7 @@
 	    goto next_nip;
 
 	  /* We found the data.  Count the addresses and the size.  */
-	  for (const struct gaih_addrtuple *at2 = at; at2 != NULL;
+	  for (const struct gaih_addrtuple *at2 = at = &atmem; at2 != NULL;
 	       at2 = at2->next)
 	    {
 	      ++naddrs;

Modified: fsf/trunk/libc/posix/Makefile
==============================================================================
--- fsf/trunk/libc/posix/Makefile (original)
+++ fsf/trunk/libc/posix/Makefile Sat Apr 10 00:03:22 2010
@@ -179,7 +179,7 @@
 tst-exec-ARGS = -- $(built-program-cmd)
 tst-spawn-ARGS = -- $(built-program-cmd)
 tst-dir-ARGS = `pwd` `cd $(common-objdir)/$(subdir); pwd` `cd $(common-objdir); pwd` $(objpfx)tst-dir
-tst-chmod-ARGS = `pwd`
+tst-chmod-ARGS = $(objdir)
 tst-vfork3-ARGS = --test-dir=$(objpfx)
 
 tst-fnmatch-ENV = LOCPATH=$(common-objpfx)localedata

Modified: fsf/trunk/libc/resolv/nss_dns/dns-host.c
==============================================================================
--- fsf/trunk/libc/resolv/nss_dns/dns-host.c (original)
+++ fsf/trunk/libc/resolv/nss_dns/dns-host.c Sat Apr 10 00:03:22 2010
@@ -1050,7 +1050,7 @@
 	  ++had_error;
 	  continue;
 	}
-      if (*firstp)
+      if (*firstp && canon == NULL)
 	{
 	  h_name = buffer;
 	  buffer += h_namelen;
@@ -1166,19 +1166,7 @@
 	  if (ttl != 0 && ttlp != NULL)
 	    *ttlp = ttl;
 
-	  if (canon != NULL)
-	    {
-	      (*pat)->name = canon;
-
-	      /* Reclaim buffer space.  */
-	      if (h_name + h_namelen == buffer)
-		{
-		  buffer = h_name;
-		  buflen += h_namelen;
-		}
-	    }
-	  else
-	    (*pat)->name = h_name;
+	  (*pat)->name = canon ?: h_name;
 
 	  *firstp = 0;
 	}