]> git.ipfire.org Git - thirdparty/glibc.git/blame - malloc/mcheck.h
malloc: Fix tcache leak after thread destruction [BZ #22111]
[thirdparty/glibc.git] / malloc / mcheck.h
CommitLineData
bfff8b1b 1/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
6d52618b
UD
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
6d52618b
UD
8
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
41bdb6e2 12 Lesser General Public License for more details.
6d52618b 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
6d52618b
UD
17
18#ifndef _MCHECK_H
6c8dbf00 19#define _MCHECK_H 1
6d52618b 20
bd355af0 21#include <features.h>
6d52618b 22
bd355af0 23__BEGIN_DECLS
6d52618b
UD
24
25/* Return values for `mprobe': these are the kinds of inconsistencies that
26 `mcheck' enables detection of. */
27enum mcheck_status
6c8dbf00
OB
28{
29 MCHECK_DISABLED = -1, /* Consistency checking is not turned on. */
30 MCHECK_OK, /* Block is fine. */
31 MCHECK_FREE, /* Block freed twice. */
32 MCHECK_HEAD, /* Memory before the block was clobbered. */
33 MCHECK_TAIL /* Memory after the block was clobbered. */
34};
6d52618b
UD
35
36
37/* Activate a standard collection of debugging hooks. This must be called
38 before `malloc' is ever called. ABORTFUNC is called with an error code
39 (see enum above) when an inconsistency is detected. If ABORTFUNC is
40 null, the standard function prints on stderr and then calls `abort'. */
6c8dbf00 41extern int mcheck (void (*__abortfunc)(enum mcheck_status)) __THROW;
6d52618b 42
8a426e12 43/* Similar to `mcheck' but performs checks for all block whenever one of
8e605e78 44 the memory handling functions is called. This can be very slow. */
6c8dbf00 45extern int mcheck_pedantic (void (*__abortfunc)(enum mcheck_status)) __THROW;
8e605e78 46
77e1d15a
UD
47/* Force check of all blocks now. */
48extern void mcheck_check_all (void);
49
6d52618b
UD
50/* Check for aberrations in a particular malloc'd block. You must have
51 called `mcheck' already. These are the same checks that `mcheck' does
52 when you free or reallocate a block. */
c1422e5b 53extern enum mcheck_status mprobe (void *__ptr) __THROW;
6d52618b
UD
54
55/* Activate a standard collection of tracing hooks. */
c1422e5b
UD
56extern void mtrace (void) __THROW;
57extern void muntrace (void) __THROW;
6d52618b 58
bd355af0 59__END_DECLS
6d52618b 60#endif /* mcheck.h */