From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 A94F73861028 for ; Mon, 29 Mar 2021 18:59:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A94F73861028 Received: by mail-qv1-xf32.google.com with SMTP id c3so5824137qvz.7 for ; Mon, 29 Mar 2021 11:59:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bs3T+Pm8pl5lMNmWCSRTr7DjDhmHSmHs1INh+X2+4pE=; b=MG3GBApvcl9Oc0jlynRgJ/SRxMiiD28phjCSbSlpTOhnbaqKIv+GS71l1lX1th89ZE Ug+Y9sNRYuf8sNPMUGHbn2kWcVWiwU/lSn2L7Nqn/lgzJ7ubQdBNoEXz6pF1Rjgv+Hu5 9//EovFpqCrJkRTo+wGViJLKAaFwgsa5wiFEOujiBBNeAcu7Ik0YVlVQ7iGbB0iv2cT1 eekfZl2pKh7KHbPwJ0P/WtNl9xJU6v9dS+MYgJ4IuhpPhF+bLjXSczjv0BKyTZXf5eEp U4xmlyYTebeCuqRvnV0WnS3nybK68FFrY0DhZq+SBAwEXliPBrM+be7HQxjnulsiSPNo eK3A== X-Gm-Message-State: AOAM531a4mWI3/Qgd+uvZWF1tIi/vFE+TV6Qvcs5GoYfeZRMsdghNvpY Vxiov9oGNq1voJcr8zvB8Fv+plFOph+2NfM8 X-Google-Smtp-Source: ABdhPJxynE9E9L9eNVOJMZ0YEC5JrD5sfIVCWRw5j318JS3XsAaOU3kuRghO0OXEJakkXP/Po66WZA== X-Received: by 2002:ad4:528c:: with SMTP id v12mr26565448qvr.54.1617044350117; Mon, 29 Mar 2021 11:59:10 -0700 (PDT) Received: from [192.168.1.132] ([177.194.41.149]) by smtp.gmail.com with ESMTPSA id e14sm4702571qte.78.2021.03.29.11.59.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Mar 2021 11:59:09 -0700 (PDT) Subject: Re: [PATCH] fork.h: replace with register-atfork.h To: Samuel Thibault , libc-alpha@sourceware.org Cc: commit-hurd@gnu.org References: <20210324221131.1002920-1-samuel.thibault@ens-lyon.org> From: Adhemerval Zanella Message-ID: Date: Mon, 29 Mar 2021 15:59:07 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210324221131.1002920-1-samuel.thibault@ens-lyon.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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, NICE_REPLY_A, 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-List-Received-Date: Mon, 29 Mar 2021 18:59:12 -0000 On 24/03/2021 19:11, Samuel Thibault wrote: > UNREGISTER_ATFORK is now defined for all ports in register-atfork.h, so most > previous includes of fork.h actually only need register-atfork.h now, and > cxa_finalize.c does not need an ifdef UNREGISTER_ATFORK any more. > > The nptl-specific fork generation counters can then go to pthreadP.h, and > fork.h be removed. > > Checked on x86_64-linux-gnu and i686-gnu. LGTM, thanks. Reviewed-by: Adhemerval Zanella > --- > htl/forward.c | 1 - > nptl/libc_pthread_init.c | 2 +- > nptl/nptl-init.c | 1 - > nptl/pthreadP.h | 6 ++++++ > nptl/pthread_atfork.c | 2 +- > stdlib/cxa_finalize.c | 4 +--- > sysdeps/generic/fork.h | 27 --------------------------- > sysdeps/htl/fork.h | 20 -------------------- > sysdeps/htl/pt-atfork.c | 1 - > sysdeps/nptl/fork.c | 2 +- > sysdeps/nptl/fork.h | 26 -------------------------- > sysdeps/nptl/libc-lockP.h | 8 -------- > 12 files changed, 10 insertions(+), 90 deletions(-) > delete mode 100644 sysdeps/generic/fork.h > delete mode 100644 sysdeps/htl/fork.h > delete mode 100644 sysdeps/nptl/fork.h > > diff --git a/htl/forward.c b/htl/forward.c > index 3404046349..4e4133ac1f 100644 > --- a/htl/forward.c > +++ b/htl/forward.c > @@ -22,7 +22,6 @@ > #include > #include > #include > -#include > #include > > /* Pointers to the libc functions. */ Ok. > diff --git a/nptl/libc_pthread_init.c b/nptl/libc_pthread_init.c > index 0757f92cd2..4de182b4e4 100644 > --- a/nptl/libc_pthread_init.c > +++ b/nptl/libc_pthread_init.c > @@ -18,7 +18,7 @@ > > #include > #include > -#include > +#include > #include > #include > #include Ok. > diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c > index 865ee8db29..2c7e2222d4 100644 > --- a/nptl/nptl-init.c > +++ b/nptl/nptl-init.c > @@ -29,7 +29,6 @@ > #include > #include > #include > -#include > #include > #include > #include Ok. > diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h > index c8538de44f..2653e0f1b3 100644 > --- a/nptl/pthreadP.h > +++ b/nptl/pthreadP.h > @@ -355,6 +355,12 @@ extern void __nptl_death_event (void); > hidden_proto (__nptl_create_event) > hidden_proto (__nptl_death_event) > > +/* The fork generation counter, defined in libpthread. */ > +extern unsigned long int __fork_generation attribute_hidden; > + > +/* Pointer to the fork generation counter in the thread library. */ > +extern unsigned long int *__fork_generation_pointer attribute_hidden; > + > /* Register the generation counter in the libpthread with the libc. */ > #ifdef TLS_MULTIPLE_THREADS_IN_TCB > extern void __libc_pthread_init (unsigned long int *ptr, Ok. > diff --git a/nptl/pthread_atfork.c b/nptl/pthread_atfork.c > index 097a86d059..6398688dab 100644 > --- a/nptl/pthread_atfork.c > +++ b/nptl/pthread_atfork.c > @@ -34,7 +34,7 @@ > . */ > > #include "pthreadP.h" > -#include > +#include > #include > > Ok. > diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c > index 7d7b09b3cc..75ea4022fb 100644 > --- a/stdlib/cxa_finalize.c > +++ b/stdlib/cxa_finalize.c > @@ -18,7 +18,7 @@ > #include > #include > #include "exit.h" > -#include > +#include > #include > #include > > @@ -102,9 +102,7 @@ __cxa_finalize (void *d) > > /* Remove the registered fork handlers. We do not have to > unregister anything if the program is going to terminate anyway. */ > -#ifdef UNREGISTER_ATFORK > if (d != NULL) > UNREGISTER_ATFORK (d); > -#endif > __libc_lock_unlock (__exit_funcs_lock); > } Ok. > diff --git a/sysdeps/generic/fork.h b/sysdeps/generic/fork.h > deleted file mode 100644 > index 6cc842a425..0000000000 > --- a/sysdeps/generic/fork.h > +++ /dev/null > @@ -1,27 +0,0 @@ > -/* Stub version of header for fork handling. Mainly to handle pthread_atfork > - and friends. Outside dependencies: > - > - UNREGISTER_ATFORK > - If defined it must expand to a function call which takes one void* > - parameter which is the DSO handle for the DSO which gets unloaded. > - The function so called has to remove the atfork handlers registered > - by this module. */ > - > - > -/* System specific fork definition. Generic version. > - Copyright (C) 2002-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 > - . */ Ok. > diff --git a/sysdeps/htl/fork.h b/sysdeps/htl/fork.h > deleted file mode 100644 > index 9d0d1d2b41..0000000000 > --- a/sysdeps/htl/fork.h > +++ /dev/null > @@ -1,20 +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 Ok. > diff --git a/sysdeps/htl/pt-atfork.c b/sysdeps/htl/pt-atfork.c > index dbb3b8f0cc..3902f40835 100644 > --- a/sysdeps/htl/pt-atfork.c > +++ b/sysdeps/htl/pt-atfork.c > @@ -18,7 +18,6 @@ > > #include > #include > -#include > #include > #include > Ok. > diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c > index f78267b68c..9737127cd6 100644 > --- a/sysdeps/nptl/fork.c > +++ b/sysdeps/nptl/fork.c > @@ -28,7 +28,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include Ok. > diff --git a/sysdeps/nptl/fork.h b/sysdeps/nptl/fork.h > deleted file mode 100644 > index 5246754290..0000000000 > --- a/sysdeps/nptl/fork.h > +++ /dev/null > @@ -1,26 +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 > - > -/* The fork generation counter, defined in libpthread. */ > -extern unsigned long int __fork_generation attribute_hidden; > - > -/* Pointer to the fork generation counter in the thread library. */ > -extern unsigned long int *__fork_generation_pointer attribute_hidden; Ok. > diff --git a/sysdeps/nptl/libc-lockP.h b/sysdeps/nptl/libc-lockP.h > index 4a0b96e6d9..63b605dee2 100644 > --- a/sysdeps/nptl/libc-lockP.h > +++ b/sysdeps/nptl/libc-lockP.h > @@ -308,14 +308,6 @@ __libc_cleanup_routine (struct __pthread_cleanup_frame *f) > __libc_ptf_call (__pthread_setspecific, (KEY, VALUE), 0) > > > -/* Register handlers to execute before and after `fork'. Note that the > - last parameter is NULL. The handlers registered by the libc are > - never removed so this is OK. */ > -extern int __register_atfork (void (*__prepare) (void), > - void (*__parent) (void), > - void (*__child) (void), > - void *__dso_handle); > - > /* Functions that are used by this file and are internal to the GNU C > library. */ > > Ok.