]> Git Repo - u-boot.git/blob - include/mcheck.h
Merge patch series "mcheck implementation for U-Boot"
[u-boot.git] / include / mcheck.h
1 /* SPDX-License-Identifier: GPL-2.1+ */
2 /*
3  * Copyright (C) 1996-2024 Free Software Foundation, Inc.
4  * This file is part of the GNU C Library.
5  *
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.
10  *
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/>.
16  */
17 #ifndef _MCHECK_H
18 #define _MCHECK_H       1
19
20 /*
21  * Return values for `mprobe': these are the kinds of inconsistencies that
22  * `mcheck' enables detection of.
23  */
24 enum mcheck_status {
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.  */
30 };
31
32 typedef void (*mcheck_abortfunc_t)(enum mcheck_status, const void *p);
33
34 int mcheck(mcheck_abortfunc_t func);
35
36 /*
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.
39  */
40 int mcheck_pedantic(mcheck_abortfunc_t f);
41
42 /* Force check of all blocks now.  */
43 void mcheck_check_all(void);
44
45 /*
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.
48  */
49 enum mcheck_status mprobe(void *__ptr);
50
51 #endif
This page took 0.029561 seconds and 4 git commands to generate.