xref: /netbsd-src/include/malloc.h (revision ec26bb08ecd7706fcf42e587a63901472e5a1c28)
1*ec26bb08Schristos /*	$NetBSD: malloc.h,v 1.8 2019/03/12 15:11:13 christos Exp $	*/
277177321Schristos 
377177321Schristos /*-
477177321Schristos  * Copyright (c) 2019 The NetBSD Foundation, Inc.
577177321Schristos  * All rights reserved.
677177321Schristos  *
777177321Schristos  * Redistribution and use in source and binary forms, with or without
877177321Schristos  * modification, are permitted provided that the following conditions
977177321Schristos  * are met:
1077177321Schristos  * 1. Redistributions of source code must retain the above copyright
1177177321Schristos  *    notice, this list of conditions and the following disclaimer.
1277177321Schristos  * 2. Redistributions in binary form must reproduce the above copyright
1377177321Schristos  *    notice, this list of conditions and the following disclaimer in the
1477177321Schristos  *    documentation and/or other materials provided with the distribution.
1577177321Schristos  *
1677177321Schristos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1777177321Schristos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1877177321Schristos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1977177321Schristos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2077177321Schristos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2177177321Schristos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2277177321Schristos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2377177321Schristos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2477177321Schristos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2577177321Schristos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2677177321Schristos  * POSSIBILITY OF SUCH DAMAGE.
2777177321Schristos  */
28d444c912Schristos 
29d444c912Schristos #ifndef _MALLOC_H_
30d444c912Schristos #define _MALLOC_H_
31aee4b07bSmycroft 
327343f8c2Sderaadt #include <stdlib.h>
33d444c912Schristos 
34d444c912Schristos __BEGIN_DECLS
35d444c912Schristos 
36d444c912Schristos void *mallocx(size_t, int);
37d444c912Schristos void *rallocx(void *, size_t, int);
38d444c912Schristos size_t xallocx(void *, size_t, size_t, int);
39*ec26bb08Schristos size_t sallocx(const void *, int);
40d444c912Schristos void dallocx(void *, int);
41d444c912Schristos void sdallocx(void *, size_t, int);
42d444c912Schristos size_t nallocx(size_t, int);
43d444c912Schristos 
44d444c912Schristos int mallctl(const char *, void *, size_t *, void *, size_t);
459610e030Schristos int mallctlnametomib(const char *, size_t *, size_t *);
46d444c912Schristos int mallctlbymib(const size_t *, size_t, void *, size_t *, void *, size_t);
47d444c912Schristos 
48d444c912Schristos void malloc_stats_print(void (*)(void *, const char *), void *, const char *);
49d444c912Schristos 
50d444c912Schristos size_t malloc_usable_size(const void *);
51d444c912Schristos 
52*ec26bb08Schristos void (*malloc_message_get(void))(void *, const char *);
53*ec26bb08Schristos void malloc_message_set(void (*)(void *, const char *));
54d444c912Schristos 
55*ec26bb08Schristos const char *malloc_conf_get(void);
56*ec26bb08Schristos void malloc_conf_set(const char *);
57d444c912Schristos 
58d444c912Schristos __END_DECLS
59d444c912Schristos 
60d444c912Schristos #endif /* _MALLOC_H_ */
61