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

[commits] r2559 - in /fsf/trunk/libc: ./ elf/ nptl/ resolv/



Author: eglibc
Date: Tue Jun 19 00:02:52 2007
New Revision: 2559

Log:
Import glibc-mainline for 2007-06-19

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/elf/rtld.c
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/pthreadP.h
    fsf/trunk/libc/nptl/pthread_mutex_lock.c
    fsf/trunk/libc/nptl/pthread_mutex_timedlock.c
    fsf/trunk/libc/nptl/pthread_mutex_trylock.c
    fsf/trunk/libc/nptl/pthread_mutex_unlock.c
    fsf/trunk/libc/resolv/res_init.c
    fsf/trunk/libc/resolv/res_send.c
    fsf/trunk/libc/resolv/resolv.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Jun 19 00:02:52 2007
@@ -1,3 +1,20 @@
+2007-06-18  Jakub Jelinek  <jakub@xxxxxxxxxx>
+            Tomas Janousek  <tjanouse@xxxxxxxxxx>
+            Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4647]
+	* resolv/res_send.c (send_dg): Remove socket_pf.  Use ipv6_unavail
+	member in __res_state, only convaddr4to6 if nssocks[ns] is a PF_INET6
+	socket.
+	* resolv/resolv.h (__res_state): Add ipv6_unavail member.  Make
+	unused member a bitmap.
+	* resolv/res_init.c (__res_vinit): Reset ipv6_unavail if IPv6
+	servers are configured.
+
+2007-06-18  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* elf/rtld.c (dl_main): Don't call init_tls more than once.
+
 2007-06-17  Andreas Schwab  <schwab@xxxxxxx>
 
 	* sysdeps/generic/initfini.c: Tell gcc about the nonstandard sections.

Modified: fsf/trunk/libc/elf/rtld.c
==============================================================================
--- fsf/trunk/libc/elf/rtld.c (original)
+++ fsf/trunk/libc/elf/rtld.c Tue Jun 19 00:02:52 2007
@@ -1400,6 +1400,11 @@
       /* Iterate over all entries in the list.  The order is important.  */
       struct audit_ifaces *last_audit = NULL;
       struct audit_list *al = audit_list->next;
+
+      /* Since we start using the auditing DSOs right away we need to
+	 initialize the data structures now.  */
+      tcbp = init_tls ();
+
       do
 	{
 	  int tls_idx = GL(dl_tls_max_dtv_idx);
@@ -1409,11 +1414,6 @@
 	     always allocate the static block, we never defer it even if
 	     no DF_STATIC_TLS bit is set.  The reason is that we know
 	     glibc will use the static model.  */
-
-	  /* Since we start using the auditing DSOs right away we need to
-	     initialize the data structures now.  */
-	  tcbp = init_tls ();
-
 	  struct dlmopen_args dlmargs;
 	  dlmargs.fname = al->name;
 	  dlmargs.map = NULL;

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Tue Jun 19 00:02:52 2007
@@ -1,3 +1,11 @@
+2007-06-18  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* pthreadP.h: Define PTHREAD_MUTEX_TYPE.
+	* phtread_mutex_lock.c: Use PTHREAD_MUTEX_TYPE.
+	* pthread_mutex_timedlock.c: Likewise.
+	* pthread_mutex_trylock.c: Likewise.
+	* pthread_mutex_unlock.c: Likewise.
+
 2007-06-17  Andreas Schwab  <schwab@xxxxxxx>
 
 	* sysdeps/pthread/pt-initfini.c: Tell gcc about the nonstandard

Modified: fsf/trunk/libc/nptl/pthreadP.h
==============================================================================
--- fsf/trunk/libc/nptl/pthreadP.h (original)
+++ fsf/trunk/libc/nptl/pthreadP.h Tue Jun 19 00:02:52 2007
@@ -96,6 +96,9 @@
   PTHREAD_MUTEX_PP_ADAPTIVE_NP
   = PTHREAD_MUTEX_PRIO_PROTECT_NP | PTHREAD_MUTEX_ADAPTIVE_NP
 };
+
+#define PTHREAD_MUTEX_TYPE(m) \
+  ((m)->__data.__kind)
 
 /* Ceiling in __data.__lock.  __data.__lock is signed, so don't
    use the MSB bit in there, but in the mask also include that bit,

Modified: fsf/trunk/libc/nptl/pthread_mutex_lock.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_mutex_lock.c (original)
+++ fsf/trunk/libc/nptl/pthread_mutex_lock.c Tue Jun 19 00:02:52 2007
@@ -43,7 +43,8 @@
   pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
 
   int retval = 0;
-  switch (__builtin_expect (mutex->__data.__kind, PTHREAD_MUTEX_TIMED_NP))
+  switch (__builtin_expect (PTHREAD_MUTEX_TYPE (mutex),
+			    PTHREAD_MUTEX_TIMED_NP))
     {
       /* Recursive mutex.  */
     case PTHREAD_MUTEX_RECURSIVE_NP:

Modified: fsf/trunk/libc/nptl/pthread_mutex_timedlock.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_mutex_timedlock.c (original)
+++ fsf/trunk/libc/nptl/pthread_mutex_timedlock.c Tue Jun 19 00:02:52 2007
@@ -37,7 +37,8 @@
   /* We must not check ABSTIME here.  If the thread does not block
      abstime must not be checked for a valid value.  */
 
-  switch (__builtin_expect (mutex->__data.__kind, PTHREAD_MUTEX_TIMED_NP))
+  switch (__builtin_expect (PTHREAD_MUTEX_TYPE (mutex),
+			    PTHREAD_MUTEX_TIMED_NP))
     {
       /* Recursive mutex.  */
     case PTHREAD_MUTEX_RECURSIVE_NP:

Modified: fsf/trunk/libc/nptl/pthread_mutex_trylock.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_mutex_trylock.c (original)
+++ fsf/trunk/libc/nptl/pthread_mutex_trylock.c Tue Jun 19 00:02:52 2007
@@ -31,7 +31,8 @@
   int oldval;
   pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
 
-  switch (__builtin_expect (mutex->__data.__kind, PTHREAD_MUTEX_TIMED_NP))
+  switch (__builtin_expect (PTHREAD_MUTEX_TYPE (mutex),
+			    PTHREAD_MUTEX_TIMED_NP))
     {
       /* Recursive mutex.  */
     case PTHREAD_MUTEX_RECURSIVE_NP:

Modified: fsf/trunk/libc/nptl/pthread_mutex_unlock.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_mutex_unlock.c (original)
+++ fsf/trunk/libc/nptl/pthread_mutex_unlock.c Tue Jun 19 00:02:52 2007
@@ -31,7 +31,8 @@
 {
   int newowner = 0;
 
-  switch (__builtin_expect (mutex->__data.__kind, PTHREAD_MUTEX_TIMED_NP))
+  switch (__builtin_expect (PTHREAD_MUTEX_TYPE (mutex),
+			    PTHREAD_MUTEX_TIMED_NP))
     {
     case PTHREAD_MUTEX_RECURSIVE_NP:
       /* Recursive mutex.  */

Modified: fsf/trunk/libc/resolv/res_init.c
==============================================================================
--- fsf/trunk/libc/resolv/res_init.c (original)
+++ fsf/trunk/libc/resolv/res_init.c Tue Jun 19 00:02:52 2007
@@ -241,8 +241,8 @@
 	 line[sizeof(name) - 1] == '\t'))
 
 	if ((fp = fopen(_PATH_RESCONF, "rc")) != NULL) {
-		/* No threads use this stream.  */
-		__fsetlocking (fp, FSETLOCKING_BYCALLER);
+	    /* No threads use this stream.  */
+	    __fsetlocking (fp, FSETLOCKING_BYCALLER);
 	    /* read the config file */
 	    while (fgets_unlocked(buf, sizeof(buf), fp) != NULL) {
 		/* skip comments */
@@ -397,8 +397,11 @@
 	    if (nserv > 1)
 		statp->nscount = nserv;
 #ifdef _LIBC
-	    if (nservall - nserv > 0)
+	    if (nservall - nserv > 0) {
 		statp->_u._ext.nscount6 = nservall - nserv;
+		/* We try IPv6 servers again.  */
+		statp->ipv6_unavail = false;
+	    }
 #endif
 #ifdef RESOLVSORT
 	    statp->nsort = nsort;

Modified: fsf/trunk/libc/resolv/res_send.c
==============================================================================
--- fsf/trunk/libc/resolv/res_send.c (original)
+++ fsf/trunk/libc/resolv/res_send.c Tue Jun 19 00:02:52 2007
@@ -813,17 +813,20 @@
 	struct pollfd pfd[1];
         int ptimeout;
 	struct sockaddr_in6 from;
-	static int socket_pf = 0;
 	socklen_t fromlen;
 	int resplen, seconds, n;
 
 	if (EXT(statp).nssocks[ns] == -1) {
 		/* only try IPv6 if IPv6 NS and if not failed before */
-		if ((EXT(statp).nscount6 > 0) && (socket_pf != PF_INET)) {
+		if ((EXT(statp).nscount6 > 0) && !statp->ipv6_unavail) {
 			EXT(statp).nssocks[ns] =
 			    socket(PF_INET6, SOCK_DGRAM, 0);
-			socket_pf = EXT(statp).nssocks[ns] < 0 ? PF_INET
-			                                       : PF_INET6;
+			if (EXT(statp).nssocks[ns] < 0)
+			    statp->ipv6_unavail = errno == EAFNOSUPPORT;
+			/* If IPv6 socket and nsap is IPv4, make it
+			   IPv4-mapped */
+			else if (nsap->sin6_family == AF_INET)
+			    convaddr4to6(nsap);
 		}
 		if (EXT(statp).nssocks[ns] < 0)
 			EXT(statp).nssocks[ns] = socket(PF_INET, SOCK_DGRAM, 0);
@@ -832,9 +835,7 @@
 			Perror(statp, stderr, "socket(dg)", errno);
 			return (-1);
 		}
-		/* If IPv6 socket and nsap is IPv4, make it IPv4-mapped */
-		if ((socket_pf == PF_INET6) && (nsap->sin6_family == AF_INET))
-			convaddr4to6(nsap);
+
 		/*
 		 * On a 4.3BSD+ machine (client and server,
 		 * actually), sending to a nameserver datagram

Modified: fsf/trunk/libc/resolv/resolv.h
==============================================================================
--- fsf/trunk/libc/resolv/resolv.h (original)
+++ fsf/trunk/libc/resolv/resolv.h Tue Jun 19 00:02:52 2007
@@ -110,21 +110,25 @@
 		nsaddr_list[MAXNS];	/* address of name server */
 # define nsaddr	nsaddr_list[0]		/* for backward compatibility */
 	u_short	id;			/* current message id */
+	/* 2 byte hole here.  */
 	char	*dnsrch[MAXDNSRCH+1];	/* components of domain to search */
 	char	defdname[256];		/* default domain (deprecated) */
 	u_long	pfcode;			/* RES_PRF_ flags - see below. */
 	unsigned ndots:4;		/* threshold for initial abs. query */
 	unsigned nsort:4;		/* number of elements in sort_list[] */
-	char	unused[3];
+	unsigned ipv6_unavail:1;	/* connecting to IPv6 server failed */
+	unsigned unused:23;
 	struct {
 		struct in_addr	addr;
 		u_int32_t	mask;
 	} sort_list[MAXRESOLVSORT];
+	/* 4 byte hole here on 64-bit architectures.  */
 	res_send_qhook qhook;		/* query hook */
 	res_send_rhook rhook;		/* response hook */
 	int	res_h_errno;		/* last one set for this context */
 	int	_vcsock;		/* PRIVATE: for res_send VC i/o */
 	u_int	_flags;			/* PRIVATE: see below */
+	/* 4 byte hole here on 64-bit architectures.  */
 	union {
 		char	pad[52];	/* On an i386 this means 512b total. */
 		struct {