about summary refs log tree commit diff
path: root/sysdeps/pthread/sem_unlink.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-05-05 17:15:57 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-05-05 17:19:50 +0200
commit990c8ffd3a83232365f346413e394d4431875899 (patch)
tree24b41f70bcee7f885eca1d8ff50f44f0b0aea9e1 /sysdeps/pthread/sem_unlink.c
parent018c75dcb1ee93f3ff0d3d9cbdf1fe48aa630315 (diff)
downloadglibc-990c8ffd3a83232365f346413e394d4431875899.tar.gz
glibc-990c8ffd3a83232365f346413e394d4431875899.tar.xz
glibc-990c8ffd3a83232365f346413e394d4431875899.zip
nptl: Move sem_unlink into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

A small adjust to the sem_unlink implementation is necessary to avoid
a check-localplt failure.

A placeholder symbol to keep the GLIBC_2.1.1 version alive in
libpthread is added with this commit.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/pthread/sem_unlink.c')
-rw-r--r--sysdeps/pthread/sem_unlink.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/sysdeps/pthread/sem_unlink.c b/sysdeps/pthread/sem_unlink.c
index 1f06a55b8e..c6f89349e5 100644
--- a/sysdeps/pthread/sem_unlink.c
+++ b/sysdeps/pthread/sem_unlink.c
@@ -24,8 +24,13 @@
 #include "semaphoreP.h"
 #include <shm-directory.h>
 
+#if !PTHREAD_IN_LIBC
+/* The private name is not exported from libc.  */
+# define __unlink unlink
+#endif
+
 int
-sem_unlink (const char *name)
+__sem_unlink (const char *name)
 {
   struct shmdir_name dirname;
   if (__shm_get_name (&dirname, name, true) != 0)
@@ -35,8 +40,16 @@ sem_unlink (const char *name)
     }
 
   /* Now try removing it.  */
-  int ret = unlink (dirname.name);
+  int ret = __unlink (dirname.name);
   if (ret < 0 && errno == EPERM)
     __set_errno (EACCES);
   return ret;
 }
+#if PTHREAD_IN_LIBC
+versioned_symbol (libc, __sem_unlink, sem_unlink, GLIBC_2_34);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_1_1, GLIBC_2_34)
+compat_symbol (libpthread, __sem_unlink, sem_unlink, GLIBC_2_1_1);
+# endif
+#else /* !PTHREAD_IN_LIBC */
+strong_alias (__sem_unlink, sem_unlink)
+#endif