1/*- 2 * Copyright (c) 2019 The NetBSD Foundation, Inc. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to The NetBSD Foundation 6 * by Christos Zoulas. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30#if HAVE_JEMALLOC > 100 31#include <malloc.h> 32 33void *__je_mallocx(size_t, int); 34void * 35mallocx(size_t l, int f) 36{ 37 return __je_mallocx(l, f); 38} 39 40void *__je_rallocx(void *, size_t, int); 41void * 42rallocx(void *p, size_t l, int f) 43{ 44 return __je_rallocx(p, l, f); 45} 46 47size_t __je_xallocx(void *, size_t, size_t, int); 48size_t 49xallocx(void *p, size_t l, size_t s, int f) 50{ 51 return __je_xallocx(p, l, s, f); 52} 53 54size_t __je_sallocx(const void *, int); 55size_t 56sallocx(const void *p, int f) 57{ 58 return __je_sallocx(p, f); 59} 60 61void __je_dallocx(void *, int); 62void 63dallocx(void *p, int f) 64{ 65 __je_dallocx(p, f); 66} 67 68void __je_sdallocx(void *, size_t, int); 69void 70sdallocx(void *p, size_t l, int f) 71{ 72 __je_sdallocx(p, l, f); 73} 74 75size_t __je_nallocx(size_t, int); 76size_t 77nallocx(size_t l, int f) 78{ 79 return __je_nallocx(l, f); 80} 81 82int __je_mallctl(const char *, void *, size_t *, void *, size_t); 83int 84mallctl(const char *n, void *p, size_t *s, void *v, size_t l) 85{ 86 return __je_mallctl(n, p, s, v, l); 87} 88 89int __je_mallctlnametomib(const char *, size_t *, size_t *); 90int 91mallctlnametomib(const char *n, size_t *l, size_t *s) 92{ 93 return __je_mallctlnametomib(n, l, s); 94} 95 96int __je_mallctlbymib(const size_t *, size_t, void *, size_t *, void *, size_t); 97int 98mallctlbymib(const size_t *sp, size_t s, void *p , size_t *dp, void *r , 99 size_t l) 100{ 101 return __je_mallctlbymib(sp, s, p , dp, r, l); 102} 103 104void __je_malloc_stats_print(void (*)(void *, const char *), void *, 105 const char *); 106void 107malloc_stats_print(void (*f)(void *, const char *), void *p, const char *n) 108{ 109 __je_malloc_stats_print(f, p, n); 110} 111 112size_t __je_malloc_usable_size(const void *); 113size_t 114malloc_usable_size(const void *p) 115{ 116 return __je_malloc_usable_size(p); 117} 118void (*__je_malloc_message_get(void))(void *, const char *); 119void (* 120malloc_message_get(void))(void *, const char *) 121{ 122 return __je_malloc_message_get(); 123} 124 125void __je_malloc_message_set(void (*)(void *, const char *)); 126void 127malloc_message_set(void (*m)(void *, const char *)) 128{ 129 __je_malloc_message_set(m); 130} 131 132const char *__je_malloc_conf_get(void); 133const char * 134malloc_conf_get(void) 135{ 136 return __je_malloc_conf_get(); 137} 138 139void __je_malloc_conf_set(const char *); 140void malloc_conf_set(const char *m) 141{ 142 __je_malloc_conf_set(m); 143} 144#endif /* HAVE_JEMALLOC > 100 */ 145