linux: Move ftrylockfile/_IO_ftrylockfile into libc
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 6 May 2021 19:01:15 +0000 (16:01 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 11 May 2021 02:35:44 +0000 (23:35 -0300)
The nptl version is used as default, since now with symbol always
present the single-thread optimization is tricky.

Hurd is not change, it is used it own lock scheme (which call
 _cthreads_ftrylockfile).

Checked on x86_64-linux-gnu.

32 files changed:
nptl/Makefile
stdio-common/ftrylockfile.c
sysdeps/pthread/ftrylockfile.c [deleted file]
sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
sysdeps/unix/sysv/linux/alpha/libpthread.abilist
sysdeps/unix/sysv/linux/arc/libpthread.abilist
sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
sysdeps/unix/sysv/linux/csky/libpthread.abilist
sysdeps/unix/sysv/linux/hppa/libpthread.abilist
sysdeps/unix/sysv/linux/i386/libpthread.abilist
sysdeps/unix/sysv/linux/ia64/libpthread.abilist
sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
sysdeps/unix/sysv/linux/nios2/libpthread.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist

index bc5824c..64ae682 100644 (file)
@@ -179,7 +179,6 @@ libpthread-routines = \
   cleanup \
   cleanup_defer \
   events \
-  ftrylockfile \
   funlockfile \
   libpthread-compat \
   nptl-init \
index 4f7e2dd..f7e2ef6 100644 (file)
    <https://www.gnu.org/licenses/>.  */
 
 #include <stdio.h>
-
-#undef _IO_ftrylockfile
+#include <stdio-lock.h>
+#include <sys/single_threaded.h>
 
 int
 __ftrylockfile (FILE *stream)
 {
-  /* Do nothing.  Using this version does not do any locking.  */
-  return 1;
+  return _IO_lock_trylock (*stream->_lock);
 }
 weak_alias (__ftrylockfile, ftrylockfile);
 weak_alias (__ftrylockfile, _IO_ftrylockfile)
diff --git a/sysdeps/pthread/ftrylockfile.c b/sysdeps/pthread/ftrylockfile.c
deleted file mode 100644 (file)
index 5138005..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   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/>.  */
-
-#include <errno.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdio-lock.h>
-
-
-int
-__ftrylockfile (FILE *stream)
-{
-  return _IO_lock_trylock (*stream->_lock);
-}
-strong_alias (__ftrylockfile, _IO_ftrylockfile)
-weak_alias (__ftrylockfile, ftrylockfile)
index b5a21ad..ffbd77c 100644 (file)
@@ -1,11 +1,9 @@
-GLIBC_2.17 _IO_ftrylockfile F
 GLIBC_2.17 _IO_funlockfile F
 GLIBC_2.17 __errno_location F
 GLIBC_2.17 __pthread_register_cancel F
 GLIBC_2.17 __pthread_register_cancel_defer F
 GLIBC_2.17 __pthread_unregister_cancel F
 GLIBC_2.17 __pthread_unregister_cancel_restore F
-GLIBC_2.17 ftrylockfile F
 GLIBC_2.17 funlockfile F
 GLIBC_2.17 pthread_attr_getaffinity_np F
 GLIBC_2.17 pthread_attr_getguardsize F
index d88a55c..3110c6d 100644 (file)
@@ -1,7 +1,5 @@
-GLIBC_2.0 _IO_ftrylockfile F
 GLIBC_2.0 _IO_funlockfile F
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 ftrylockfile F
 GLIBC_2.0 funlockfile F
 GLIBC_2.0 pthread_cancel F
 GLIBC_2.0 pthread_create F
index ddda1cb..7de7a48 100644 (file)
@@ -1,11 +1,9 @@
-GLIBC_2.32 _IO_ftrylockfile F
 GLIBC_2.32 _IO_funlockfile F
 GLIBC_2.32 __errno_location F
 GLIBC_2.32 __pthread_register_cancel F
 GLIBC_2.32 __pthread_register_cancel_defer F
 GLIBC_2.32 __pthread_unregister_cancel F
 GLIBC_2.32 __pthread_unregister_cancel_restore F
-GLIBC_2.32 ftrylockfile F
 GLIBC_2.32 funlockfile F
 GLIBC_2.32 pthread_attr_getaffinity_np F
 GLIBC_2.32 pthread_attr_getguardsize F
index ae1defc..3da5d28 100644 (file)
@@ -8,7 +8,6 @@ GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_join F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 pthread_clockjoin_np F
-GLIBC_2.4 _IO_ftrylockfile F
 GLIBC_2.4 _IO_funlockfile F
 GLIBC_2.4 __errno_location F
 GLIBC_2.4 __libpthread_version_placeholder F
@@ -16,7 +15,6 @@ GLIBC_2.4 __pthread_register_cancel F
 GLIBC_2.4 __pthread_register_cancel_defer F
 GLIBC_2.4 __pthread_unregister_cancel F
 GLIBC_2.4 __pthread_unregister_cancel_restore F
-GLIBC_2.4 ftrylockfile F
 GLIBC_2.4 funlockfile F
 GLIBC_2.4 pthread_attr_getaffinity_np F
 GLIBC_2.4 pthread_attr_getguardsize F
index ae1defc..3da5d28 100644 (file)
@@ -8,7 +8,6 @@ GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_join F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 pthread_clockjoin_np F
-GLIBC_2.4 _IO_ftrylockfile F
 GLIBC_2.4 _IO_funlockfile F
 GLIBC_2.4 __errno_location F
 GLIBC_2.4 __libpthread_version_placeholder F
@@ -16,7 +15,6 @@ GLIBC_2.4 __pthread_register_cancel F
 GLIBC_2.4 __pthread_register_cancel_defer F
 GLIBC_2.4 __pthread_unregister_cancel F
 GLIBC_2.4 __pthread_unregister_cancel_restore F
-GLIBC_2.4 ftrylockfile F
 GLIBC_2.4 funlockfile F
 GLIBC_2.4 pthread_attr_getaffinity_np F
 GLIBC_2.4 pthread_attr_getguardsize F
index 760a569..6e86cd9 100644 (file)
@@ -1,11 +1,9 @@
-GLIBC_2.29 _IO_ftrylockfile F
 GLIBC_2.29 _IO_funlockfile F
 GLIBC_2.29 __errno_location F
 GLIBC_2.29 __pthread_register_cancel F
 GLIBC_2.29 __pthread_register_cancel_defer F
 GLIBC_2.29 __pthread_unregister_cancel F
 GLIBC_2.29 __pthread_unregister_cancel_restore F
-GLIBC_2.29 ftrylockfile F
 GLIBC_2.29 funlockfile F
 GLIBC_2.29 pthread_attr_getaffinity_np F
 GLIBC_2.29 pthread_attr_getguardsize F
index 4ff101d..6dbe47e 100644 (file)
@@ -3,10 +3,8 @@ GLIBC_2.12 pthread_getname_np F
 GLIBC_2.12 pthread_setname_np F
 GLIBC_2.18 pthread_getattr_default_np F
 GLIBC_2.18 pthread_setattr_default_np F
-GLIBC_2.2 _IO_ftrylockfile F
 GLIBC_2.2 _IO_funlockfile F
 GLIBC_2.2 __errno_location F
-GLIBC_2.2 ftrylockfile F
 GLIBC_2.2 funlockfile F
 GLIBC_2.2 pthread_attr_getguardsize F
 GLIBC_2.2 pthread_attr_getstack F
index 36d415a..e50fac2 100644 (file)
@@ -1,7 +1,5 @@
-GLIBC_2.0 _IO_ftrylockfile F
 GLIBC_2.0 _IO_funlockfile F
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 ftrylockfile F
 GLIBC_2.0 funlockfile F
 GLIBC_2.0 pthread_cancel F
 GLIBC_2.0 pthread_create F
index 3c59353..c136f64 100644 (file)
@@ -3,10 +3,8 @@ GLIBC_2.12 pthread_getname_np F
 GLIBC_2.12 pthread_setname_np F
 GLIBC_2.18 pthread_getattr_default_np F
 GLIBC_2.18 pthread_setattr_default_np F
-GLIBC_2.2 _IO_ftrylockfile F
 GLIBC_2.2 _IO_funlockfile F
 GLIBC_2.2 __errno_location F
-GLIBC_2.2 ftrylockfile F
 GLIBC_2.2 funlockfile F
 GLIBC_2.2 pthread_attr_getguardsize F
 GLIBC_2.2 pthread_attr_getstack F
index ae1defc..3da5d28 100644 (file)
@@ -8,7 +8,6 @@ GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_join F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 pthread_clockjoin_np F
-GLIBC_2.4 _IO_ftrylockfile F
 GLIBC_2.4 _IO_funlockfile F
 GLIBC_2.4 __errno_location F
 GLIBC_2.4 __libpthread_version_placeholder F
@@ -16,7 +15,6 @@ GLIBC_2.4 __pthread_register_cancel F
 GLIBC_2.4 __pthread_register_cancel_defer F
 GLIBC_2.4 __pthread_unregister_cancel F
 GLIBC_2.4 __pthread_unregister_cancel_restore F
-GLIBC_2.4 ftrylockfile F
 GLIBC_2.4 funlockfile F
 GLIBC_2.4 pthread_attr_getaffinity_np F
 GLIBC_2.4 pthread_attr_getguardsize F
index 36d415a..e50fac2 100644 (file)
@@ -1,7 +1,5 @@
-GLIBC_2.0 _IO_ftrylockfile F
 GLIBC_2.0 _IO_funlockfile F
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 ftrylockfile F
 GLIBC_2.0 funlockfile F
 GLIBC_2.0 pthread_cancel F
 GLIBC_2.0 pthread_create F
index 5c6c7b2..fd9fa8e 100644 (file)
@@ -1,11 +1,9 @@
-GLIBC_2.18 _IO_ftrylockfile F
 GLIBC_2.18 _IO_funlockfile F
 GLIBC_2.18 __errno_location F
 GLIBC_2.18 __pthread_register_cancel F
 GLIBC_2.18 __pthread_register_cancel_defer F
 GLIBC_2.18 __pthread_unregister_cancel F
 GLIBC_2.18 __pthread_unregister_cancel_restore F
-GLIBC_2.18 ftrylockfile F
 GLIBC_2.18 funlockfile F
 GLIBC_2.18 pthread_attr_getaffinity_np F
 GLIBC_2.18 pthread_attr_getguardsize F
index 5c6c7b2..fd9fa8e 100644 (file)
@@ -1,11 +1,9 @@
-GLIBC_2.18 _IO_ftrylockfile F
 GLIBC_2.18 _IO_funlockfile F
 GLIBC_2.18 __errno_location F
 GLIBC_2.18 __pthread_register_cancel F
 GLIBC_2.18 __pthread_register_cancel_defer F
 GLIBC_2.18 __pthread_unregister_cancel F
 GLIBC_2.18 __pthread_unregister_cancel_restore F
-GLIBC_2.18 ftrylockfile F
 GLIBC_2.18 funlockfile F
 GLIBC_2.18 pthread_attr_getaffinity_np F
 GLIBC_2.18 pthread_attr_getguardsize F
index 1d36022..a607c10 100644 (file)
@@ -1,7 +1,5 @@
-GLIBC_2.0 _IO_ftrylockfile F
 GLIBC_2.0 _IO_funlockfile F
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 ftrylockfile F
 GLIBC_2.0 funlockfile F
 GLIBC_2.0 pthread_cancel F
 GLIBC_2.0 pthread_create F
index 1d36022..a607c10 100644 (file)
@@ -1,7 +1,5 @@
-GLIBC_2.0 _IO_ftrylockfile F
 GLIBC_2.0 _IO_funlockfile F
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 ftrylockfile F
 GLIBC_2.0 funlockfile F
 GLIBC_2.0 pthread_cancel F
 GLIBC_2.0 pthread_create F
index 5611822..bfaf7b1 100644 (file)
@@ -1,11 +1,9 @@
-GLIBC_2.21 _IO_ftrylockfile F
 GLIBC_2.21 _IO_funlockfile F
 GLIBC_2.21 __errno_location F
 GLIBC_2.21 __pthread_register_cancel F
 GLIBC_2.21 __pthread_register_cancel_defer F
 GLIBC_2.21 __pthread_unregister_cancel F
 GLIBC_2.21 __pthread_unregister_cancel_restore F
-GLIBC_2.21 ftrylockfile F
 GLIBC_2.21 funlockfile F
 GLIBC_2.21 pthread_attr_getaffinity_np F
 GLIBC_2.21 pthread_attr_getguardsize F
index aa24808..b7292ba 100644 (file)
@@ -1,7 +1,5 @@
-GLIBC_2.0 _IO_ftrylockfile F
 GLIBC_2.0 _IO_funlockfile F
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 ftrylockfile F
 GLIBC_2.0 funlockfile F
 GLIBC_2.0 pthread_cancel F
 GLIBC_2.0 pthread_create F
index 5f5abda..ddd982e 100644 (file)
@@ -6,10 +6,8 @@ GLIBC_2.18 pthread_setattr_default_np F
 GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_join F
-GLIBC_2.3 _IO_ftrylockfile F
 GLIBC_2.3 _IO_funlockfile F
 GLIBC_2.3 __errno_location F
-GLIBC_2.3 ftrylockfile F
 GLIBC_2.3 funlockfile F
 GLIBC_2.3 pthread_attr_getguardsize F
 GLIBC_2.3 pthread_attr_getstack F
index b5a21ad..ffbd77c 100644 (file)
@@ -1,11 +1,9 @@
-GLIBC_2.17 _IO_ftrylockfile F
 GLIBC_2.17 _IO_funlockfile F
 GLIBC_2.17 __errno_location F
 GLIBC_2.17 __pthread_register_cancel F
 GLIBC_2.17 __pthread_register_cancel_defer F
 GLIBC_2.17 __pthread_unregister_cancel F
 GLIBC_2.17 __pthread_unregister_cancel_restore F
-GLIBC_2.17 ftrylockfile F
 GLIBC_2.17 funlockfile F
 GLIBC_2.17 pthread_attr_getaffinity_np F
 GLIBC_2.17 pthread_attr_getguardsize F
index f0493d8..2f492d0 100644 (file)
@@ -1,11 +1,9 @@
-GLIBC_2.33 _IO_ftrylockfile F
 GLIBC_2.33 _IO_funlockfile F
 GLIBC_2.33 __errno_location F
 GLIBC_2.33 __pthread_register_cancel F
 GLIBC_2.33 __pthread_register_cancel_defer F
 GLIBC_2.33 __pthread_unregister_cancel F
 GLIBC_2.33 __pthread_unregister_cancel_restore F
-GLIBC_2.33 ftrylockfile F
 GLIBC_2.33 funlockfile F
 GLIBC_2.33 pthread_attr_getaffinity_np F
 GLIBC_2.33 pthread_attr_getguardsize F
index c027988..53363c9 100644 (file)
@@ -1,11 +1,9 @@
-GLIBC_2.27 _IO_ftrylockfile F
 GLIBC_2.27 _IO_funlockfile F
 GLIBC_2.27 __errno_location F
 GLIBC_2.27 __pthread_register_cancel F
 GLIBC_2.27 __pthread_register_cancel_defer F
 GLIBC_2.27 __pthread_unregister_cancel F
 GLIBC_2.27 __pthread_unregister_cancel_restore F
-GLIBC_2.27 ftrylockfile F
 GLIBC_2.27 funlockfile F
 GLIBC_2.27 pthread_attr_getaffinity_np F
 GLIBC_2.27 pthread_attr_getguardsize F
index 286aedf..0a2a1ea 100644 (file)
@@ -1,7 +1,5 @@
-GLIBC_2.0 _IO_ftrylockfile F
 GLIBC_2.0 _IO_funlockfile F
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 ftrylockfile F
 GLIBC_2.0 funlockfile F
 GLIBC_2.0 pthread_cancel F
 GLIBC_2.0 pthread_create F
index 35248d9..d105c7f 100644 (file)
@@ -4,10 +4,8 @@ GLIBC_2.12 pthread_setname_np F
 GLIBC_2.18 pthread_getattr_default_np F
 GLIBC_2.18 pthread_setattr_default_np F
 GLIBC_2.19 __libpthread_version_placeholder F
-GLIBC_2.2 _IO_ftrylockfile F
 GLIBC_2.2 _IO_funlockfile F
 GLIBC_2.2 __errno_location F
-GLIBC_2.2 ftrylockfile F
 GLIBC_2.2 funlockfile F
 GLIBC_2.2 pthread_attr_getguardsize F
 GLIBC_2.2 pthread_attr_getstack F
index 4ff101d..6dbe47e 100644 (file)
@@ -3,10 +3,8 @@ GLIBC_2.12 pthread_getname_np F
 GLIBC_2.12 pthread_setname_np F
 GLIBC_2.18 pthread_getattr_default_np F
 GLIBC_2.18 pthread_setattr_default_np F
-GLIBC_2.2 _IO_ftrylockfile F
 GLIBC_2.2 _IO_funlockfile F
 GLIBC_2.2 __errno_location F
-GLIBC_2.2 ftrylockfile F
 GLIBC_2.2 funlockfile F
 GLIBC_2.2 pthread_attr_getguardsize F
 GLIBC_2.2 pthread_attr_getstack F
index 4ff101d..6dbe47e 100644 (file)
@@ -3,10 +3,8 @@ GLIBC_2.12 pthread_getname_np F
 GLIBC_2.12 pthread_setname_np F
 GLIBC_2.18 pthread_getattr_default_np F
 GLIBC_2.18 pthread_setattr_default_np F
-GLIBC_2.2 _IO_ftrylockfile F
 GLIBC_2.2 _IO_funlockfile F
 GLIBC_2.2 __errno_location F
-GLIBC_2.2 ftrylockfile F
 GLIBC_2.2 funlockfile F
 GLIBC_2.2 pthread_attr_getguardsize F
 GLIBC_2.2 pthread_attr_getstack F
index d88a55c..3110c6d 100644 (file)
@@ -1,7 +1,5 @@
-GLIBC_2.0 _IO_ftrylockfile F
 GLIBC_2.0 _IO_funlockfile F
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 ftrylockfile F
 GLIBC_2.0 funlockfile F
 GLIBC_2.0 pthread_cancel F
 GLIBC_2.0 pthread_create F
index 3c59353..c136f64 100644 (file)
@@ -3,10 +3,8 @@ GLIBC_2.12 pthread_getname_np F
 GLIBC_2.12 pthread_setname_np F
 GLIBC_2.18 pthread_getattr_default_np F
 GLIBC_2.18 pthread_setattr_default_np F
-GLIBC_2.2 _IO_ftrylockfile F
 GLIBC_2.2 _IO_funlockfile F
 GLIBC_2.2 __errno_location F
-GLIBC_2.2 ftrylockfile F
 GLIBC_2.2 funlockfile F
 GLIBC_2.2 pthread_attr_getguardsize F
 GLIBC_2.2 pthread_attr_getstack F
index 732e551..25f5947 100644 (file)
@@ -3,10 +3,8 @@ GLIBC_2.12 pthread_getname_np F
 GLIBC_2.12 pthread_setname_np F
 GLIBC_2.18 pthread_getattr_default_np F
 GLIBC_2.18 pthread_setattr_default_np F
-GLIBC_2.2.5 _IO_ftrylockfile F
 GLIBC_2.2.5 _IO_funlockfile F
 GLIBC_2.2.5 __errno_location F
-GLIBC_2.2.5 ftrylockfile F
 GLIBC_2.2.5 funlockfile F
 GLIBC_2.2.5 pthread_attr_getguardsize F
 GLIBC_2.2.5 pthread_attr_getstack F
index 22262d9..0fba7f1 100644 (file)
@@ -1,11 +1,9 @@
-GLIBC_2.16 _IO_ftrylockfile F
 GLIBC_2.16 _IO_funlockfile F
 GLIBC_2.16 __errno_location F
 GLIBC_2.16 __pthread_register_cancel F
 GLIBC_2.16 __pthread_register_cancel_defer F
 GLIBC_2.16 __pthread_unregister_cancel F
 GLIBC_2.16 __pthread_unregister_cancel_restore F
-GLIBC_2.16 ftrylockfile F
 GLIBC_2.16 funlockfile F
 GLIBC_2.16 pthread_attr_getaffinity_np F
 GLIBC_2.16 pthread_attr_getguardsize F