2 * Copyright (c) 1987 Regents of the University of California.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * @(#)malloc.h 7.25 (Berkeley) 5/15/91
42 #define M_WAITOK 0x0000
43 #define M_NOWAIT 0x0001
46 * Types of memory to be allocated
48 #define M_FREE 0 /* should be on free list */
49 #define M_MBUF 1 /* mbuf */
50 #define M_SOCKET 2 /* socket structure */
51 #define M_PCB 3 /* protocol control block */
52 #define M_RTABLE 4 /* routing tables */
53 #define M_HTABLE 5 /* IMP host tables */
54 #define M_FTABLE 6 /* fragment reassembly header */
55 #define M_IFADDR 7 /* interface address */
56 #define M_SOOPTS 8 /* socket options */
57 #define M_SONAME 9 /* socket name */
58 #define M_IOCTLOPS 10 /* ioctl data buffer */
59 #define M_FILEDESC 11 /* Open file descriptor table */
60 #define M_TEMP 12 /* misc temporary data buffers */
61 #define M_IFNET 13 /* network interface structure */
62 #define M_CFGVAR 14 /* configureable variable */
63 #define M_NETDB 15 /* netdb node */
64 #define M_ARPENT 16 /* ARP entry */
70 * Use malloc & free of the standard library.
72 * NOTE: Because these are called from different tasks concurrently, these
73 * have to be protected with a mutex.
75 #ifndef AMIGA_INCLUDES_H
76 #include <kern/amiga_includes.h>
80 #include <sys/cdefs.h>
84 * prototype for the initialization function
86 BOOL
malloc_init(void);
89 * prototypes for BSD malloc wrapper functions.
92 #ifndef USE_MALLOC_TYPE_TRACKING
94 * These macros are used to prevent unnecessary passing of arguments, which
95 * are currently not used.
97 #define bsd_malloc(size, type, flags) bsd_malloc(size)
98 #define bsd_free(addr, type) bsd_free(addr)
99 #define bsd_realloc(mem, size, type, flags) bsd_realloc(mem, size)
102 void * bsd_malloc(unsigned long size
, int type
, int flags
);
103 void bsd_free(void *addr
, int type
);
104 void * bsd_realloc(void * mem
, unsigned long size
, int type
, int flags
);
107 * Macro versions for the usual cases of malloc/free
109 #define MALLOC(space, cast, size, type, flags) \
110 (space) = (cast)bsd_malloc((u_long)(size), type, flags)
111 #define FREE(addr, type) bsd_free((caddr_t)(addr), type)
114 #endif /* !SYS_MALLOC_H */