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 5This program is free software; you can redistribute it and/or modify 6it under the terms of the GNU General Public License as published by 7the Free Software Foundation; either version 2 of the License, or 8(at your option) any later version. 9 10This program is distributed in the hope that it will be useful, 11but WITHOUT ANY WARRANTY; without even the implied warranty of 12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13GNU General Public License for more details. 14 15You should have received a copy of the GNU General Public License 16along with this program; if not, write to the Free Software 17Foundation, 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 42extern PTR_T sh_malloc __P((size_t, const char *, int)); 43extern PTR_T sh_realloc __P((PTR_T, size_t, const char *, int)); 44extern void sh_free __P((PTR_T, const char *, int)); 45 46extern PTR_T sh_memalign __P((size_t, size_t, const char *, int)); 47 48extern PTR_T sh_calloc __P((size_t, size_t, const char *, int)); 49extern void sh_cfree __P((PTR_T, const char *, int)); 50 51extern PTR_T sh_valloc __P((size_t, const char *, int)); 52 53/* trace.c */ 54extern int malloc_set_trace __P((int)); 55extern void malloc_set_tracefp (); /* full prototype requires stdio.h */ 56extern void malloc_set_tracefn __P((char *, char *)); 57 58/* table.c */ 59extern void mregister_dump_table __P((void)); 60extern void mregister_table_init __P((void)); 61extern int malloc_set_register __P((int)); 62 63/* stats.c */ 64extern void print_malloc_stats __P((char *)); 65extern void fprint_malloc_stats (); /* full prototype requires stdio.h */ 66extern void trace_malloc_stats __P((char *, char *)); 67 68#endif 69