diff options
author | marcel <marcel@FreeBSD.org> | 2013-05-25 18:59:11 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2013-05-25 18:59:11 +0000 |
commit | ff42d21b8e7e6a88887d0177722647288e50d5de (patch) | |
tree | 86648e7fa642748db2de1b9e749755c1bde26f45 /contrib/jemalloc | |
parent | baa7787a1615684fed0bcb39383aab75f401c649 (diff) | |
download | FreeBSD-src-ff42d21b8e7e6a88887d0177722647288e50d5de.zip FreeBSD-src-ff42d21b8e7e6a88887d0177722647288e50d5de.tar.gz |
Make the malloc(3) family of functions weak and make their non-weak
implementations visible for use by applications. The functions $F that
are now weak symbols are:
allocm, calloc, dallocm, free, malloc, malloc_usable_size,
nallocm, posix_memalign, rallocm, realloc, sallocm
The non-weak implementations of $F are exported as __$F.
Submitted by: stevek@juniper.net
Reviewed by: jasone@, kib@
Approved by: jasone@ (jemalloc)
Obtained from: juniper Networks, Inc
Diffstat (limited to 'contrib/jemalloc')
-rw-r--r-- | contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h b/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h index 9c97a13..e6c8407 100644 --- a/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h +++ b/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h @@ -68,9 +68,50 @@ extern int __isthreaded; #define isthreaded ((bool)__isthreaded) /* Mangle. */ +#undef je_malloc +#undef je_calloc +#undef je_realloc +#undef je_free +#undef je_posix_memalign +#undef je_malloc_usable_size +#undef je_allocm +#undef je_rallocm +#undef je_sallocm +#undef je_dallocm +#undef je_nallocm +#define je_malloc __malloc +#define je_calloc __calloc +#define je_realloc __realloc +#define je_free __free +#define je_posix_memalign __posix_memalign +#define je_malloc_usable_size __malloc_usable_size +#define je_allocm __allocm +#define je_rallocm __rallocm +#define je_sallocm __sallocm +#define je_dallocm __dallocm +#define je_nallocm __nallocm #define open _open #define read _read #define write _write #define close _close #define pthread_mutex_lock _pthread_mutex_lock #define pthread_mutex_unlock _pthread_mutex_unlock + +#ifdef JEMALLOC_C_ +/* + * Define 'weak' symbols so that an application can have its own versions + * of malloc, calloc, realloc, free, et al. + */ +__weak_reference(__malloc, malloc); +__weak_reference(__calloc, calloc); +__weak_reference(__realloc, realloc); +__weak_reference(__free, free); +__weak_reference(__posix_memalign, posix_memalign); +__weak_reference(__malloc_usable_size, malloc_usable_size); +__weak_reference(__allocm, allocm); +__weak_reference(__rallocm, rallocm); +__weak_reference(__sallocm, sallocm); +__weak_reference(__dallocm, dallocm); +__weak_reference(__nallocm, nallocm); +#endif + |