malloc.h
001: 
002: 
003: 
004: 
005: 
006: 
007: 
008: 
009: 
010: 
011: 
012: 
013: 
014: 
015: 
016: 
017: 
018: 
019: 
020: 
021: #ifndef _MALLOC_H
022: #define _MALLOC_H 1
023: 
024: #include <features.h>
025: #include <stddef.h>
026: #include <stdio.h>
027: # define __malloc_ptr_t  void *
028: 
029: 
030: #define __malloc_size_t size_t
031: #define __malloc_ptrdiff_t ptrdiff_t
032: 
033: #ifdef __GNUC__
034: 
035: # define __MALLOC_P(args)       args __THROW
036: 
037: 
038: # define __MALLOC_PMT(args)     args
039: 
040: # ifdef _LIBC
041: #  define __MALLOC_HOOK_VOLATILE
042: #  define __MALLOC_DEPRECATED
043: # else
044: #  define __MALLOC_HOOK_VOLATILE __volatile
045: #  define __MALLOC_DEPRECATED __attribute_deprecated__
046: # endif
047: 
048: #else   
049: 
050: # define __MALLOC_P(args)       args
051: # define __MALLOC_PMT(args)     args
052: # define __MALLOC_HOOK_VOLATILE
053: # define __MALLOC_DEPRECATED __attribute_deprecated__
054: 
055: #endif  
056: 
057: 
058: __BEGIN_DECLS
059: 
060: 
061: extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
062: 
063: 
064: extern void *calloc (size_t __nmemb, size_t __size)
065:      __THROW __attribute_malloc__ __wur;
066: 
067: 
068: 
069: 
070: 
071: 
072: extern void *realloc (void *__ptr, size_t __size)
073:      __THROW __attribute_warn_unused_result__;
074: 
075: 
076: extern void free (void *__ptr) __THROW;
077: 
078: 
079: extern void cfree (void *__ptr) __THROW;
080: 
081: 
082: extern void *memalign (size_t __alignment, size_t __size)
083:      __THROW __attribute_malloc__ __wur;
084: 
085: 
086: extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur;
087: 
088: 
089: 
090: extern void * pvalloc (size_t __size) __THROW __attribute_malloc__ __wur;
091: 
092: 
093: 
094: extern void *(*__morecore) (ptrdiff_t __size);
095: 
096: 
097: extern void *__default_morecore (ptrdiff_t __size)
098:      __THROW __attribute_malloc__;
099: 
100: 
101: 
102: struct mallinfo
103: {
104:   int arena;    
105:   int ordblks;  
106:   int smblks;   
107:   int hblks;    
108:   int hblkhd;   
109:   int usmblks;  
110:   int fsmblks;  
111:   int uordblks; 
112:   int fordblks; 
113:   int keepcost; 
114: };
115: 
116: 
117: extern struct mallinfo mallinfo (void) __THROW;
118: 
119: 
120: #ifndef M_MXFAST
121: # define M_MXFAST  1    
122: #endif
123: #ifndef M_NLBLKS
124: # define M_NLBLKS  2    
125: #endif
126: #ifndef M_GRAIN
127: # define M_GRAIN   3    
128: #endif
129: #ifndef M_KEEP
130: # define M_KEEP    4    
131: #endif
132: 
133: 
134: #define M_TRIM_THRESHOLD    -1
135: #define M_TOP_PAD           -2
136: #define M_MMAP_THRESHOLD    -3
137: #define M_MMAP_MAX          -4
138: #define M_CHECK_ACTION      -5
139: #define M_PERTURB           -6
140: #define M_ARENA_TEST        -7
141: #define M_ARENA_MAX         -8
142: 
143: 
144: extern int mallopt (int __param, int __val) __THROW;
145: 
146: 
147: 
148: extern int malloc_trim (size_t __pad) __THROW;
149: 
150: 
151: 
152: extern size_t malloc_usable_size (void *__ptr) __THROW;
153: 
154: 
155: extern void malloc_stats (void) __THROW;
156: 
157: 
158: extern int malloc_info (int __options, FILE *__fp) __THROW;
159: 
160: 
161: extern void *malloc_get_state (void) __THROW;
162: 
163: 
164: 
165: extern int malloc_set_state (void *__ptr) __THROW;
166: 
167: 
168: 
169: 
170: extern void (*__MALLOC_HOOK_VOLATILE __malloc_initialize_hook) (void)
171:      __MALLOC_DEPRECATED;
172: 
173: extern void (*__MALLOC_HOOK_VOLATILE __free_hook) (void *__ptr,
174:                                                    __const __malloc_ptr_t)
175:      __MALLOC_DEPRECATED;
176: extern void *(*__MALLOC_HOOK_VOLATILE __malloc_hook) (size_t __size,
177:                                                       __const __malloc_ptr_t)
178:      __MALLOC_DEPRECATED;
179: extern void *(*__MALLOC_HOOK_VOLATILE __realloc_hook) (void *__ptr,
180:                                                        size_t __size,
181:                                                        __const __malloc_ptr_t)
182:      __MALLOC_DEPRECATED;
183: extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook) (size_t __alignment,
184:                                                         size_t __size,
185:                                                         __const __malloc_ptr_t)
186:      __MALLOC_DEPRECATED;
187: extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void);
188: 
189: 
190: extern void __malloc_check_init (void) __THROW __MALLOC_DEPRECATED;
191: 
192: 
193: __END_DECLS
194: 
195: #endif 
196: 
      
      
      
      
   
      
      
         
            
            © Andrew Scott 2006 -
            2025, 
            All Rights Reserved