From 3df6dcc5c75b40d0ac0a9d22967da0a5a2b8df5c Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 25 Jun 2021 10:30:36 +0200 Subject: 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 : --- rt/Makefile | 5 ++++- rt/Versions | 6 ++++++ rt/aio_cancel.c | 28 +++++++++++++++++++--------- rt/librt-compat.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 rt/librt-compat.c (limited to 'rt') 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 #include +#include 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 + . */ + +#if PTHREAD_IN_LIBC +# include +# include + +void +attribute_compat_text_section +__attribute_used__ +__librt_version_placeholder_1 (void) +{ +} +#endif -- cgit 1.4.1