Update.
[glibc.git] / malloc / mcheck.h
blob3d55bd3444769bad4e783e71ce75862d5d40ef9d
1 /* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #ifndef _MCHECK_H
20 #define _MCHECK_H 1
22 #include <features.h>
24 __BEGIN_DECLS
26 /* Return values for `mprobe': these are the kinds of inconsistencies that
27 `mcheck' enables detection of. */
28 enum mcheck_status
30 MCHECK_DISABLED = -1, /* Consistency checking is not turned on. */
31 MCHECK_OK, /* Block is fine. */
32 MCHECK_FREE, /* Block freed twice. */
33 MCHECK_HEAD, /* Memory before the block was clobbered. */
34 MCHECK_TAIL /* Memory after the block was clobbered. */
38 /* Activate a standard collection of debugging hooks. This must be called
39 before `malloc' is ever called. ABORTFUNC is called with an error code
40 (see enum above) when an inconsistency is detected. If ABORTFUNC is
41 null, the standard function prints on stderr and then calls `abort'. */
42 extern int mcheck __P ((void (*__abortfunc) (enum mcheck_status)));
44 /* Check for aberrations in a particular malloc'd block. You must have
45 called `mcheck' already. These are the same checks that `mcheck' does
46 when you free or reallocate a block. */
47 extern enum mcheck_status mprobe __P ((__ptr_t __ptr));
49 /* Activate a standard collection of tracing hooks. */
50 extern void mtrace __P ((void));
51 extern void muntrace __P ((void));
53 __END_DECLS
55 #endif /* mcheck.h */