From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 567F41F8C6 for ; Tue, 13 Jul 2021 07:40:54 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8F3CB39450D4 for ; Tue, 13 Jul 2021 07:40:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F3CB39450D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626162053; bh=agGQZnHKyj8N5lkxqcl4QxVn3LVGITCCjrnV2Ni3IL4=; 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=LLXUzUF58Wnhh1Mghn05twGuLrAx0RC+/q7Zus0DS+IfCJXW3Vy5rrjsMaS4L3yiY A9sqedHuk6yrljS4s9SZiUqUDNTatPggAOoJW+siDyv25g222i1NNTaULOhFD087Xt Qn2aE3YfU7bBYtb5nCwLf/dU+SqK682xa6znsi68= Received: from purple.birch.relay.mailchannels.net (purple.birch.relay.mailchannels.net [23.83.209.150]) by sourceware.org (Postfix) with ESMTPS id 44D3639450E8 for ; Tue, 13 Jul 2021 07:39:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 44D3639450E8 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 021A7102C44; Tue, 13 Jul 2021 07:39:08 +0000 (UTC) Received: from pdx1-sub0-mail-a18.g.dreamhost.com (100-101-162-69.trex-nlb.outbound.svc.cluster.local [100.101.162.69]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 443E4102BF2; Tue, 13 Jul 2021 07:39:07 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a18.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.101.162.69 (trex/6.3.3); Tue, 13 Jul 2021 07:39:07 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Illustrious-Fumbling: 3af7ddff0ed906f4_1626161947624_2009279388 X-MC-Loop-Signature: 1626161947624:4027172501 X-MC-Ingress-Time: 1626161947623 Received: from pdx1-sub0-mail-a18.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a18.g.dreamhost.com (Postfix) with ESMTP id 0320385B78; Tue, 13 Jul 2021 00:39:07 -0700 (PDT) Received: from rhbox.intra.reserved-bit.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a18.g.dreamhost.com (Postfix) with ESMTPSA id A823687DC6; Tue, 13 Jul 2021 00:39:04 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a18 To: libc-alpha@sourceware.org Subject: [PATCH v8 02/10] Remove __after_morecore_hook Date: Tue, 13 Jul 2021 13:08:37 +0530 Message-Id: <20210713073845.504356-3-siddhesh@sourceware.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210713073845.504356-1-siddhesh@sourceware.org> References: <20210713073845.504356-1-siddhesh@sourceware.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: , From: Siddhesh Poyarekar via Libc-alpha Reply-To: Siddhesh Poyarekar Cc: fweimer@redhat.com Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" Remove __after_morecore_hook from the API and finalize the symbol so that it can no longer be used in new applications. Old applications using __after_morecore_hook will find that their hook is no longer called. --- malloc/hooks.c | 5 +++++ malloc/malloc.c | 22 +--------------------- malloc/malloc.h | 3 --- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/malloc/hooks.c b/malloc/hooks.c index daa5c7cfae..45c91d6502 100644 --- a/malloc/hooks.c +++ b/malloc/hooks.c @@ -17,6 +17,11 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, see . */ =20 +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_34) +void weak_variable (*__after_morecore_hook) (void) =3D NULL; +compat_symbol (libc, __after_morecore_hook, __after_morecore_hook, GLIBC= _2_0); +#endif + /* Hooks for debugging versions. The initial hooks just call the initialization routine, then do the normal work. */ =20 diff --git a/malloc/malloc.c b/malloc/malloc.c index 154f6b460c..24e7854a0e 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -2041,8 +2041,6 @@ void *weak_variable (*__realloc_hook) void *weak_variable (*__memalign_hook) (size_t __alignment, size_t __size, const void *) =3D memalign_hook_ini; -void weak_variable (*__after_morecore_hook) (void) =3D NULL; - /* This function is called from the arena shutdown hook, to free the thread cache (if it exists). */ static void tcache_thread_shutdown (void); @@ -2668,14 +2666,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av) LIBC_PROBE (memory_sbrk_more, 2, brk, size); } =20 - if (brk !=3D (char *) (MORECORE_FAILURE)) - { - /* Call the `morecore' hook if necessary. */ - void (*hook) (void) =3D atomic_forced_read (__after_morecore_h= ook); - if (__builtin_expect (hook !=3D NULL, 0)) - (*hook)(); - } - else + if (brk =3D=3D (char *) (MORECORE_FAILURE)) { /* If have mmap, try using it as a backup when MORECORE fails = or @@ -2814,13 +2805,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av) correction =3D 0; snd_brk =3D (char *) (MORECORE (0)); } - else - { - /* Call the `morecore' hook if necessary. */ - void (*hook) (void) =3D atomic_forced_read (__afte= r_morecore_hook); - if (__builtin_expect (hook !=3D NULL, 0)) - (*hook)(); - } } =20 /* handle non-contiguous cases */ @@ -2979,10 +2963,6 @@ systrim (size_t pad, mstate av) */ =20 MORECORE (-extra); - /* Call the `morecore' hook if necessary. */ - void (*hook) (void) =3D atomic_forced_read (__after_morecore_hook)= ; - if (__builtin_expect (hook !=3D NULL, 0)) - (*hook)(); new_brk =3D (char *) (MORECORE (0)); =20 LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra); diff --git a/malloc/malloc.h b/malloc/malloc.h index c1c0896d29..634b7db868 100644 --- a/malloc/malloc.h +++ b/malloc/malloc.h @@ -179,9 +179,6 @@ extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook= )(size_t __alignment, size_t __size, const void *) __MALLOC_DEPRECATED; -extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void) - __MALLOC_DEPRECATED; - =20 __END_DECLS #endif /* malloc.h */ --=20 2.31.1