"Das U-Boot" Source Tree
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 1996-2024 Free Software Foundation, Inc.
4 * This file is part of the GNU C Library.
5 */
6#ifndef _MCHECK_H
7#define _MCHECK_H 1
8
9/*
10 * Return values for `mprobe': these are the kinds of inconsistencies that
11 * `mcheck' enables detection of.
12 */
13enum mcheck_status {
14 MCHECK_DISABLED = -1, /* Consistency checking is not turned on. */
15 MCHECK_OK, /* Block is fine. */
16 MCHECK_FREE, /* Block freed twice. */
17 MCHECK_HEAD, /* Memory before the block was clobbered. */
18 MCHECK_TAIL /* Memory after the block was clobbered. */
19};
20
21typedef void (*mcheck_abortfunc_t)(enum mcheck_status, const void *p);
22
23int mcheck(mcheck_abortfunc_t func);
24
25/*
26 * Similar to `mcheck' but performs checks for all block whenever one of
27 * the memory handling functions is called. This can be very slow.
28 */
29int mcheck_pedantic(mcheck_abortfunc_t f);
30
31/* Force check of all blocks now. */
32void mcheck_check_all(void);
33
34/*
35 * Check for aberrations in a particular malloc'd block. These are the
36 * same checks that `mcheck' does, when you free or reallocate a block.
37 */
38enum mcheck_status mprobe(void *__ptr);
39
40#endif