This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] malloc: Deprecate hook variables, __default_morecore, <mcheck.h>
- From: fweimer at redhat dot com (Florian Weimer)
- To: libc-alpha at sourceware dot org
- Date: Wed, 26 Oct 2016 17:02:18 +0200
- Subject: [PATCH] malloc: Deprecate hook variables, __default_morecore, <mcheck.h>
- Authentication-results: sourceware.org; auth=none
The original round of hook variable deprecations missed
__after_morecore_hook and __morecore. __default_morecore is just
an implementation detail.
The functionality in <mcheck.h> will eventually be replaced with
no-op functions (and a separate, preloadable DSO).
2016-10-26 Florian Weimer <fweimer@redhat.com>
* 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.
+* <mcheck.h> 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
<http://www.gnu.org/licenses/>. */
+/* Note: This header file is deprecated and will be removed in a
+ future glibc version. */
+
#ifndef _MCHECK_H
#define _MCHECK_H 1
#include <features.h>
+#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 */