about summary refs log tree commit diff
path: root/nptl/pthread_attr_setaffinity.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-05-15 17:51:57 +0200
committerFlorian Weimer <fweimer@redhat.com>2020-05-20 20:22:59 +0200
commit1979819d680bb5394a878261519f8a3e4a2886a1 (patch)
treecd871a594a5fd9e7aba416a8938f43c36e8c428f /nptl/pthread_attr_setaffinity.c
parent714da1d4eac32400187255254dd40334b48b80f3 (diff)
downloadglibc-1979819d680bb5394a878261519f8a3e4a2886a1.tar.gz
glibc-1979819d680bb5394a878261519f8a3e4a2886a1.tar.xz
glibc-1979819d680bb5394a878261519f8a3e4a2886a1.zip
nptl: Move pthread_attr_setaffinity_np into libc
This is part of the libpthread removal project:

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

The symbol did not previously exist in libc, so a new GLIBC_2.32
symbol is needed, to get correct dependency for binaries which
use the symbol but no longer link against libpthread.

The abilist updates were performed by:

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

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'nptl/pthread_attr_setaffinity.c')
-rw-r--r--nptl/pthread_attr_setaffinity.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/nptl/pthread_attr_setaffinity.c b/nptl/pthread_attr_setaffinity.c
index cbdee85343..a42ffd92f4 100644
--- a/nptl/pthread_attr_setaffinity.c
+++ b/nptl/pthread_attr_setaffinity.c
@@ -25,8 +25,8 @@
 
 
 int
-__pthread_attr_setaffinity_new (pthread_attr_t *attr, size_t cpusetsize,
-				const cpu_set_t *cpuset)
+__pthread_attr_setaffinity_np (pthread_attr_t *attr, size_t cpusetsize,
+			       const cpu_set_t *cpuset)
 {
   struct pthread_attr *iattr;
 
@@ -55,17 +55,25 @@ __pthread_attr_setaffinity_new (pthread_attr_t *attr, size_t cpusetsize,
 
   return 0;
 }
-versioned_symbol (libpthread, __pthread_attr_setaffinity_new,
-		  pthread_attr_setaffinity_np, GLIBC_2_3_4);
+libc_hidden_def (__pthread_attr_setaffinity_np)
+versioned_symbol (libc, __pthread_attr_setaffinity_np,
+		  pthread_attr_setaffinity_np, GLIBC_2_32);
 
 
-#if SHLIB_COMPAT (libpthread, GLIBC_2_3_3, GLIBC_2_3_4)
+#if SHLIB_COMPAT (libc, GLIBC_2_3_4, GLIBC_2_32)
+/* Compat symbol with the old libc version.  */
+strong_alias (__pthread_attr_setaffinity_np, __pthread_attr_setaffinity_alias)
+compat_symbol (libc, __pthread_attr_setaffinity_alias,
+	       pthread_attr_setaffinity_np, GLIBC_2_3_4);
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
 int
 __pthread_attr_setaffinity_old (pthread_attr_t *attr, cpu_set_t *cpuset)
 {
   /* The old interface by default assumed a 1024 processor bitmap.  */
-  return __pthread_attr_setaffinity_new (attr, 128, cpuset);
+  return __pthread_attr_setaffinity_np (attr, 128, cpuset);
 }
-compat_symbol (libpthread, __pthread_attr_setaffinity_old,
+compat_symbol (libc, __pthread_attr_setaffinity_old,
 	       pthread_attr_setaffinity_np, GLIBC_2_3_3);
 #endif