Fixing interpose on macOS

This commit is contained in:
daan 2019-07-02 12:49:28 -07:00
parent d35fc6cdc4
commit aeff1db32b
5 changed files with 39 additions and 25 deletions

View file

@ -50,6 +50,9 @@ terms of the MIT license. A copy of the license can be found in the file
MI_INTERPOSE_MI(malloc),
MI_INTERPOSE_MI(calloc),
MI_INTERPOSE_MI(realloc),
MI_INTERPOSE_MI(strdup),
MI_INTERPOSE_MI(strndup),
MI_INTERPOSE_MI(realpath),
MI_INTERPOSE_MI(free)
};
#else
@ -131,6 +134,12 @@ size_t malloc_size(void* p) MI_FORWARD1(mi_usable_size,p)
size_t malloc_usable_size(void *p) MI_FORWARD1(mi_usable_size,p)
void cfree(void* p) MI_FORWARD0(mi_free, p)
#ifdef __APPLE__
char* strdup(const char* s) MI_FORWARD1(mi_strdup,s)
char* strndup(const char* s, size_t n) MI_FORWARD2(mi_strndup,s,n)
char* realpath(const char* fname, char* resolved_name) MI_FORWARD2(mi_realpath,fname,resolved_name)
#endif
int posix_memalign(void** p, size_t alignment, size_t size) {
// TODO: the spec says we should return EINVAL also if alignment is not a power of 2.
// The spec also dictates we should not modify `*p` on an error. (issue#27)