blob: 2dac615471e1d06fb6d35e29cece61842a00d676 [file] [log] [blame]
Jari Aaltof73dda02001-11-13 17:56:06 +00001/* Functions (currently) for use by the shell to do malloc debugging and
2 tracking. */
Jari Aaltob80f6442004-07-27 13:29:18 +00003/* Copyright (C) 2001-2003 Free Software Foundation, Inc.
Jari Aaltof73dda02001-11-13 17:56:06 +00004
Jari Aalto31859422009-01-12 13:36:28 +00005 This file is part of GNU Bash, the Bourne-Again SHell.
Jari Aaltof73dda02001-11-13 17:56:06 +00006
Jari Aalto31859422009-01-12 13:36:28 +00007 Bash is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
Jari Aaltof73dda02001-11-13 17:56:06 +000011
Jari Aalto31859422009-01-12 13:36:28 +000012 Bash is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Bash. If not, see <http://www.gnu.org/licenses/>.
19*/
Jari Aaltof73dda02001-11-13 17:56:06 +000020
21#ifndef _SH_MALLOC_H
22#define _SH_MALLOC_H
23
24#ifndef __P
25# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
26# define __P(protos) protos
27# else
28# define __P(protos) ()
29# endif
30#endif
31
32/* Generic pointer type. */
33#ifndef PTR_T
34
35#if defined (__STDC__)
36# define PTR_T void *
37#else
38# define PTR_T char *
39#endif
40
41#endif /* PTR_T */
42
43
44extern PTR_T sh_malloc __P((size_t, const char *, int));
45extern PTR_T sh_realloc __P((PTR_T, size_t, const char *, int));
46extern void sh_free __P((PTR_T, const char *, int));
47
Jari Aalto95732b42005-12-07 14:08:12 +000048extern PTR_T sh_memalign __P((size_t, size_t, const char *, int));
Jari Aaltof73dda02001-11-13 17:56:06 +000049
50extern PTR_T sh_calloc __P((size_t, size_t, const char *, int));
51extern void sh_cfree __P((PTR_T, const char *, int));
52
53extern PTR_T sh_valloc __P((size_t, const char *, int));
54
55/* trace.c */
56extern int malloc_set_trace __P((int));
57extern void malloc_set_tracefp (); /* full prototype requires stdio.h */
Jari Aaltob80f6442004-07-27 13:29:18 +000058extern void malloc_set_tracefn __P((char *, char *));
Jari Aaltof73dda02001-11-13 17:56:06 +000059
60/* table.c */
61extern void mregister_dump_table __P((void));
62extern void mregister_table_init __P((void));
63extern int malloc_set_register __P((int));
64
65/* stats.c */
66extern void print_malloc_stats __P((char *));
67extern void fprint_malloc_stats (); /* full prototype requires stdio.h */
Jari Aalto7117c2d2002-07-17 14:10:11 +000068extern void trace_malloc_stats __P((char *, char *));
Jari Aaltof73dda02001-11-13 17:56:06 +000069
70#endif