2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
7 * AROS-thread-safe versions of libc memory allocation routines
8 * This does not work with Android's bionic.
12 This code is compiled with the kernel compiler but calls code
13 from exec.library. This can only work if function calling
14 convention for kernel and target compiler are the same.
15 Up to now this seems to be the case for all linux hosted ports
16 as UNIX calling is often taken as reference for the AROS
22 #include <proto/exec.h>
23 #include <sys/types.h>
26 #define MEMLOCK if (SysBase != NULL) Forbid();
27 #define MEMUNLOCK if (SysBase != NULL) Permit();
29 extern struct ExecBase
*SysBase
;
30 extern void * __libc_malloc(size_t);
31 extern void __libc_free(void *);
32 extern void * __libc_calloc(size_t, size_t);
33 extern void * __libc_realloc(void * mem
, size_t newsize
);
35 void * malloc(size_t size
)
41 res
= __libc_malloc(size
);
48 void free(void * addr
)
57 void * calloc(size_t n
, size_t size
)
63 res
= __libc_calloc(n
, size
);
70 void *realloc(void *ptr
, size_t size
)
76 res
= __libc_realloc(ptr
, size
);