mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-05-06 08:15:35 -04:00
initial commit
This commit is contained in:
commit
70d61b6662
12 changed files with 1086 additions and 0 deletions
51
malloc.h
Normal file
51
malloc.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
#ifndef ALLOCATOR_H
|
||||
#define ALLOCATOR_H
|
||||
|
||||
#ifndef H_MALLOC_PREFIX
|
||||
#define h_malloc malloc
|
||||
#define h_calloc calloc
|
||||
#define h_realloc realloc
|
||||
#define h_posix_memalign posix_memalign
|
||||
#define h_aligned_alloc aligned_alloc
|
||||
#define h_memalign memalign
|
||||
#define h_valloc valloc
|
||||
#define h_pvalloc pvalloc
|
||||
#define h_free free
|
||||
#define h_malloc_usable_size malloc_usable_size
|
||||
#define h_mallopt mallopt
|
||||
#define h_malloc_trim malloc_trim
|
||||
#define h_malloc_stats malloc_stats
|
||||
#define h_mallinfo mallinfo
|
||||
#define h_malloc_info malloc_info
|
||||
#define h_malloc_get_state malloc_get_state
|
||||
#define h_malloc_set_state malloc_set_state
|
||||
#define h_cfree cfree
|
||||
#endif
|
||||
|
||||
// C standard
|
||||
void *h_malloc(size_t size);
|
||||
void *h_calloc(size_t nmemb, size_t size);
|
||||
void *h_realloc(void *ptr, size_t size);
|
||||
void *h_aligned_alloc(size_t alignment, size_t size);
|
||||
void h_free(void *ptr);
|
||||
|
||||
// POSIX
|
||||
int h_posix_memalign(void **memptr, size_t alignment, size_t size);
|
||||
|
||||
// glibc extensions
|
||||
size_t h_malloc_usable_size(void *ptr);
|
||||
int h_mallopt(int param, int value);
|
||||
int h_malloc_trim(size_t pad);
|
||||
void h_malloc_stats(void);
|
||||
struct mallinfo h_mallinfo(void);
|
||||
int h_malloc_info(int options, FILE *fp);
|
||||
void *h_malloc_get_state(void);
|
||||
int h_malloc_set_state(void *state);
|
||||
|
||||
// obsolete glibc extensions
|
||||
void *h_memalign(size_t alignment, size_t size);
|
||||
void *h_valloc(size_t size);
|
||||
void *h_pvalloc(size_t size);
|
||||
void h_cfree(void *ptr);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue