2 * AROS-thread-safe versions of libc memory allocation routines
3 * This does not work with Android's bionic.
7 This code is compiled with the kernel compiler but calls code
8 from exec.library. This can only work if function calling
9 convention for kernel and target compiler are the same.
10 Up to now this seems to be the case for all linux hosted ports
11 as UNIX calling is often taken as reference for the AROS
17 #include <proto/exec.h>
18 #include <sys/types.h>
21 #define MEMLOCK if (SysBase != NULL) Forbid();
22 #define MEMUNLOCK if (SysBase != NULL) Permit();
24 extern struct ExecBase
*SysBase
;
25 extern void * __libc_malloc(size_t);
26 extern void __libc_free(void *);
27 extern void * __libc_calloc(size_t, size_t);
28 extern void * __libc_realloc(void * mem
, size_t newsize
);
30 void * malloc(size_t size
)
36 res
= __libc_malloc(size
);
43 void free(void * addr
)
52 void * calloc(size_t n
, size_t size
)
58 res
= __libc_calloc(n
, size
);
65 void *realloc(void *ptr
, size_t size
)
71 res
= __libc_realloc(ptr
, size
);