1 /* SPDX-License-Identifier: GPL-2.1+ */
3 * Copyright (C) 1996-2024 Free Software Foundation, Inc.
4 * This file is part of the GNU C Library.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 * <https://www.gnu.org/licenses/>.
21 * Return values for `mprobe': these are the kinds of inconsistencies that
22 * `mcheck' enables detection of.
25 MCHECK_DISABLED = -1, /* Consistency checking is not turned on. */
26 MCHECK_OK, /* Block is fine. */
27 MCHECK_FREE, /* Block freed twice. */
28 MCHECK_HEAD, /* Memory before the block was clobbered. */
29 MCHECK_TAIL /* Memory after the block was clobbered. */
32 typedef void (*mcheck_abortfunc_t)(enum mcheck_status, const void *p);
34 int mcheck(mcheck_abortfunc_t func);
37 * Similar to `mcheck' but performs checks for all block whenever one of
38 * the memory handling functions is called. This can be very slow.
40 int mcheck_pedantic(mcheck_abortfunc_t f);
42 /* Force check of all blocks now. */
43 void mcheck_check_all(void);
46 * Check for aberrations in a particular malloc'd block. These are the
47 * same checks that `mcheck' does, when you free or reallocate a block.
49 enum mcheck_status mprobe(void *__ptr);