summary refs log tree commit diff
path: root/resolv/getaddrinfo_a.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-07-02 11:45:00 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-07-02 11:45:00 +0200
commitdbb949f53d4801b91885b2dfac9875b83a8710bf (patch)
tree9fdfcaeda7ba0f7f2895f45e233757cdfdb1eef3 /resolv/getaddrinfo_a.c
parent813c6ec808556553be9d39e900a3fc97ceb32330 (diff)
downloadglibc-dbb949f53d4801b91885b2dfac9875b83a8710bf.tar.gz
glibc-dbb949f53d4801b91885b2dfac9875b83a8710bf.tar.xz
glibc-dbb949f53d4801b91885b2dfac9875b83a8710bf.zip
resolv: Move libanl into libc (if libpthread is in libc)
The symbols gai_cancel, gai_error, gai_suspend, getaddrinfo_a,
__gai_suspend_time64 were moved using scripts/move-symbol-to-libc.py.

For Hurd (which remains !PTHREAD_IN_LIBC), a few #define redirects
had to be added because several pthread functions are not available
under __.  (Linux uses __ prefixes for most hidden aliases, and has
to in some cases to avoid linknamespace issues.)
Diffstat (limited to 'resolv/getaddrinfo_a.c')
-rw-r--r--resolv/getaddrinfo_a.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/resolv/getaddrinfo_a.c b/resolv/getaddrinfo_a.c
index fca39a8d89..7541f2a9af 100644
--- a/resolv/getaddrinfo_a.c
+++ b/resolv/getaddrinfo_a.c
@@ -35,7 +35,7 @@ struct async_waitlist
 
 
 int
-getaddrinfo_a (int mode, struct gaicb *list[], int ent, struct sigevent *sig)
+__getaddrinfo_a (int mode, struct gaicb *list[], int ent, struct sigevent *sig)
 {
   struct sigevent defsigev;
   struct requestlist *requests[ent];
@@ -57,7 +57,7 @@ getaddrinfo_a (int mode, struct gaicb *list[], int ent, struct sigevent *sig)
     }
 
   /* Request the mutex.  */
-  pthread_mutex_lock (&__gai_requests_mutex);
+  __pthread_mutex_lock (&__gai_requests_mutex);
 
   /* Now we can enqueue all requests.  Since we already acquired the
      mutex the enqueue function need not do this.  */
@@ -85,7 +85,7 @@ getaddrinfo_a (int mode, struct gaicb *list[], int ent, struct sigevent *sig)
       /* Release the mutex.  We do this before raising a signal since the
 	 signal handler might do a `siglongjmp' and then the mutex is
 	 locked forever.  */
-      pthread_mutex_unlock (&__gai_requests_mutex);
+      __pthread_mutex_unlock (&__gai_requests_mutex);
 
       if (mode == GAI_NOWAIT)
 	__gai_notify_only (sig,
@@ -119,7 +119,7 @@ getaddrinfo_a (int mode, struct gaicb *list[], int ent, struct sigevent *sig)
       /* Since `pthread_cond_wait'/`pthread_cond_timedwait' are cancelation
 	 points we must be careful.  We added entries to the waiting lists
 	 which we must remove.  So defer cancelation for now.  */
-      pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate);
+      __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate);
 
       while (total > 0)
 	{
@@ -132,7 +132,7 @@ getaddrinfo_a (int mode, struct gaicb *list[], int ent, struct sigevent *sig)
 	}
 
       /* Now it's time to restore the cancelation state.  */
-      pthread_setcancelstate (oldstate, NULL);
+      __pthread_setcancelstate (oldstate, NULL);
 
 #ifndef DONT_NEED_GAI_MISC_COND
       /* Release the conditional variable.  */
@@ -176,7 +176,16 @@ getaddrinfo_a (int mode, struct gaicb *list[], int ent, struct sigevent *sig)
     }
 
   /* Release the mutex.  */
-  pthread_mutex_unlock (&__gai_requests_mutex);
+  __pthread_mutex_unlock (&__gai_requests_mutex);
 
   return result;
 }
+#if PTHREAD_IN_LIBC
+versioned_symbol (libc, __getaddrinfo_a, getaddrinfo_a, GLIBC_2_34);
+
+# if OTHER_SHLIB_COMPAT (libanl, GLIBC_2_2_3, GLIBC_2_34)
+compat_symbol (libanl, __getaddrinfo_a, getaddrinfo_a, GLIBC_2_2_3);
+# endif
+#else /* !PTHREAD_IN_LIBC */
+strong_alias (__getaddrinfo_a, getaddrinfo_a)
+#endif /* !PTHREAD_IN_LIBC */