summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-05-15 11:01:49 +0200
committerFlorian Weimer <fweimer@redhat.com>2020-05-20 20:27:49 +0200
commit07a73d521988a7fdea1bb3c3b5bbb2b23a0da2e1 (patch)
tree98f7dc6b3c80ec12f8f5a2fa759bc03e09de453a /nptl
parent52302bc298c99dc0d2ca3d1b07b4349129babae3 (diff)
downloadglibc-07a73d521988a7fdea1bb3c3b5bbb2b23a0da2e1.tar.gz
glibc-07a73d521988a7fdea1bb3c3b5bbb2b23a0da2e1.tar.xz
glibc-07a73d521988a7fdea1bb3c3b5bbb2b23a0da2e1.zip
nptl: Move pthread_gettattr_np into libc
This is part of the libpthread removal project:

    <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html>

Use __getline instead of __getdelim to avoid a localplt failure.
Likewise for __getrlimit/getrlimit.

The abilist updates were performed by:

git ls-files 'sysdeps/unix/sysv/linux/**/libc.abilist' \
  | while read x ; do
    echo "GLIBC_2.32 pthread_getattr_np F" >> $x
done
python3 scripts/move-symbol-to-libc.py --only-linux pthread_getattr_np

The private export of __pthread_getaffinity_np is no longer needed, but
the hidden alias still necessary so that the symbol can be exported with
versioned_symbol.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'nptl')
-rw-r--r--nptl/Makefile2
-rw-r--r--nptl/Versions8
-rw-r--r--nptl/libpthread-compat.c5
-rw-r--r--nptl/pthread_getattr_np.c13
4 files changed, 21 insertions, 7 deletions
diff --git a/nptl/Makefile b/nptl/Makefile
index 7edad1c0c9..0dd8800f19 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -58,6 +58,7 @@ routines = \
   pthread_condattr_init \
   pthread_equal \
   pthread_getaffinity \
+  pthread_getattr_np \
   pthread_getschedparam \
   pthread_self \
   pthread_setschedparam \
@@ -89,7 +90,6 @@ libpthread-routines = nptl-init nptlfreeres vars events version pt-interp \
 		      pthread_attr_getstackaddr pthread_attr_setstackaddr \
 		      pthread_attr_getstacksize pthread_attr_setstacksize \
 		      pthread_attr_getstack pthread_attr_setstack \
-		      pthread_getattr_np \
 		      pthread_mutex_init pthread_mutex_destroy \
 		      pthread_mutex_lock pthread_mutex_trylock \
 		      pthread_mutex_timedlock pthread_mutex_unlock \
diff --git a/nptl/Versions b/nptl/Versions
index 637d100a9e..ce08076611 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -21,6 +21,9 @@ libc {
   GLIBC_2.1 {
     pthread_attr_init;
   }
+  GLIBC_2.2.3 {
+    pthread_getattr_np;
+  }
   GLIBC_2.3.2 {
     __register_atfork;
 
@@ -43,6 +46,7 @@ libc {
   GLIBC_2.32 {
     pthread_attr_setaffinity_np;
     pthread_getaffinity_np;
+    pthread_getattr_np;
     pthread_sigmask;
   }
   GLIBC_PRIVATE {
@@ -55,7 +59,6 @@ libc {
     # Used by the C11 threads implementation.
     __pthread_cond_destroy; __pthread_cond_init;
     __pthread_attr_setaffinity_np;
-    __pthread_getaffinity_np; # For pthread_getattr_np.
   }
 }
 
@@ -197,8 +200,7 @@ libpthread {
   }
 
   GLIBC_2.2.3 {
-    # Extensions.
-    pthread_getattr_np;
+    __libpthread_version_placeholder;
   }
 
   GLIBC_2.2.6 {
diff --git a/nptl/libpthread-compat.c b/nptl/libpthread-compat.c
index 512b4c77c8..ec02b5dccf 100644
--- a/nptl/libpthread-compat.c
+++ b/nptl/libpthread-compat.c
@@ -41,6 +41,11 @@ compat_symbol_unique (libpthread,
 		      __libpthread_version_placeholder, GLIBC_2_1_2);
 #endif
 
+#if (SHLIB_COMPAT (libpthread, GLIBC_2_2_3, GLIBC_2_2_4))
+compat_symbol_unique (libpthread,
+		      __libpthread_version_placeholder, GLIBC_2_2_3);
+#endif
+
 #if (SHLIB_COMPAT (libpthread, GLIBC_2_2_6, GLIBC_2_3))
 compat_symbol_unique (libpthread,
 		      __libpthread_version_placeholder, GLIBC_2_2_6);
diff --git a/nptl/pthread_getattr_np.c b/nptl/pthread_getattr_np.c
index 644548d862..0e8911346d 100644
--- a/nptl/pthread_getattr_np.c
+++ b/nptl/pthread_getattr_np.c
@@ -30,7 +30,7 @@
 
 
 int
-pthread_getattr_np (pthread_t thread_id, pthread_attr_t *attr)
+__pthread_getattr_np (pthread_t thread_id, pthread_attr_t *attr)
 {
   struct pthread *thread = (struct pthread *) thread_id;
   struct pthread_attr *iattr = (struct pthread_attr *) attr;
@@ -84,7 +84,7 @@ pthread_getattr_np (pthread_t thread_id, pthread_attr_t *attr)
       /* We need the limit of the stack in any case.  */
       else
 	{
-	  if (getrlimit (RLIMIT_STACK, &rl) != 0)
+	  if (__getrlimit (RLIMIT_STACK, &rl) != 0)
 	    ret = errno;
 	  else
 	    {
@@ -115,7 +115,7 @@ pthread_getattr_np (pthread_t thread_id, pthread_attr_t *attr)
 
 	      while (! feof_unlocked (fp))
 		{
-		  if (__getdelim (&line, &linelen, '\n', fp) <= 0)
+		  if (__getline (&line, &linelen, fp) <= 0)
 		    break;
 
 		  uintptr_t from;
@@ -208,3 +208,10 @@ pthread_getattr_np (pthread_t thread_id, pthread_attr_t *attr)
 
   return ret;
 }
+versioned_symbol (libc, __pthread_getattr_np, pthread_getattr_np, GLIBC_2_32);
+
+#if SHLIB_COMPAT (libc, GLIBC_2_2_3, GLIBC_2_32)
+strong_alias (__pthread_getattr_np, __pthread_getattr_np_alias)
+compat_symbol (libc, __pthread_getattr_np_alias,
+	       pthread_getattr_np, GLIBC_2_2_3);
+#endif