| 1 | /* Functions (currently) for use by the shell to do malloc debugging and
|
|---|
| 2 | tracking. */
|
|---|
| 3 | /* Copyright (C) 2001-2003 Free Software Foundation, Inc.
|
|---|
| 4 |
|
|---|
| 5 | This program is free software; you can redistribute it and/or modify
|
|---|
| 6 | it under the terms of the GNU General Public License as published by
|
|---|
| 7 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 8 | (at your option) any later version.
|
|---|
| 9 |
|
|---|
| 10 | This program is distributed in the hope that it will be useful,
|
|---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 13 | GNU General Public License for more details.
|
|---|
| 14 |
|
|---|
| 15 | You should have received a copy of the GNU General Public License
|
|---|
| 16 | along with this program; if not, write to the Free Software
|
|---|
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
|---|
| 18 |
|
|---|
| 19 | #ifndef _SH_MALLOC_H
|
|---|
| 20 | #define _SH_MALLOC_H
|
|---|
| 21 |
|
|---|
| 22 | #ifndef __P
|
|---|
| 23 | # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
|
|---|
| 24 | # define __P(protos) protos
|
|---|
| 25 | # else
|
|---|
| 26 | # define __P(protos) ()
|
|---|
| 27 | # endif
|
|---|
| 28 | #endif
|
|---|
| 29 |
|
|---|
| 30 | /* Generic pointer type. */
|
|---|
| 31 | #ifndef PTR_T
|
|---|
| 32 |
|
|---|
| 33 | #if defined (__STDC__)
|
|---|
| 34 | # define PTR_T void *
|
|---|
| 35 | #else
|
|---|
| 36 | # define PTR_T char *
|
|---|
| 37 | #endif
|
|---|
| 38 |
|
|---|
| 39 | #endif /* PTR_T */
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 | extern PTR_T sh_malloc __P((size_t, const char *, int));
|
|---|
| 43 | extern PTR_T sh_realloc __P((PTR_T, size_t, const char *, int));
|
|---|
| 44 | extern void sh_free __P((PTR_T, const char *, int));
|
|---|
| 45 |
|
|---|
| 46 | extern PTR_T sh_memalign __P((size_t, size_t, const char *, int));
|
|---|
| 47 |
|
|---|
| 48 | extern PTR_T sh_calloc __P((size_t, size_t, const char *, int));
|
|---|
| 49 | extern void sh_cfree __P((PTR_T, const char *, int));
|
|---|
| 50 |
|
|---|
| 51 | extern PTR_T sh_valloc __P((size_t, const char *, int));
|
|---|
| 52 |
|
|---|
| 53 | /* trace.c */
|
|---|
| 54 | extern int malloc_set_trace __P((int));
|
|---|
| 55 | extern void malloc_set_tracefp (); /* full prototype requires stdio.h */
|
|---|
| 56 | extern void malloc_set_tracefn __P((char *, char *));
|
|---|
| 57 |
|
|---|
| 58 | /* table.c */
|
|---|
| 59 | extern void mregister_dump_table __P((void));
|
|---|
| 60 | extern void mregister_table_init __P((void));
|
|---|
| 61 | extern int malloc_set_register __P((int));
|
|---|
| 62 |
|
|---|
| 63 | /* stats.c */
|
|---|
| 64 | extern void print_malloc_stats __P((char *));
|
|---|
| 65 | extern void fprint_malloc_stats (); /* full prototype requires stdio.h */
|
|---|
| 66 | extern void trace_malloc_stats __P((char *, char *));
|
|---|
| 67 |
|
|---|
| 68 | #endif
|
|---|