summary refs log tree commit diff
path: root/rt
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-06-21 08:25:15 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-06-21 08:25:15 +0200
commitae830b2d9f5238e1bee9820cd4d4df7f7b13ecff (patch)
tree0b3afe2777d45064178f549c15a674f110a4432a /rt
parentc6e7ec2f123bceb323836cc4558f9586959ebf58 (diff)
downloadglibc-ae830b2d9f5238e1bee9820cd4d4df7f7b13ecff.tar.gz
glibc-ae830b2d9f5238e1bee9820cd4d4df7f7b13ecff.tar.xz
glibc-ae830b2d9f5238e1bee9820cd4d4df7f7b13ecff.zip
rt: Move shm_unlink into libc
This function has no dependency on libpthread, so the move is also
applied to Hurd.

The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'rt')
-rw-r--r--rt/Makefile2
-rw-r--r--rt/Versions3
-rw-r--r--rt/shm_unlink.c10
3 files changed, 11 insertions, 4 deletions
diff --git a/rt/Makefile b/rt/Makefile
index ba141c82f2..329db09c32 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -26,6 +26,7 @@ headers	:= aio.h mqueue.h bits/mqueue.h bits/mqueue2.h
 
 routines = \
   shm_open \
+  shm_unlink \
 
 librt-routines = \
   aio_cancel \
@@ -52,7 +53,6 @@ librt-routines = \
   mq_timedreceive \
   mq_timedsend \
   mq_unlink \
-  shm_unlink \
   timer_create \
   timer_delete \
   timer_getoverr \
diff --git a/rt/Versions b/rt/Versions
index e1d208eeb3..309486be1e 100644
--- a/rt/Versions
+++ b/rt/Versions
@@ -1,9 +1,11 @@
 libc {
   GLIBC_2.2 {
     shm_open;
+    shm_unlink;
   }
   GLIBC_2.34 {
     shm_open;
+    shm_unlink;
   }
 }
 librt {
@@ -27,7 +29,6 @@ librt {
     lio_listio64;
   }
   GLIBC_2.2 {
-    shm_unlink;
     timer_create;
     timer_delete;
     timer_getoverrun;
diff --git a/rt/shm_unlink.c b/rt/shm_unlink.c
index a5af5ac147..85e9360e4c 100644
--- a/rt/shm_unlink.c
+++ b/rt/shm_unlink.c
@@ -17,13 +17,14 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
+#include <shlib-compat.h>
 #include <shm-directory.h>
 #include <string.h>
 #include <unistd.h>
 
 /* Remove shared memory object.  */
 int
-shm_unlink (const char *name)
+__shm_unlink (const char *name)
 {
   struct shmdir_name dirname;
   if (__shm_get_name (&dirname, name, false) != 0)
@@ -32,8 +33,13 @@ shm_unlink (const char *name)
       return -1;
     }
 
-  int result = unlink (dirname.name);
+  int result = __unlink (dirname.name);
   if (result < 0 && errno == EPERM)
     __set_errno (EACCES);
   return result;
 }
+versioned_symbol (libc, __shm_unlink, shm_unlink, GLIBC_2_34);
+
+#if OTHER_SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_34)
+compat_symbol (libc, __shm_unlink, shm_unlink, GLIBC_2_2);
+#endif