From patchwork Thu May 27 17:28:15 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: 43608 X-Patchwork-Delegate: fweimer@redhat.com 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 5B3333838028; Thu, 27 May 2021 17:28:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B3333838028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1622136512; bh=QrWL8+Jha5S+hivK/rQ/vEGUvn9Axia3707mTCCDctI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=rTYImJvZiBK4muTYs/PUgMubSqAE4FEFs5eQdxNmoYFCxYTtGjzBTWn8xzMmgVjsL 4X3VnxiI1GaBm/pW8zXrks++efAxFqxUxjohWBg5bqX23npDep25F1+jJbA5WWGfyn OT9PX5bB4g95dXuWqw2cMD9yZX4a5pVBgJOACG5Y= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by sourceware.org (Postfix) with ESMTPS id C23443839C56 for ; Thu, 27 May 2021 17:28:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C23443839C56 Received: by mail-qk1-x731.google.com with SMTP id o27so1406068qkj.9 for ; Thu, 27 May 2021 10:28:29 -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:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QrWL8+Jha5S+hivK/rQ/vEGUvn9Axia3707mTCCDctI=; b=ERObR1nllloRO2T4oFntIGii5QajOdGPfwxTjYNUTUL3Fu5op/sTjTVJmMmTUfU1hQ Q/ZFArawWuCkSq/fWJsFchORN3jIqBapf6J6uYlr6LMOwUhm3QHWNsKTL8J9TDVkj5uu 1pQHKKNq3g7emk+cmP+KAmN+tRRetxt0m/TI1FQ+rINWLB7SFin73h47LJxT4b3PdgUB A/Fxt6cimIeErwnXsqnTKbPsB/wU07i4Mn+Up0mTHG99+J0ZdGgre7mx50FBJW+jD/kE xCE7I1QaAWzybh4kPgsRMAPw2g6AVKbPZeqQGBa/1dPnwGDYvI1qXFDjDnlyOYjXeqHZ /aLw== X-Gm-Message-State: AOAM530ABi+7w5rPg5WuzC9bEIO6ueXLbfGGpqE8XIzLslNJz23EcVNc djH6jtqih6clzL0N2rOgfWnwIUT/6+FTgg== X-Google-Smtp-Source: ABdhPJwYY1+NhOUtDTj+bznRf470+aTgoWIUkxQMjp1HiAk1HmCUz57saMmL8rbU2GmJtkEUmX4QEA== X-Received: by 2002:a05:620a:1667:: with SMTP id d7mr4676258qko.462.1622136509121; Thu, 27 May 2021 10:28:29 -0700 (PDT) Received: from birita.. ([177.194.37.86]) by smtp.googlemail.com with ESMTPSA id 25sm1767913qtd.51.2021.05.27.10.28.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 10:28:28 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 1/9] nptl: Remove exit-thread.h Date: Thu, 27 May 2021 14:28:15 -0300 Message-Id: <20210527172823.3461314-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210527172823.3461314-1-adhemerval.zanella@linaro.org> References: <20210527172823.3461314-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 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 Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" No function change. The code is used only for Linux, besides being included in generic code. --- csu/libc-start.c | 1 - nptl/pthread_create.c | 6 +++-- sysdeps/generic/exit-thread.h | 28 -------------------- sysdeps/nptl/libc_start_call_main.h | 5 +++- sysdeps/unix/sysv/linux/exit-thread.h | 37 --------------------------- 5 files changed, 8 insertions(+), 69 deletions(-) delete mode 100644 sysdeps/generic/exit-thread.h delete mode 100644 sysdeps/unix/sysv/linux/exit-thread.h diff --git a/csu/libc-start.c b/csu/libc-start.c index 8688cba76d..5b5913e7bf 100644 --- a/csu/libc-start.c +++ b/csu/libc-start.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index 2d2535b07d..aacbba1cac 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -575,7 +574,10 @@ start_thread (void *arg) The exit code is zero since in case all threads exit by calling 'pthread_exit' the exit status must be 0 (zero). */ - __exit_thread (); + while (1) + { + INTERNAL_SYSCALL_CALL (exit, 0); + } /* NOTREACHED */ } diff --git a/sysdeps/generic/exit-thread.h b/sysdeps/generic/exit-thread.h deleted file mode 100644 index 676ef553a5..0000000000 --- a/sysdeps/generic/exit-thread.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Call to terminate the current thread. Stub version. - Copyright (C) 2014-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* This causes the current thread to exit, without affecting other - threads in the process if there are any. If there are no other - threads left, then this has the effect of _exit (0). */ - -static inline void __attribute__ ((noreturn, always_inline, unused)) -__exit_thread (void) -{ - while (1) - asm ("write me!"); -} diff --git a/sysdeps/nptl/libc_start_call_main.h b/sysdeps/nptl/libc_start_call_main.h index c579c65f78..08b1800e83 100644 --- a/sysdeps/nptl/libc_start_call_main.h +++ b/sysdeps/nptl/libc_start_call_main.h @@ -67,7 +67,10 @@ __libc_start_call_main (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), result = 0; if (! atomic_decrement_and_test (&__nptl_nthreads)) /* Not much left to do but to exit the thread, not the process. */ - __exit_thread (); + while (1) + { + INTERNAL_SYSCALL_CALL (exit, 0); + } } exit (result); diff --git a/sysdeps/unix/sysv/linux/exit-thread.h b/sysdeps/unix/sysv/linux/exit-thread.h deleted file mode 100644 index 9e1b7f3752..0000000000 --- a/sysdeps/unix/sysv/linux/exit-thread.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Call to terminate the current thread. Linux version. - Copyright (C) 2014-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -/* This causes the current thread to exit, without affecting other - threads in the process if there are any. If there are no other - threads left, then this has the effect of _exit (0). */ - -static inline void __attribute__ ((noreturn, always_inline, unused)) -__exit_thread (void) -{ - /* Doing this in a loop is mostly just to satisfy the compiler that the - function really qualifies as noreturn. It also means that in some - pathological situation where the system call does not get made or does - not work, the thread will simply spin rather than running off the end - of the caller and doing unexpectedly strange things. */ - while (1) - { - INTERNAL_SYSCALL_CALL (exit, 0); - } -}