From ae830b2d9f5238e1bee9820cd4d4df7f7b13ecff Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 21 Jun 2021 08:25:15 +0200 Subject: 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 --- rt/Makefile | 2 +- rt/Versions | 3 ++- rt/shm_unlink.c | 10 ++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'rt') 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 @@ . */ #include +#include #include #include #include /* 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 -- cgit 1.4.1