From: fweimer@redhat.com (Florian Weimer)
To: libc-alpha@sourceware.org
Subject: [PATCH] malloc: Deprecate hook variables, __default_morecore, <mcheck.h>
Date: Wed, 26 Oct 2016 15:02:00 -0000 [thread overview]
Message-ID: <20161026150218.3F1A4439942E0@oldenburg.str.redhat.com> (raw)
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 */
next reply other threads:[~2016-10-26 15:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-26 15:02 Florian Weimer [this message]
2016-10-26 15:55 ` Joseph Myers
2016-11-15 13:22 ` Florian Weimer
2016-11-15 15:39 ` Joseph Myers
2016-11-15 15:56 ` Florian Weimer
2016-11-16 1:37 ` Joseph Myers
2016-11-16 9:46 ` Will Newton
2016-11-17 13:00 ` Florian Weimer
2016-11-17 14:27 ` Joseph Myers
2016-11-17 14:50 ` Steve Vormwald
2016-11-17 16:08 ` Adhemerval Zanella
2016-11-18 9:13 ` Florian Weimer
2016-11-18 17:29 ` Steve Vormwald
2016-11-21 19:43 ` DJ Delorie
2016-11-22 15:12 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161026150218.3F1A4439942E0@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).