about summary refs log tree commit diff
path: root/rt
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-06-25 10:30:36 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-06-25 11:48:46 +0200
commit3df6dcc5c75b40d0ac0a9d22967da0a5a2b8df5c (patch)
tree7d411f73feedaca24ae047dca2f4892c412e246d /rt
parentd12506b2dbbeb259468e0f06e87a98174e69a743 (diff)
downloadglibc-3df6dcc5c75b40d0ac0a9d22967da0a5a2b8df5c.tar.gz
glibc-3df6dcc5c75b40d0ac0a9d22967da0a5a2b8df5c.tar.xz
glibc-3df6dcc5c75b40d0ac0a9d22967da0a5a2b8df5c.zip
Linux: Move aio_cancel, aio_cancel64 into libc
The symbols were moved using scripts/move-symbol-to-libc.py.

A version placeholder symbol is needed on alpha and sparc because
of the additional symbols formerly at version GLIBC_2.3.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>:
Diffstat (limited to 'rt')
-rw-r--r--rt/Makefile5
-rw-r--r--rt/Versions6
-rw-r--r--rt/aio_cancel.c28
-rw-r--r--rt/librt-compat.c29
4 files changed, 58 insertions, 10 deletions
diff --git a/rt/Makefile b/rt/Makefile
index 048aacce86..75a4d1c080 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -29,7 +29,6 @@ routines = \
   shm_unlink \
 
 librt-routines = \
-  aio_cancel \
   aio_error \
   aio_fsync \
   aio_read \
@@ -38,6 +37,7 @@ librt-routines = \
   aio_suspend \
   aio_write \
   aio_write64 \
+  librt-compat \
   lio_listio \
   lio_listio64 \
   mq_close \
@@ -56,7 +56,10 @@ librt-routines = \
   timer_gettime \
   timer_settime \
 
+librt-shared-only-routines = librt-compat
+
 $(librt-routines-var) += \
+  aio_cancel \
   aio_misc \
   aio_notify \
   aio_sigqueue \
diff --git a/rt/Versions b/rt/Versions
index 2e991a9d93..402a1188e7 100644
--- a/rt/Versions
+++ b/rt/Versions
@@ -2,6 +2,8 @@ libc {
   GLIBC_2.1 {
 %if PTHREAD_IN_LIBC
     aio_init;
+    aio_cancel;
+    aio_cancel64;
 %endif
   }
   GLIBC_2.2 {
@@ -10,6 +12,8 @@ libc {
   }
   GLIBC_2.34 {
 %if PTHREAD_IN_LIBC
+    aio_cancel;
+    aio_cancel64;
     aio_init;
 %endif
     shm_open;
@@ -31,8 +35,10 @@ libc {
 }
 librt {
   GLIBC_2.1 {
+%if !PTHREAD_IN_LIBC
     aio_cancel;
     aio_cancel64;
+%endif
     aio_error;
     aio_error64;
     aio_fsync;
diff --git a/rt/aio_cancel.c b/rt/aio_cancel.c
index 63fd88f36c..5934205199 100644
--- a/rt/aio_cancel.c
+++ b/rt/aio_cancel.c
@@ -35,23 +35,24 @@
 #include <fcntl.h>
 
 #include <aio_misc.h>
+#include <pthreadP.h>
 
 
 int
-aio_cancel (int fildes, struct aiocb *aiocbp)
+__aio_cancel (int fildes, struct aiocb *aiocbp)
 {
   struct requestlist *req = NULL;
   int result = AIO_ALLDONE;
 
   /* If fildes is invalid, error. */
-  if (fcntl (fildes, F_GETFL) < 0)
+  if (__fcntl (fildes, F_GETFL) < 0)
     {
       __set_errno (EBADF);
       return -1;
     }
 
   /* Request the mutex.  */
-  pthread_mutex_lock (&__aio_requests_mutex);
+  __pthread_mutex_lock (&__aio_requests_mutex);
 
   /* We are asked to cancel a specific AIO request.  */
   if (aiocbp != NULL)
@@ -60,7 +61,7 @@ aio_cancel (int fildes, struct aiocb *aiocbp)
 	 to look for the request block.  */
       if (aiocbp->aio_fildes != fildes)
 	{
-	  pthread_mutex_unlock (&__aio_requests_mutex);
+	  __pthread_mutex_unlock (&__aio_requests_mutex);
 	  __set_errno (EINVAL);
 	  return -1;
 	}
@@ -73,7 +74,7 @@ aio_cancel (int fildes, struct aiocb *aiocbp)
 	  if (req == NULL)
 	    {
 	    not_found:
-	      pthread_mutex_unlock (&__aio_requests_mutex);
+	      __pthread_mutex_unlock (&__aio_requests_mutex);
 	      __set_errno (EINVAL);
 	      return -1;
 	    }
@@ -147,11 +148,20 @@ aio_cancel (int fildes, struct aiocb *aiocbp)
     }
 
   /* Release the mutex.  */
-  pthread_mutex_unlock (&__aio_requests_mutex);
+  __pthread_mutex_unlock (&__aio_requests_mutex);
 
   return result;
 }
-
-#ifndef aio_cancel
-weak_alias (aio_cancel, aio_cancel64)
+#if PTHREAD_IN_LIBC
+# ifndef __aio_cancel
+versioned_symbol (libc, __aio_cancel, aio_cancel, GLIBC_2_34);
+versioned_symbol (libc, __aio_cancel, aio_cancel64, GLIBC_2_34);
+#  if OTHER_SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_34)
+compat_symbol (librt, __aio_cancel, aio_cancel, GLIBC_2_1);
+compat_symbol (librt, __aio_cancel, aio_cancel64, GLIBC_2_1);
+#  endif
+# endif /* __aio_cancel */
+#else /* !PTHREAD_IN_LIBC */
+strong_alias (__aio_cancel, aio_cancel)
+weak_alias (__aio_cancel, aio_cancel64)
 #endif
diff --git a/rt/librt-compat.c b/rt/librt-compat.c
new file mode 100644
index 0000000000..7e5f1db940
--- /dev/null
+++ b/rt/librt-compat.c
@@ -0,0 +1,29 @@
+/* Placeholder definitions to pull in removed symbol versions.
+   Copyright (C) 2021 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#if PTHREAD_IN_LIBC
+# include <shlib-compat.h>
+# include <sys/cdefs.h>
+
+void
+attribute_compat_text_section
+__attribute_used__
+__librt_version_placeholder_1 (void)
+{
+}
+#endif