about summary refs log tree commit diff
path: root/resolv/gai_notify.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/gai_notify.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/gai_notify.c')
-rw-r--r--resolv/gai_notify.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/resolv/gai_notify.c b/resolv/gai_notify.c
index de104e5560..8fee627f46 100644
--- a/resolv/gai_notify.c
+++ b/resolv/gai_notify.c
@@ -21,6 +21,15 @@
 #include <stdlib.h>
 #include <gai_misc.h>
 
+#if !PTHREAD_IN_LIBC
+/* The available function names differ outside of libc.  (In libc, we
+   need to use hidden aliases to avoid the PLT.)  */
+#define __pthread_attr_init pthread_attr_init
+#define __pthread_attr_setdetachstate pthread_attr_setdetachstate
+#define __pthread_cond_signal pthread_cond_signal
+#define __pthread_cond_timedwait pthread_cond_timedwait
+#define __pthread_create pthread_create
+#endif
 
 struct notify_func
   {
@@ -56,8 +65,8 @@ __gai_notify_only (struct sigevent *sigev, pid_t caller_pid)
       pattr = (pthread_attr_t *) sigev->sigev_notify_attributes;
       if (pattr == NULL)
 	{
-	  pthread_attr_init (&attr);
-	  pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
+	  __pthread_attr_init (&attr);
+	  __pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
 	  pattr = &attr;
 	}
 
@@ -75,7 +84,7 @@ __gai_notify_only (struct sigevent *sigev, pid_t caller_pid)
 	{
 	  nf->func = sigev->sigev_notify_function;
 	  nf->value = sigev->sigev_value;
-	  if (pthread_create (&tid, pattr, notify_func_wrapper, nf) < 0)
+	  if (__pthread_create (&tid, pattr, notify_func_wrapper, nf) < 0)
 	    {
 	      free (nf);
 	      result = -1;