From patchwork Wed Oct 26 15:02:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 687119 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3t3tYf5Py8z9s2G for ; Thu, 27 Oct 2016 02:03:02 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=cMsfmnTP; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= RX2kUwuE238douM/h3ARgD29sJaXZyIVs6/JqETKX+cDPgEiMEUlNa5iggLHrgfp x76fG2WJhuCLClQvdn/hknYyY9z2aovbTnktcigk0pkSrwjZryjj9zTefBCWkuEh /9K6Fvn+zfec7CIoFHqoHsfCyFEffIOJ6lWKg6hoDx0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=rKkF0e TsU7EaZefZ0kNUNlzOVt0=; b=cMsfmnTPWPQBL9Rb8LlvXehrrpLylmWloD0F9z 6LErc3cV8UcePfOrQ1LUVDnAUv1eedSTssBUVyv+JTUPpJtFvy/wZMByhOZW7NAG c+mOUUfdDAjK+aZvmmi8hwk8m/La1KcFt4Iwvcyiy8oxHgjdCKt7tUNLqCBQw8E+ so9Z0= Received: (qmail 87323 invoked by alias); 26 Oct 2016 15:02:31 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 87259 invoked by uid 89); 26 Oct 2016 15:02:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=*__MALLOC_HOOK_VOLATILE, predates, 2.4.22, __throw X-HELO: mx1.redhat.com Date: Wed, 26 Oct 2016 17:02:18 +0200 To: libc-alpha@sourceware.org Subject: [PATCH] malloc: Deprecate hook variables, __default_morecore, User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20161026150218.3F1A4439942E0@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) The original round of hook variable deprecations missed __after_morecore_hook and __morecore. __default_morecore is just an implementation detail. The functionality in will eventually be replaced with no-op functions (and a separate, preloadable DSO). 2016-10-26 Florian Weimer * malloc/mcheck.h (__MCHECK_DEPRECATED): Define. (mcheck, mcheck_pedantic, mcheck_check_all, mprobe, mtrace) (muntrace): Deprecate. * malloc/malloc.h (__morecore, __default_morecore) (__after_morecore_hook): Likewise. diff --git a/NEWS b/NEWS index ea1a0e0..7cbaa28 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,11 @@ Version 2.25 for the Linux quota interface which predates kernel version 2.4.22 has been removed. +* and all malloc hook functions are now deprecated. Future + implementations of the mcheck- and mtrace-related functions will not have + any effect, and glibc will stop calling the hook functions from its malloc + implementation. + * The malloc_get_state and malloc_set_state functions have been removed. Already-existing binaries that dynamically link to these functions will get a hidden implementation in which malloc_get_state is a stub. As far diff --git a/malloc/malloc.h b/malloc/malloc.h index e0c2788..a18401e 100644 --- a/malloc/malloc.h +++ b/malloc/malloc.h @@ -68,11 +68,11 @@ extern void *pvalloc (size_t __size) __THROW __attribute_malloc__ __wur; /* Underlying allocation function; successive calls should return contiguous pieces of memory. */ -extern void *(*__morecore) (ptrdiff_t __size); +extern void *(*__morecore) (ptrdiff_t __size) __MALLOC_DEPRECATED; /* Default value of `__morecore'. */ extern void *__default_morecore (ptrdiff_t __size) -__THROW __attribute_malloc__; +__THROW __attribute_malloc__ __MALLOC_DEPRECATED; /* SVID2/XPG mallinfo structure */ @@ -149,7 +149,8 @@ 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); +extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void) +__MALLOC_DEPRECATED; /* Activate a standard set of debugging hooks. */ extern void __malloc_check_init (void) __THROW __MALLOC_DEPRECATED; diff --git a/malloc/mcheck.h b/malloc/mcheck.h index 416fcd6..aa74b1b 100644 --- a/malloc/mcheck.h +++ b/malloc/mcheck.h @@ -15,11 +15,20 @@ License along with the GNU C Library; if not, see . */ +/* Note: This header file is deprecated and will be removed in a + future glibc version. */ + #ifndef _MCHECK_H #define _MCHECK_H 1 #include +#ifdef _LIBC +# define __MCHECK_DEPRECATED +#else +# define __MCHECK_DEPRECATED __attribute_deprecated__ +#endif + __BEGIN_DECLS /* Return values for `mprobe': these are the kinds of inconsistencies that @@ -38,23 +47,25 @@ enum mcheck_status before `malloc' is ever called. ABORTFUNC is called with an error code (see enum above) when an inconsistency is detected. If ABORTFUNC is null, the standard function prints on stderr and then calls `abort'. */ -extern int mcheck (void (*__abortfunc)(enum mcheck_status)) __THROW; +extern int mcheck (void (*__abortfunc)(enum mcheck_status)) + __THROW __MCHECK_DEPRECATED; /* Similar to `mcheck' but performs checks for all block whenever one of the memory handling functions is called. This can be very slow. */ -extern int mcheck_pedantic (void (*__abortfunc)(enum mcheck_status)) __THROW; +extern int mcheck_pedantic (void (*__abortfunc)(enum mcheck_status)) + __THROW __MCHECK_DEPRECATED; /* Force check of all blocks now. */ -extern void mcheck_check_all (void); +extern void mcheck_check_all (void) __MCHECK_DEPRECATED; /* Check for aberrations in a particular malloc'd block. You must have called `mcheck' already. These are the same checks that `mcheck' does when you free or reallocate a block. */ -extern enum mcheck_status mprobe (void *__ptr) __THROW; +extern enum mcheck_status mprobe (void *__ptr) __THROW __MCHECK_DEPRECATED; /* Activate a standard collection of tracing hooks. */ -extern void mtrace (void) __THROW; -extern void muntrace (void) __THROW; +extern void mtrace (void) __THROW __MCHECK_DEPRECATED; +extern void muntrace (void) __THROW __MCHECK_DEPRECATED; __END_DECLS #endif /* mcheck.h */