From patchwork Mon May 10 17:04:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 43317 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0F2D7397282D; Mon, 10 May 2021 17:04:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F2D7397282D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620666276; bh=z8LhJJGLXLhji73MHy9xe0gfi+OiTqblBp6uudxRj9E=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=PY7C1c6jhdHKvLkeKl01lV6gAP/q5IrbzOujwuXwPIaS5m3bkwQ2Bf+C46x4bibcY /+7M5hFrVToXCZ0DS4VLzZCA8CivzPXwa4MwiQKWSTZBHHw0ZEyLQJnESL8hbuIQPn og9o1OneraHrF58yWfGfDM2wM7+GZ6Ln48ACuGKY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by sourceware.org (Postfix) with ESMTPS id E9459385740D for ; Mon, 10 May 2021 17:04:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E9459385740D Received: by mail-qv1-xf2f.google.com with SMTP id 5so4755521qvk.0 for ; Mon, 10 May 2021 10:04:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=z8LhJJGLXLhji73MHy9xe0gfi+OiTqblBp6uudxRj9E=; b=Ioe4PFOX4bgtxysIBd4+AGkKgd9qTtMnr33KmqVB6i9AyDpvb+Aoqt5AbfN2m6YNBZ /HIpuzZtXOBdAjZmYd5+VLo9+jPQIUc4vSGCyB/c3oodhMuPJsjFUmAqcCS2O9mODsZx 3gYvOUUKGDmxi/oR5d3CzigH+DpbZBDs3gKenID7cOX4dB3GGtUoivCTVwmoD92LotOS f9sXGsXRbXyzHYeLounVuKZK0M5CzjRi0/i8AqbR1YVW5zDrGa9c8NS4/w+U0oZ/DDwB KsBOgPyhxsmOYO1ERcdcfM0fNZ3e717suG5IDAhJ6sVbtw1zrFKdj4qgxXV9q/RTD7wH RK2g== X-Gm-Message-State: AOAM530wueSw9V76fcugYmXVqXQ4uLlYMLFtjXqao3b/ALcZL/EoAxSd 4bQwNkmF0FGoY3NtLws/Huc3cc1UKUtpWg== X-Google-Smtp-Source: ABdhPJwfHDIaNT9dG8VRXErM3Ee3spngsjtICFffo0BOlwt8EEhfuJXPA8TGPLCwxP76eO6RL4YNAg== X-Received: by 2002:a0c:c447:: with SMTP id t7mr24826731qvi.60.1620666271024; Mon, 10 May 2021 10:04:31 -0700 (PDT) Received: from birita.. ([177.194.37.86]) by smtp.googlemail.com with ESMTPSA id g64sm11780564qkf.41.2021.05.10.10.04.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 10:04:30 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 1/4] linux: Move flockfile/_IO_flockfile into libc Date: Mon, 10 May 2021 14:04:23 -0300 Message-Id: <20210510170426.2533768-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" 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_flockfile). Checked on x86_64-linux-gnu. --- nptl/Makefile | 2 -- stdio-common/flockfile.c | 6 ++-- sysdeps/pthread/flockfile.c | 31 ------------------- .../sysv/linux/aarch64/libpthread.abilist | 2 -- .../unix/sysv/linux/alpha/libpthread.abilist | 2 -- .../unix/sysv/linux/arc/libpthread.abilist | 2 -- .../unix/sysv/linux/arm/be/libpthread.abilist | 2 -- .../unix/sysv/linux/arm/le/libpthread.abilist | 2 -- .../unix/sysv/linux/csky/libpthread.abilist | 2 -- .../unix/sysv/linux/hppa/libpthread.abilist | 2 -- .../unix/sysv/linux/i386/libpthread.abilist | 2 -- .../unix/sysv/linux/ia64/libpthread.abilist | 2 -- .../linux/m68k/coldfire/libpthread.abilist | 2 -- .../sysv/linux/m68k/m680x0/libpthread.abilist | 2 -- .../linux/microblaze/be/libpthread.abilist | 2 -- .../linux/microblaze/le/libpthread.abilist | 2 -- .../sysv/linux/mips/mips32/libpthread.abilist | 2 -- .../sysv/linux/mips/mips64/libpthread.abilist | 2 -- .../unix/sysv/linux/nios2/libpthread.abilist | 2 -- .../powerpc/powerpc32/libpthread.abilist | 2 -- .../powerpc/powerpc64/be/libpthread.abilist | 2 -- .../powerpc/powerpc64/le/libpthread.abilist | 2 -- .../sysv/linux/riscv/rv32/libpthread.abilist | 2 -- .../sysv/linux/riscv/rv64/libpthread.abilist | 2 -- .../linux/s390/s390-32/libpthread.abilist | 2 -- .../linux/s390/s390-64/libpthread.abilist | 2 -- .../unix/sysv/linux/sh/be/libpthread.abilist | 2 -- .../unix/sysv/linux/sh/le/libpthread.abilist | 2 -- .../linux/sparc/sparc32/libpthread.abilist | 2 -- .../linux/sparc/sparc64/libpthread.abilist | 2 -- .../sysv/linux/x86_64/64/libpthread.abilist | 2 -- .../sysv/linux/x86_64/x32/libpthread.abilist | 2 -- 32 files changed, 3 insertions(+), 94 deletions(-) delete mode 100644 sysdeps/pthread/flockfile.c diff --git a/nptl/Makefile b/nptl/Makefile index f7723cb808..bc5824cd8e 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -179,7 +179,6 @@ libpthread-routines = \ cleanup \ cleanup_defer \ events \ - flockfile \ ftrylockfile \ funlockfile \ libpthread-compat \ @@ -447,7 +446,6 @@ extra-objs += $(crti-objs) $(crtn-objs) extra-objs += pt-crti.o endif -CFLAGS-flockfile.c += $(libio-mtsafe) CFLAGS-ftrylockfile.c += $(libio-mtsafe) CFLAGS-funlockfile.c += $(libio-mtsafe) diff --git a/stdio-common/flockfile.c b/stdio-common/flockfile.c index 0bc856a465..a66e0a731e 100644 --- a/stdio-common/flockfile.c +++ b/stdio-common/flockfile.c @@ -17,13 +17,13 @@ . */ #include - -#undef _IO_flockfile +#include void __flockfile (FILE *stream) { - /* Do nothing. Using this version does not do any locking. */ + stream->_flags2 |= _IO_FLAGS2_NEED_LOCK; + _IO_lock_lock (*stream->_lock); } weak_alias (__flockfile, flockfile); weak_alias (__flockfile, _IO_flockfile) diff --git a/sysdeps/pthread/flockfile.c b/sysdeps/pthread/flockfile.c deleted file mode 100644 index c67d6c8535..0000000000 --- a/sysdeps/pthread/flockfile.c +++ /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 , 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 - . */ - -#include -#include -#include - - -void -__flockfile (FILE *stream) -{ - stream->_flags2 |= _IO_FLAGS2_NEED_LOCK; - _IO_lock_lock (*stream->_lock); -} -strong_alias (__flockfile, _IO_flockfile) -weak_alias (__flockfile, flockfile) diff --git a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist index b4f0fdd999..b5a21ad7cd 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist @@ -1,4 +1,3 @@ -GLIBC_2.17 _IO_flockfile F GLIBC_2.17 _IO_ftrylockfile F GLIBC_2.17 _IO_funlockfile F GLIBC_2.17 __errno_location F @@ -6,7 +5,6 @@ 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 flockfile F GLIBC_2.17 ftrylockfile F GLIBC_2.17 funlockfile F GLIBC_2.17 pthread_attr_getaffinity_np F diff --git a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist index c2017537e2..d88a55c5dc 100644 --- a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist @@ -1,8 +1,6 @@ -GLIBC_2.0 _IO_flockfile F GLIBC_2.0 _IO_ftrylockfile F GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 flockfile F GLIBC_2.0 ftrylockfile F GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F diff --git a/sysdeps/unix/sysv/linux/arc/libpthread.abilist b/sysdeps/unix/sysv/linux/arc/libpthread.abilist index bc072be61f..ddda1cb0b8 100644 --- a/sysdeps/unix/sysv/linux/arc/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/arc/libpthread.abilist @@ -1,4 +1,3 @@ -GLIBC_2.32 _IO_flockfile F GLIBC_2.32 _IO_ftrylockfile F GLIBC_2.32 _IO_funlockfile F GLIBC_2.32 __errno_location F @@ -6,7 +5,6 @@ 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 flockfile F GLIBC_2.32 ftrylockfile F GLIBC_2.32 funlockfile F GLIBC_2.32 pthread_attr_getaffinity_np F diff --git a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist index 5b52c456fb..ae1defcddc 100644 --- a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist @@ -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_flockfile F GLIBC_2.4 _IO_ftrylockfile F GLIBC_2.4 _IO_funlockfile F GLIBC_2.4 __errno_location F @@ -17,7 +16,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 flockfile F GLIBC_2.4 ftrylockfile F GLIBC_2.4 funlockfile F GLIBC_2.4 pthread_attr_getaffinity_np F diff --git a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist index 5b52c456fb..ae1defcddc 100644 --- a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist @@ -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_flockfile F GLIBC_2.4 _IO_ftrylockfile F GLIBC_2.4 _IO_funlockfile F GLIBC_2.4 __errno_location F @@ -17,7 +16,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 flockfile F GLIBC_2.4 ftrylockfile F GLIBC_2.4 funlockfile F GLIBC_2.4 pthread_attr_getaffinity_np F diff --git a/sysdeps/unix/sysv/linux/csky/libpthread.abilist b/sysdeps/unix/sysv/linux/csky/libpthread.abilist index d55f09a9fe..760a569b51 100644 --- a/sysdeps/unix/sysv/linux/csky/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/csky/libpthread.abilist @@ -1,4 +1,3 @@ -GLIBC_2.29 _IO_flockfile F GLIBC_2.29 _IO_ftrylockfile F GLIBC_2.29 _IO_funlockfile F GLIBC_2.29 __errno_location F @@ -6,7 +5,6 @@ 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 flockfile F GLIBC_2.29 ftrylockfile F GLIBC_2.29 funlockfile F GLIBC_2.29 pthread_attr_getaffinity_np F diff --git a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist index 2c4a7041b6..4ff101d7f2 100644 --- a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist @@ -3,11 +3,9 @@ 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_flockfile F GLIBC_2.2 _IO_ftrylockfile F GLIBC_2.2 _IO_funlockfile F GLIBC_2.2 __errno_location F -GLIBC_2.2 flockfile F GLIBC_2.2 ftrylockfile F GLIBC_2.2 funlockfile F GLIBC_2.2 pthread_attr_getguardsize F diff --git a/sysdeps/unix/sysv/linux/i386/libpthread.abilist b/sysdeps/unix/sysv/linux/i386/libpthread.abilist index 1cbc49b937..36d415aef5 100644 --- a/sysdeps/unix/sysv/linux/i386/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/i386/libpthread.abilist @@ -1,8 +1,6 @@ -GLIBC_2.0 _IO_flockfile F GLIBC_2.0 _IO_ftrylockfile F GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 flockfile F GLIBC_2.0 ftrylockfile F GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F diff --git a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist index 6b87a988d4..3c59353815 100644 --- a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist @@ -3,11 +3,9 @@ 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_flockfile F GLIBC_2.2 _IO_ftrylockfile F GLIBC_2.2 _IO_funlockfile F GLIBC_2.2 __errno_location F -GLIBC_2.2 flockfile F GLIBC_2.2 ftrylockfile F GLIBC_2.2 funlockfile F GLIBC_2.2 pthread_attr_getguardsize F diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist index 5b52c456fb..ae1defcddc 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist @@ -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_flockfile F GLIBC_2.4 _IO_ftrylockfile F GLIBC_2.4 _IO_funlockfile F GLIBC_2.4 __errno_location F @@ -17,7 +16,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 flockfile F GLIBC_2.4 ftrylockfile F GLIBC_2.4 funlockfile F GLIBC_2.4 pthread_attr_getaffinity_np F diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist index 1cbc49b937..36d415aef5 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist @@ -1,8 +1,6 @@ -GLIBC_2.0 _IO_flockfile F GLIBC_2.0 _IO_ftrylockfile F GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 flockfile F GLIBC_2.0 ftrylockfile F GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist index ee29730057..5c6c7b229c 100644 --- a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist @@ -1,4 +1,3 @@ -GLIBC_2.18 _IO_flockfile F GLIBC_2.18 _IO_ftrylockfile F GLIBC_2.18 _IO_funlockfile F GLIBC_2.18 __errno_location F @@ -6,7 +5,6 @@ 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 flockfile F GLIBC_2.18 ftrylockfile F GLIBC_2.18 funlockfile F GLIBC_2.18 pthread_attr_getaffinity_np F diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist index ee29730057..5c6c7b229c 100644 --- a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist @@ -1,4 +1,3 @@ -GLIBC_2.18 _IO_flockfile F GLIBC_2.18 _IO_ftrylockfile F GLIBC_2.18 _IO_funlockfile F GLIBC_2.18 __errno_location F @@ -6,7 +5,6 @@ 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 flockfile F GLIBC_2.18 ftrylockfile F GLIBC_2.18 funlockfile F GLIBC_2.18 pthread_attr_getaffinity_np F diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist index e523996633..1d36022ee2 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist @@ -1,8 +1,6 @@ -GLIBC_2.0 _IO_flockfile F GLIBC_2.0 _IO_ftrylockfile F GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 flockfile F GLIBC_2.0 ftrylockfile F GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist index e523996633..1d36022ee2 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist @@ -1,8 +1,6 @@ -GLIBC_2.0 _IO_flockfile F GLIBC_2.0 _IO_ftrylockfile F GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 flockfile F GLIBC_2.0 ftrylockfile F GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F diff --git a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist index 059b21f854..5611822c38 100644 --- a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist @@ -1,4 +1,3 @@ -GLIBC_2.21 _IO_flockfile F GLIBC_2.21 _IO_ftrylockfile F GLIBC_2.21 _IO_funlockfile F GLIBC_2.21 __errno_location F @@ -6,7 +5,6 @@ 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 flockfile F GLIBC_2.21 ftrylockfile F GLIBC_2.21 funlockfile F GLIBC_2.21 pthread_attr_getaffinity_np F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist index 84312f522b..aa24808b1e 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist @@ -1,8 +1,6 @@ -GLIBC_2.0 _IO_flockfile F GLIBC_2.0 _IO_ftrylockfile F GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 flockfile F GLIBC_2.0 ftrylockfile F GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist index 2d5583ebe8..5f5abdae73 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist @@ -6,11 +6,9 @@ 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_flockfile F GLIBC_2.3 _IO_ftrylockfile F GLIBC_2.3 _IO_funlockfile F GLIBC_2.3 __errno_location F -GLIBC_2.3 flockfile F GLIBC_2.3 ftrylockfile F GLIBC_2.3 funlockfile F GLIBC_2.3 pthread_attr_getguardsize F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist index b4f0fdd999..b5a21ad7cd 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist @@ -1,4 +1,3 @@ -GLIBC_2.17 _IO_flockfile F GLIBC_2.17 _IO_ftrylockfile F GLIBC_2.17 _IO_funlockfile F GLIBC_2.17 __errno_location F @@ -6,7 +5,6 @@ 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 flockfile F GLIBC_2.17 ftrylockfile F GLIBC_2.17 funlockfile F GLIBC_2.17 pthread_attr_getaffinity_np F diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist index cc35881f1a..f0493d8973 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist @@ -1,4 +1,3 @@ -GLIBC_2.33 _IO_flockfile F GLIBC_2.33 _IO_ftrylockfile F GLIBC_2.33 _IO_funlockfile F GLIBC_2.33 __errno_location F @@ -6,7 +5,6 @@ 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 flockfile F GLIBC_2.33 ftrylockfile F GLIBC_2.33 funlockfile F GLIBC_2.33 pthread_attr_getaffinity_np F diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist index 6946ced1b9..c0279888a0 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist @@ -1,4 +1,3 @@ -GLIBC_2.27 _IO_flockfile F GLIBC_2.27 _IO_ftrylockfile F GLIBC_2.27 _IO_funlockfile F GLIBC_2.27 __errno_location F @@ -6,7 +5,6 @@ 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 flockfile F GLIBC_2.27 ftrylockfile F GLIBC_2.27 funlockfile F GLIBC_2.27 pthread_attr_getaffinity_np F diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist index 0c6df4a437..286aedf9ca 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist @@ -1,8 +1,6 @@ -GLIBC_2.0 _IO_flockfile F GLIBC_2.0 _IO_ftrylockfile F GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 flockfile F GLIBC_2.0 ftrylockfile F GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist index d287d8fe7a..35248d9303 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist @@ -4,11 +4,9 @@ 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_flockfile F GLIBC_2.2 _IO_ftrylockfile F GLIBC_2.2 _IO_funlockfile F GLIBC_2.2 __errno_location F -GLIBC_2.2 flockfile F GLIBC_2.2 ftrylockfile F GLIBC_2.2 funlockfile F GLIBC_2.2 pthread_attr_getguardsize F diff --git a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist index 2c4a7041b6..4ff101d7f2 100644 --- a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist @@ -3,11 +3,9 @@ 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_flockfile F GLIBC_2.2 _IO_ftrylockfile F GLIBC_2.2 _IO_funlockfile F GLIBC_2.2 __errno_location F -GLIBC_2.2 flockfile F GLIBC_2.2 ftrylockfile F GLIBC_2.2 funlockfile F GLIBC_2.2 pthread_attr_getguardsize F diff --git a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist index 2c4a7041b6..4ff101d7f2 100644 --- a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist @@ -3,11 +3,9 @@ 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_flockfile F GLIBC_2.2 _IO_ftrylockfile F GLIBC_2.2 _IO_funlockfile F GLIBC_2.2 __errno_location F -GLIBC_2.2 flockfile F GLIBC_2.2 ftrylockfile F GLIBC_2.2 funlockfile F GLIBC_2.2 pthread_attr_getguardsize F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist index c2017537e2..d88a55c5dc 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist @@ -1,8 +1,6 @@ -GLIBC_2.0 _IO_flockfile F GLIBC_2.0 _IO_ftrylockfile F GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 flockfile F GLIBC_2.0 ftrylockfile F GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist index 6b87a988d4..3c59353815 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist @@ -3,11 +3,9 @@ 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_flockfile F GLIBC_2.2 _IO_ftrylockfile F GLIBC_2.2 _IO_funlockfile F GLIBC_2.2 __errno_location F -GLIBC_2.2 flockfile F GLIBC_2.2 ftrylockfile F GLIBC_2.2 funlockfile F GLIBC_2.2 pthread_attr_getguardsize F diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist index cea092874a..732e55148d 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist @@ -3,11 +3,9 @@ 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_flockfile 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 flockfile F GLIBC_2.2.5 ftrylockfile F GLIBC_2.2.5 funlockfile F GLIBC_2.2.5 pthread_attr_getguardsize F diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist index 394748f198..22262d9ceb 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist @@ -1,4 +1,3 @@ -GLIBC_2.16 _IO_flockfile F GLIBC_2.16 _IO_ftrylockfile F GLIBC_2.16 _IO_funlockfile F GLIBC_2.16 __errno_location F @@ -6,7 +5,6 @@ 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 flockfile F GLIBC_2.16 ftrylockfile F GLIBC_2.16 funlockfile F GLIBC_2.16 pthread_attr_getaffinity_np F From patchwork Mon May 10 17:04:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 43318 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9DCE23857439; Mon, 10 May 2021 17:04:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DCE23857439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620666277; bh=5q0ApDlsCKulAoN15Z5P+smWTn8xg8AmneZ23sHUaEY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=SaHy25OQAwgANH14oJRTd2A41QgT/PGEHfvPH4E08ehdFflO4KRAaeebQYdpulkKC qmvU6FCE/MCLS2Z2HzrAXhCngjJJwohL4gCbBHrkYO9H9bbn7pPvfUSRqA5NUSl8Mj 3LlMrkt9/MG9frqhFEWeASXg+6D92xxFz0ddy0J8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) by sourceware.org (Postfix) with ESMTPS id 40CB03857439 for ; Mon, 10 May 2021 17:04:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 40CB03857439 Received: by mail-qv1-xf2c.google.com with SMTP id h1so8702300qvv.10 for ; Mon, 10 May 2021 10:04:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5q0ApDlsCKulAoN15Z5P+smWTn8xg8AmneZ23sHUaEY=; b=euffuGMYreBi2ENs2U94V4yXKYhN1bqyIpmMcSl06/+ONuEC6qapYaGO56etVwMRss +vEbPpoUQL2iE7CCFp847pw0ZCR4oMECH12rYLjNqQXLni6vpXz6NHyMhE7VNF/p10Qa JSUp92C6ZwrYUzwI6APyEjjDRurhfXvGYLnYPOOO2+mb4SzVgCPV3PwS4KYuMsl3bGIN FxjHXUHgp/KKKKAvGivUodSzenWXcK8Bl7u/uOW3S4q2ara2ald0y+YxrGSbyk2BMKKs FjRnBvV2si4r+vbXzMgPG6AI1fgkvmLQZNhDm8nJE2hz1G4v9uPUC8qMNoSUha23313o rZKg== X-Gm-Message-State: AOAM533jL9n2LlVIqbPdH5iH5fuDK9QhrJw6V7peDwybM3pLZ3BHN6Z2 VuQRaTGuNXF9u/L8Pbv5IBAIT6/LdiHDkA== X-Google-Smtp-Source: ABdhPJwO1vS0I80ZTpDxe6bfuH4C6/ZKfftuS8FjZP4SqRsSyhVm5QRG7z3JSsSJRMeilOdDC72nVw== X-Received: by 2002:a0c:e601:: with SMTP id z1mr24655702qvm.62.1620666272379; Mon, 10 May 2021 10:04:32 -0700 (PDT) Received: from birita.. ([177.194.37.86]) by smtp.googlemail.com with ESMTPSA id g64sm11780564qkf.41.2021.05.10.10.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 10:04:32 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 2/4] linux: Move ftrylockfile/_IO_ftrylockfile into libc Date: Mon, 10 May 2021 14:04:24 -0300 Message-Id: <20210510170426.2533768-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210510170426.2533768-1-adhemerval.zanella@linaro.org> References: <20210510170426.2533768-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" 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. --- nptl/Makefile | 1 - stdio-common/ftrylockfile.c | 7 ++--- sysdeps/pthread/ftrylockfile.c | 31 ------------------- .../sysv/linux/aarch64/libpthread.abilist | 2 -- .../unix/sysv/linux/alpha/libpthread.abilist | 2 -- .../unix/sysv/linux/arc/libpthread.abilist | 2 -- .../unix/sysv/linux/arm/be/libpthread.abilist | 2 -- .../unix/sysv/linux/arm/le/libpthread.abilist | 2 -- .../unix/sysv/linux/csky/libpthread.abilist | 2 -- .../unix/sysv/linux/hppa/libpthread.abilist | 2 -- .../unix/sysv/linux/i386/libpthread.abilist | 2 -- .../unix/sysv/linux/ia64/libpthread.abilist | 2 -- .../linux/m68k/coldfire/libpthread.abilist | 2 -- .../sysv/linux/m68k/m680x0/libpthread.abilist | 2 -- .../linux/microblaze/be/libpthread.abilist | 2 -- .../linux/microblaze/le/libpthread.abilist | 2 -- .../sysv/linux/mips/mips32/libpthread.abilist | 2 -- .../sysv/linux/mips/mips64/libpthread.abilist | 2 -- .../unix/sysv/linux/nios2/libpthread.abilist | 2 -- .../powerpc/powerpc32/libpthread.abilist | 2 -- .../powerpc/powerpc64/be/libpthread.abilist | 2 -- .../powerpc/powerpc64/le/libpthread.abilist | 2 -- .../sysv/linux/riscv/rv32/libpthread.abilist | 2 -- .../sysv/linux/riscv/rv64/libpthread.abilist | 2 -- .../linux/s390/s390-32/libpthread.abilist | 2 -- .../linux/s390/s390-64/libpthread.abilist | 2 -- .../unix/sysv/linux/sh/be/libpthread.abilist | 2 -- .../unix/sysv/linux/sh/le/libpthread.abilist | 2 -- .../linux/sparc/sparc32/libpthread.abilist | 2 -- .../linux/sparc/sparc64/libpthread.abilist | 2 -- .../sysv/linux/x86_64/64/libpthread.abilist | 2 -- .../sysv/linux/x86_64/x32/libpthread.abilist | 2 -- 32 files changed, 3 insertions(+), 94 deletions(-) delete mode 100644 sysdeps/pthread/ftrylockfile.c diff --git a/nptl/Makefile b/nptl/Makefile index bc5824cd8e..64ae68238d 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -179,7 +179,6 @@ libpthread-routines = \ cleanup \ cleanup_defer \ events \ - ftrylockfile \ funlockfile \ libpthread-compat \ nptl-init \ diff --git a/stdio-common/ftrylockfile.c b/stdio-common/ftrylockfile.c index 4f7e2dd617..f7e2ef6137 100644 --- a/stdio-common/ftrylockfile.c +++ b/stdio-common/ftrylockfile.c @@ -17,14 +17,13 @@ . */ #include - -#undef _IO_ftrylockfile +#include +#include 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 index 5138005bdc..0000000000 --- a/sysdeps/pthread/ftrylockfile.c +++ /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 , 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 - . */ - -#include -#include -#include -#include - - -int -__ftrylockfile (FILE *stream) -{ - return _IO_lock_trylock (*stream->_lock); -} -strong_alias (__ftrylockfile, _IO_ftrylockfile) -weak_alias (__ftrylockfile, ftrylockfile) diff --git a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist index b5a21ad7cd..ffbd77cedf 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist index d88a55c5dc..3110c6df17 100644 --- a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/arc/libpthread.abilist b/sysdeps/unix/sysv/linux/arc/libpthread.abilist index ddda1cb0b8..7de7a4899e 100644 --- a/sysdeps/unix/sysv/linux/arc/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/arc/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist index ae1defcddc..3da5d28656 100644 --- a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist index ae1defcddc..3da5d28656 100644 --- a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/csky/libpthread.abilist b/sysdeps/unix/sysv/linux/csky/libpthread.abilist index 760a569b51..6e86cd96cd 100644 --- a/sysdeps/unix/sysv/linux/csky/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/csky/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist index 4ff101d7f2..6dbe47e566 100644 --- a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/i386/libpthread.abilist b/sysdeps/unix/sysv/linux/i386/libpthread.abilist index 36d415aef5..e50fac2320 100644 --- a/sysdeps/unix/sysv/linux/i386/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/i386/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist index 3c59353815..c136f64653 100644 --- a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist index ae1defcddc..3da5d28656 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist index 36d415aef5..e50fac2320 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist index 5c6c7b229c..fd9fa8e1bf 100644 --- a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist index 5c6c7b229c..fd9fa8e1bf 100644 --- a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist index 1d36022ee2..a607c10506 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist index 1d36022ee2..a607c10506 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist index 5611822c38..bfaf7b18cc 100644 --- a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist index aa24808b1e..b7292ba735 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist index 5f5abdae73..ddd982e470 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist index b5a21ad7cd..ffbd77cedf 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist index f0493d8973..2f492d0934 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist index c0279888a0..53363c9eca 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist index 286aedf9ca..0a2a1eacfa 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist index 35248d9303..d105c7fc36 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist index 4ff101d7f2..6dbe47e566 100644 --- a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist index 4ff101d7f2..6dbe47e566 100644 --- a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist index d88a55c5dc..3110c6df17 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist index 3c59353815..c136f64653 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist index 732e55148d..25f59472dd 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist index 22262d9ceb..0fba7f100d 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist @@ -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 From patchwork Mon May 10 17:04:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 43320 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 78BF13982055; Mon, 10 May 2021 17:04:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 78BF13982055 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620666283; bh=tIga52NodKEmXCOI+L7lo7vLORByx2kKLTQjdQMmWhs=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=K8bJq7XtXaPD1ZEj4KpWS1uHRTDZSJeZHf6nyEh3zT/ivcAkYwPK/GDgJH9Wi1tog IE2u95TXTbKraT7tHOKyBb8qHmxiPrhtHMbJTUk9OJewOW10lYveIwGWKg8eMezeZa GRaze+XITH+wPgCni04jADf/qELuvsUyPyB01Ico= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by sourceware.org (Postfix) with ESMTPS id C37E93982051 for ; Mon, 10 May 2021 17:04:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C37E93982051 Received: by mail-qv1-xf32.google.com with SMTP id u7so8686090qvv.12 for ; Mon, 10 May 2021 10:04:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tIga52NodKEmXCOI+L7lo7vLORByx2kKLTQjdQMmWhs=; b=VM8Gx9Y9RQ4zE3ClUUc3LM2l4uudxMJdEwMNESvRGlAysDF79ZX2I92lK3213Q+0nt N0x/BB90zqguIOwNGH7QmBpHZVVBgqqPI5SkjSdrsJjlGDcCBlOongAQ6kYdyg9XkEEB UQBO6QCmEqUamdJJ6IfGAEZSxu+KAmITU012S8gzUSpWpvIeZAnoclFUyE1lmMoCGnMO Ylil3Hzv52FOuO1mx+1+e5TsTByXEWuiQmc52HEOSnDLndaoSAHrNJQWNqwoBKPH28Nt a5jZWzFj0ijJu9AqwforXMOr+ALagLh7iv8ONRnwoHgtto/fLEEAPPrMeDKcU6S7o1t+ xEQA== X-Gm-Message-State: AOAM532BQ2z66wBlXbO9hBj0myn1G7KQFTPYC78UuSU6XstD24lm9MHD WYD0VWosLHfizkxMi3oaB+88no/aZCQJrA== X-Google-Smtp-Source: ABdhPJy5ebX23JV7U8yEQ8OehcSZD01Nltai/PUFSGJUn0xm+IYc+vIRr+OKF6VAsxIwG9IrgaTlOg== X-Received: by 2002:ad4:5bc2:: with SMTP id t2mr24267380qvt.50.1620666273746; Mon, 10 May 2021 10:04:33 -0700 (PDT) Received: from birita.. ([177.194.37.86]) by smtp.googlemail.com with ESMTPSA id g64sm11780564qkf.41.2021.05.10.10.04.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 10:04:33 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 3/4] linux: Move funlockfile/_IO_funlockfile into libc Date: Mon, 10 May 2021 14:04:25 -0300 Message-Id: <20210510170426.2533768-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210510170426.2533768-1-adhemerval.zanella@linaro.org> References: <20210510170426.2533768-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" 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_funlockfile). Checked on x86_64-linux-gnu. --- nptl/Makefile | 1 - stdio-common/funlockfile.c | 6 ++-- sysdeps/pthread/funlockfile.c | 30 ------------------- .../sysv/linux/aarch64/libpthread.abilist | 2 -- .../unix/sysv/linux/alpha/libpthread.abilist | 2 -- .../unix/sysv/linux/arc/libpthread.abilist | 2 -- .../unix/sysv/linux/arm/be/libpthread.abilist | 2 -- .../unix/sysv/linux/arm/le/libpthread.abilist | 2 -- .../unix/sysv/linux/csky/libpthread.abilist | 2 -- .../unix/sysv/linux/hppa/libpthread.abilist | 2 -- .../unix/sysv/linux/i386/libpthread.abilist | 2 -- .../unix/sysv/linux/ia64/libpthread.abilist | 2 -- .../linux/m68k/coldfire/libpthread.abilist | 2 -- .../sysv/linux/m68k/m680x0/libpthread.abilist | 2 -- .../linux/microblaze/be/libpthread.abilist | 2 -- .../linux/microblaze/le/libpthread.abilist | 2 -- .../sysv/linux/mips/mips32/libpthread.abilist | 2 -- .../sysv/linux/mips/mips64/libpthread.abilist | 2 -- .../unix/sysv/linux/nios2/libpthread.abilist | 2 -- .../powerpc/powerpc32/libpthread.abilist | 2 -- .../powerpc/powerpc64/be/libpthread.abilist | 2 -- .../powerpc/powerpc64/le/libpthread.abilist | 2 -- .../sysv/linux/riscv/rv32/libpthread.abilist | 2 -- .../sysv/linux/riscv/rv64/libpthread.abilist | 2 -- .../linux/s390/s390-32/libpthread.abilist | 2 -- .../linux/s390/s390-64/libpthread.abilist | 2 -- .../unix/sysv/linux/sh/be/libpthread.abilist | 2 -- .../unix/sysv/linux/sh/le/libpthread.abilist | 2 -- .../linux/sparc/sparc32/libpthread.abilist | 2 -- .../linux/sparc/sparc64/libpthread.abilist | 2 -- .../sysv/linux/x86_64/64/libpthread.abilist | 2 -- .../sysv/linux/x86_64/x32/libpthread.abilist | 2 -- 32 files changed, 3 insertions(+), 92 deletions(-) delete mode 100644 sysdeps/pthread/funlockfile.c diff --git a/nptl/Makefile b/nptl/Makefile index 64ae68238d..7b3c56f32c 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -179,7 +179,6 @@ libpthread-routines = \ cleanup \ cleanup_defer \ events \ - funlockfile \ libpthread-compat \ nptl-init \ nptlfreeres \ diff --git a/stdio-common/funlockfile.c b/stdio-common/funlockfile.c index 50f2f99948..961fa3d250 100644 --- a/stdio-common/funlockfile.c +++ b/stdio-common/funlockfile.c @@ -17,13 +17,13 @@ . */ #include - -#undef _IO_funlockfile +#include +#include void __funlockfile (FILE *stream) { - /* Do nothing. Using this version does not do any locking. */ + _IO_lock_unlock (*stream->_lock); } weak_alias (__funlockfile, _IO_funlockfile) weak_alias (__funlockfile, funlockfile); diff --git a/sysdeps/pthread/funlockfile.c b/sysdeps/pthread/funlockfile.c deleted file mode 100644 index 0ee5cb6451..0000000000 --- a/sysdeps/pthread/funlockfile.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2002-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - . */ - -#include -#include -#include - - -void -__funlockfile (FILE *stream) -{ - _IO_lock_unlock (*stream->_lock); -} -strong_alias (__funlockfile, _IO_funlockfile) -weak_alias (__funlockfile, funlockfile) diff --git a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist index ffbd77cedf..36f05e77dd 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist @@ -1,10 +1,8 @@ -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 funlockfile F GLIBC_2.17 pthread_attr_getaffinity_np F GLIBC_2.17 pthread_attr_getguardsize F GLIBC_2.17 pthread_attr_getstack F diff --git a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist index 3110c6df17..ad0ae35282 100644 --- a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist @@ -1,6 +1,4 @@ -GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F GLIBC_2.0 pthread_create F GLIBC_2.0 pthread_detach F diff --git a/sysdeps/unix/sysv/linux/arc/libpthread.abilist b/sysdeps/unix/sysv/linux/arc/libpthread.abilist index 7de7a4899e..83b55dfdb2 100644 --- a/sysdeps/unix/sysv/linux/arc/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/arc/libpthread.abilist @@ -1,10 +1,8 @@ -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 funlockfile F GLIBC_2.32 pthread_attr_getaffinity_np F GLIBC_2.32 pthread_attr_getguardsize F GLIBC_2.32 pthread_attr_getstack F diff --git a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist index 3da5d28656..af98ddd266 100644 --- a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist @@ -8,14 +8,12 @@ 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_funlockfile F GLIBC_2.4 __errno_location F GLIBC_2.4 __libpthread_version_placeholder F 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 funlockfile F GLIBC_2.4 pthread_attr_getaffinity_np F GLIBC_2.4 pthread_attr_getguardsize F GLIBC_2.4 pthread_attr_getstack F diff --git a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist index 3da5d28656..af98ddd266 100644 --- a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist @@ -8,14 +8,12 @@ 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_funlockfile F GLIBC_2.4 __errno_location F GLIBC_2.4 __libpthread_version_placeholder F 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 funlockfile F GLIBC_2.4 pthread_attr_getaffinity_np F GLIBC_2.4 pthread_attr_getguardsize F GLIBC_2.4 pthread_attr_getstack F diff --git a/sysdeps/unix/sysv/linux/csky/libpthread.abilist b/sysdeps/unix/sysv/linux/csky/libpthread.abilist index 6e86cd96cd..ae0b322740 100644 --- a/sysdeps/unix/sysv/linux/csky/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/csky/libpthread.abilist @@ -1,10 +1,8 @@ -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 funlockfile F GLIBC_2.29 pthread_attr_getaffinity_np F GLIBC_2.29 pthread_attr_getguardsize F GLIBC_2.29 pthread_attr_getstack F diff --git a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist index 6dbe47e566..2a41f3b961 100644 --- a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist @@ -3,9 +3,7 @@ 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_funlockfile F GLIBC_2.2 __errno_location F -GLIBC_2.2 funlockfile F GLIBC_2.2 pthread_attr_getguardsize F GLIBC_2.2 pthread_attr_getstack F GLIBC_2.2 pthread_attr_getstackaddr F diff --git a/sysdeps/unix/sysv/linux/i386/libpthread.abilist b/sysdeps/unix/sysv/linux/i386/libpthread.abilist index e50fac2320..d8f19bb5b4 100644 --- a/sysdeps/unix/sysv/linux/i386/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/i386/libpthread.abilist @@ -1,6 +1,4 @@ -GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F GLIBC_2.0 pthread_create F GLIBC_2.0 pthread_detach F diff --git a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist index c136f64653..c905c119be 100644 --- a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist @@ -3,9 +3,7 @@ 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_funlockfile F GLIBC_2.2 __errno_location F -GLIBC_2.2 funlockfile F GLIBC_2.2 pthread_attr_getguardsize F GLIBC_2.2 pthread_attr_getstack F GLIBC_2.2 pthread_attr_getstackaddr F diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist index 3da5d28656..af98ddd266 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist @@ -8,14 +8,12 @@ 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_funlockfile F GLIBC_2.4 __errno_location F GLIBC_2.4 __libpthread_version_placeholder F 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 funlockfile F GLIBC_2.4 pthread_attr_getaffinity_np F GLIBC_2.4 pthread_attr_getguardsize F GLIBC_2.4 pthread_attr_getstack F diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist index e50fac2320..d8f19bb5b4 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist @@ -1,6 +1,4 @@ -GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F GLIBC_2.0 pthread_create F GLIBC_2.0 pthread_detach F diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist index fd9fa8e1bf..fd957d6642 100644 --- a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist @@ -1,10 +1,8 @@ -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 funlockfile F GLIBC_2.18 pthread_attr_getaffinity_np F GLIBC_2.18 pthread_attr_getguardsize F GLIBC_2.18 pthread_attr_getstack F diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist index fd9fa8e1bf..fd957d6642 100644 --- a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist @@ -1,10 +1,8 @@ -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 funlockfile F GLIBC_2.18 pthread_attr_getaffinity_np F GLIBC_2.18 pthread_attr_getguardsize F GLIBC_2.18 pthread_attr_getstack F diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist index a607c10506..fe9d706889 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist @@ -1,6 +1,4 @@ -GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F GLIBC_2.0 pthread_create F GLIBC_2.0 pthread_detach F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist index a607c10506..fe9d706889 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist @@ -1,6 +1,4 @@ -GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F GLIBC_2.0 pthread_create F GLIBC_2.0 pthread_detach F diff --git a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist index bfaf7b18cc..5497256770 100644 --- a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist @@ -1,10 +1,8 @@ -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 funlockfile F GLIBC_2.21 pthread_attr_getaffinity_np F GLIBC_2.21 pthread_attr_getguardsize F GLIBC_2.21 pthread_attr_getstack F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist index b7292ba735..b15a84fd3e 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist @@ -1,6 +1,4 @@ -GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F GLIBC_2.0 pthread_create F GLIBC_2.0 pthread_detach F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist index ddd982e470..b3994cd280 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist @@ -6,9 +6,7 @@ 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_funlockfile F GLIBC_2.3 __errno_location F -GLIBC_2.3 funlockfile F GLIBC_2.3 pthread_attr_getguardsize F GLIBC_2.3 pthread_attr_getstack F GLIBC_2.3 pthread_attr_getstackaddr F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist index ffbd77cedf..36f05e77dd 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist @@ -1,10 +1,8 @@ -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 funlockfile F GLIBC_2.17 pthread_attr_getaffinity_np F GLIBC_2.17 pthread_attr_getguardsize F GLIBC_2.17 pthread_attr_getstack F diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist index 2f492d0934..91e3afa737 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist @@ -1,10 +1,8 @@ -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 funlockfile F GLIBC_2.33 pthread_attr_getaffinity_np F GLIBC_2.33 pthread_attr_getguardsize F GLIBC_2.33 pthread_attr_getstack F diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist index 53363c9eca..b7bd70768f 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist @@ -1,10 +1,8 @@ -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 funlockfile F GLIBC_2.27 pthread_attr_getaffinity_np F GLIBC_2.27 pthread_attr_getguardsize F GLIBC_2.27 pthread_attr_getstack F diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist index 0a2a1eacfa..8d22b21118 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist @@ -1,6 +1,4 @@ -GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F GLIBC_2.0 pthread_create F GLIBC_2.0 pthread_detach F diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist index d105c7fc36..92336b6560 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist @@ -4,9 +4,7 @@ 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_funlockfile F GLIBC_2.2 __errno_location F -GLIBC_2.2 funlockfile F GLIBC_2.2 pthread_attr_getguardsize F GLIBC_2.2 pthread_attr_getstack F GLIBC_2.2 pthread_attr_getstackaddr F diff --git a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist index 6dbe47e566..2a41f3b961 100644 --- a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist @@ -3,9 +3,7 @@ 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_funlockfile F GLIBC_2.2 __errno_location F -GLIBC_2.2 funlockfile F GLIBC_2.2 pthread_attr_getguardsize F GLIBC_2.2 pthread_attr_getstack F GLIBC_2.2 pthread_attr_getstackaddr F diff --git a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist index 6dbe47e566..2a41f3b961 100644 --- a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist @@ -3,9 +3,7 @@ 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_funlockfile F GLIBC_2.2 __errno_location F -GLIBC_2.2 funlockfile F GLIBC_2.2 pthread_attr_getguardsize F GLIBC_2.2 pthread_attr_getstack F GLIBC_2.2 pthread_attr_getstackaddr F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist index 3110c6df17..ad0ae35282 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist @@ -1,6 +1,4 @@ -GLIBC_2.0 _IO_funlockfile F GLIBC_2.0 __errno_location F -GLIBC_2.0 funlockfile F GLIBC_2.0 pthread_cancel F GLIBC_2.0 pthread_create F GLIBC_2.0 pthread_detach F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist index c136f64653..c905c119be 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist @@ -3,9 +3,7 @@ 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_funlockfile F GLIBC_2.2 __errno_location F -GLIBC_2.2 funlockfile F GLIBC_2.2 pthread_attr_getguardsize F GLIBC_2.2 pthread_attr_getstack F GLIBC_2.2 pthread_attr_getstackaddr F diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist index 25f59472dd..06c5f0e4af 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist @@ -3,9 +3,7 @@ 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_funlockfile F GLIBC_2.2.5 __errno_location F -GLIBC_2.2.5 funlockfile F GLIBC_2.2.5 pthread_attr_getguardsize F GLIBC_2.2.5 pthread_attr_getstack F GLIBC_2.2.5 pthread_attr_getstackaddr F diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist index 0fba7f100d..298d3185bb 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist @@ -1,10 +1,8 @@ -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 funlockfile F GLIBC_2.16 pthread_attr_getaffinity_np F GLIBC_2.16 pthread_attr_getguardsize F GLIBC_2.16 pthread_attr_getstack F From patchwork Mon May 10 17:04:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 43319 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E2EEC3982065; Mon, 10 May 2021 17:04:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2EEC3982065 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620666280; bh=slef7Lz6KTt3iBMG9mJsGv1ZibwCc+Uf1ZGW5Xodl/0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ATvTgz55EpvRLHIep4jBBsmz9+La8ZL2AwFN8pi5otGxFqWGQDFcmjHHGJFhuvUCJ OaQ7pfqZus4rhAx2/L4fX/TMnCse1rsccKvrOfUEk7/eQqlUolARLSxP404wWHMRdQ rmVuDC50iNVBepaYbQI+IfTAP71t0nAsWWEmQeKI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by sourceware.org (Postfix) with ESMTPS id 8715D3982056 for ; Mon, 10 May 2021 17:04:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8715D3982056 Received: by mail-qv1-xf33.google.com with SMTP id u7so8686117qvv.12 for ; Mon, 10 May 2021 10:04:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=slef7Lz6KTt3iBMG9mJsGv1ZibwCc+Uf1ZGW5Xodl/0=; b=Ayq7ONOwJr+efM19nfY7cibnxkDuSINJFsITDBgk204o1ww36PR+vxtF8ZmJD4PHBI 3uo96Shfvu15JrebvfBnUohOCRyG3cF1/ikXk7E5iqUlKbqxN9ewT5iC+LB4+oStM6B0 7mKizgS1gRailNu4KrLfbqx10N42q7NMgq/siJqUaARL6rIEbmb4Tr1qGohHOoA2ikOY YHPEdvn0dZH03IVdfhq1ed7fhCTcMQlxK4DtFvuTNhsFqV4TPyE4YH05V2AxGMOOJay8 DlyL6kyoWlxprgXiEjhv4C0vxkkeEfjNn8QNrTJjYwiaG9DyFgVCJo73FcYEm5eeWjbI atXQ== X-Gm-Message-State: AOAM531tizBsGeeiyqjKnm0L3bBVfYyi/Kw027H798cS9lMoJTBTcqPG iNgAWLv+w3OAudsxlp0vVGqbyxiSQgtBAg== X-Google-Smtp-Source: ABdhPJxDsfz2ca+4n8hBJhVwmYaPeb3BQ6kCFOeoPY/HP9EbSMgdY/hgklBpQXDDJAKT7+MZjlbkgQ== X-Received: by 2002:ad4:5587:: with SMTP id e7mr24568304qvx.6.1620666276887; Mon, 10 May 2021 10:04:36 -0700 (PDT) Received: from birita.. ([177.194.37.86]) by smtp.googlemail.com with ESMTPSA id g64sm11780564qkf.41.2021.05.10.10.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 10:04:36 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 4/4] libio: Fix race access to _IO_FLAGS2_NEED_LOCK Date: Mon, 10 May 2021 14:04:26 -0300 Message-Id: <20210510170426.2533768-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210510170426.2533768-1-adhemerval.zanella@linaro.org> References: <20210510170426.2533768-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The flag is set on: 1. the stream creation (for memstream and wmemstream). 2. by pthread_create when it detects the process become multi-thread. 3. by flockfile. The 1. and 2. cases do not generate a race condition since for 1. the stream reference is not accessible by other threads and for 2. the process is still single-threaded. However, for 3. the functions feof, ferror, fputc, getc, getchar, ungetc, and putc access it without locking the stream to check whether to use the optimized _unlocked variants. So to avoid a racy condition, both the check and set are done using atomic operations. Checked on x86_64-linux-gnu. --- libio/feof.c | 2 +- libio/ferror.c | 2 +- libio/fputc.c | 2 +- libio/getc.c | 2 +- libio/getchar.c | 2 +- libio/ioungetc.c | 2 +- libio/libio.h | 31 +++++++++++++++++++++++++++++-- libio/putc.c | 2 +- stdio-common/flockfile.c | 2 +- 9 files changed, 37 insertions(+), 10 deletions(-) diff --git a/libio/feof.c b/libio/feof.c index 8275321788..823b40637a 100644 --- a/libio/feof.c +++ b/libio/feof.c @@ -32,7 +32,7 @@ _IO_feof (FILE *fp) { int result; CHECK_FILE (fp, EOF); - if (!_IO_need_lock (fp)) + if (!io_need_lock (fp)) return _IO_feof_unlocked (fp); _IO_flockfile (fp); result = _IO_feof_unlocked (fp); diff --git a/libio/ferror.c b/libio/ferror.c index 588f2eb50b..13f1a15ecc 100644 --- a/libio/ferror.c +++ b/libio/ferror.c @@ -32,7 +32,7 @@ _IO_ferror (FILE *fp) { int result; CHECK_FILE (fp, EOF); - if (!_IO_need_lock (fp)) + if (!io_need_lock (fp)) return _IO_ferror_unlocked (fp); _IO_flockfile (fp); result = _IO_ferror_unlocked (fp); diff --git a/libio/fputc.c b/libio/fputc.c index c3a1fa47db..b3925c34e8 100644 --- a/libio/fputc.c +++ b/libio/fputc.c @@ -32,7 +32,7 @@ fputc (int c, FILE *fp) { int result; CHECK_FILE (fp, EOF); - if (!_IO_need_lock (fp)) + if (!io_need_lock (fp)) return _IO_putc_unlocked (c, fp); _IO_acquire_lock (fp); result = _IO_putc_unlocked (c, fp); diff --git a/libio/getc.c b/libio/getc.c index e3e658bf79..df2e40dd51 100644 --- a/libio/getc.c +++ b/libio/getc.c @@ -34,7 +34,7 @@ _IO_getc (FILE *fp) { int result; CHECK_FILE (fp, EOF); - if (!_IO_need_lock (fp)) + if (!io_need_lock (fp)) return _IO_getc_unlocked (fp); _IO_acquire_lock (fp); result = _IO_getc_unlocked (fp); diff --git a/libio/getchar.c b/libio/getchar.c index 0d6225853f..0607cd40dd 100644 --- a/libio/getchar.c +++ b/libio/getchar.c @@ -33,7 +33,7 @@ int getchar (void) { int result; - if (!_IO_need_lock (stdin)) + if (!io_need_lock (stdin)) return _IO_getc_unlocked (stdin); _IO_acquire_lock (stdin); result = _IO_getc_unlocked (stdin); diff --git a/libio/ioungetc.c b/libio/ioungetc.c index dcf1c4ca9e..dcc99aa5a3 100644 --- a/libio/ioungetc.c +++ b/libio/ioungetc.c @@ -33,7 +33,7 @@ _IO_ungetc (int c, FILE *fp) CHECK_FILE (fp, EOF); if (c == EOF) return EOF; - if (!_IO_need_lock (fp)) + if (!io_need_lock (fp)) return _IO_sputbackc (fp, (unsigned char) c); _IO_acquire_lock (fp); result = _IO_sputbackc (fp, (unsigned char) c); diff --git a/libio/libio.h b/libio/libio.h index 511b39457f..6b569511ec 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -47,6 +47,8 @@ #include #include #include +#include +#include typedef struct { @@ -210,8 +212,33 @@ extern int _IO_ftrylockfile (FILE *) __THROW; #define _IO_cleanup_region_end(_Doit) /**/ #endif -#define _IO_need_lock(_fp) \ - (((_fp)->_flags2 & _IO_FLAGS2_NEED_LOCK) != 0) + +/* The _IO_FLAGS2_NEED_LOCK flag is set on: + + 1. the stream creation (for memstream and wmemstream). + 2. by pthread_create when it detects the process become multi-thread. + 3. by flockfile. + + The 1. and 2. cases do not generate a race condition since for 1. + the stream reference is not accessible by other threads and for 2. + the process is still single-threaded. + + However, for 3. the functions feof, ferror, fputc, getc, getchar, ungetc, + and putc access it without locking the stream to check whether to use the + optimized _unlocked variants. So to avoid a racy condition, both the + check and set are done using atomic operations. */ + +static inline bool +io_need_lock (FILE *fp) +{ + return atomic_load_acquire (&fp->_flags2) & _IO_FLAGS2_NEED_LOCK; +} + +static inline void +io_set_need_lock (FILE *fp) +{ + atomic_fetch_or_release (&fp->_flags2, _IO_FLAGS2_NEED_LOCK); +} extern int _IO_vfscanf (FILE * __restrict, const char * __restrict, __gnuc_va_list, int *__restrict); diff --git a/libio/putc.c b/libio/putc.c index 0b0dd40736..1f1da21239 100644 --- a/libio/putc.c +++ b/libio/putc.c @@ -25,7 +25,7 @@ _IO_putc (int c, FILE *fp) { int result; CHECK_FILE (fp, EOF); - if (!_IO_need_lock (fp)) + if (!io_need_lock (fp)) return _IO_putc_unlocked (c, fp); _IO_acquire_lock (fp); result = _IO_putc_unlocked (c, fp); diff --git a/stdio-common/flockfile.c b/stdio-common/flockfile.c index a66e0a731e..3b42fe891d 100644 --- a/stdio-common/flockfile.c +++ b/stdio-common/flockfile.c @@ -22,7 +22,7 @@ void __flockfile (FILE *stream) { - stream->_flags2 |= _IO_FLAGS2_NEED_LOCK; + io_set_need_lock (stream); _IO_lock_lock (*stream->_lock); } weak_alias (__flockfile, flockfile);