From owner-svn-src-head@FreeBSD.ORG Sat May 25 18:59:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C5DA16E9; Sat, 25 May 2013 18:59:12 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B61B1FE4; Sat, 25 May 2013 18:59:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r4PIxCKM053348; Sat, 25 May 2013 18:59:12 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r4PIxChc053341; Sat, 25 May 2013 18:59:12 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201305251859.r4PIxChc053341@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 25 May 2013 18:59:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250991 - in head: contrib/jemalloc/include/jemalloc include lib/libc/stdlib/jemalloc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2013 18:59:12 -0000 Author: marcel Date: Sat May 25 18:59:11 2013 New Revision: 250991 URL: http://svnweb.freebsd.org/changeset/base/250991 Log: 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 Modified: head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h head/include/malloc_np.h head/lib/libc/stdlib/jemalloc/Symbol.map Modified: head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Sat May 25 18:55:55 2013 (r250990) +++ head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Sat May 25 18:59:11 2013 (r250991) @@ -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 + Modified: head/include/malloc_np.h ============================================================================== --- head/include/malloc_np.h Sat May 25 18:55:55 2013 (r250990) +++ head/include/malloc_np.h Sat May 25 18:59:11 2013 (r250991) @@ -61,6 +61,18 @@ int rallocm(void **ptr, size_t *rsize, s int sallocm(const void *ptr, size_t *rsize, int flags) __nonnull(1); int dallocm(void *ptr, int flags) __nonnull(1); int nallocm(size_t *rsize, size_t size, int flags); + +void * __calloc(size_t, size_t) __malloc_like; +void * __malloc(size_t) __malloc_like; +void * __realloc(void *, size_t); +void __free(void *); +int __posix_memalign(void **, size_t, size_t); +size_t __malloc_usable_size(const void *); +int __allocm(void **, size_t *, size_t, int) __nonnull(1); +int __rallocm(void **, size_t *, size_t, size_t, int) __nonnull(1); +int __sallocm(const void *, size_t *, int) __nonnull(1); +int __dallocm(void *, int) __nonnull(1); +int __nallocm(size_t *, size_t, int); __END_DECLS #endif /* _MALLOC_NP_H_ */ Modified: head/lib/libc/stdlib/jemalloc/Symbol.map ============================================================================== --- head/lib/libc/stdlib/jemalloc/Symbol.map Sat May 25 18:55:55 2013 (r250990) +++ head/lib/libc/stdlib/jemalloc/Symbol.map Sat May 25 18:59:11 2013 (r250991) @@ -26,6 +26,17 @@ FBSD_1.3 { sallocm; dallocm; nallocm; + __malloc; + __calloc; + __realloc; + __free; + __posix_memalign; + __malloc_usable_size; + __allocm; + __rallocm; + __sallocm; + __dallocm; + __nallocm; }; FBSDprivate_1.0 {