xref: /illumos-gate/usr/src/compat/bhyve/sys/malloc.h (revision d0b3c59b)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2013 Pluribus Networks Inc.
14  */
15 
16 #ifndef _COMPAT_FREEBSD_SYS_MALLOC_H_
17 #define	_COMPAT_FREEBSD_SYS_MALLOC_H_
18 
19 /*
20  * flags to malloc.
21  */
22 #define	M_NOWAIT	0x0001		/* do not block */
23 #define	M_WAITOK	0x0002		/* ok to block */
24 #define	M_ZERO		0x0100		/* bzero the allocation */
25 
26 struct malloc_type {
27 	const char	*ks_shortdesc;	/* Printable type name. */
28 };
29 
30 #ifdef	_KERNEL
31 #define	MALLOC_DEFINE(type, shortdesc, longdesc)			\
32 	struct malloc_type type[1] = {					\
33 		{ shortdesc }						\
34 	}
35 
36 #define	MALLOC_DECLARE(type)						\
37 	extern struct malloc_type type[1]
38 
39 void	free(void *addr, struct malloc_type *type);
40 void	*malloc(unsigned long size, struct malloc_type *type, int flags);
41 void	*old_malloc(unsigned long size, struct malloc_type *type , int flags);
42 void	*contigmalloc(unsigned long, struct malloc_type *, int, vm_paddr_t,
43     vm_paddr_t, unsigned long, vm_paddr_t);
44 void	contigfree(void *, unsigned long, struct malloc_type *);
45 
46 
47 #endif	/* _KERNEL */
48 
49 #endif	/* _COMPAT_FREEBSD_SYS_MALLOC_H_ */
50