1 /* $NetBSD: alloc.h,v 1.1.1.3 2014/07/12 11:57:57 spz Exp $ */
4 Definitions for the object management API protocol memory allocation... */
7 * Copyright (c) 2004,2009,2014 by Internet Systems Consortium, Inc. ("ISC")
8 * Copyright (c) 1996-2003 by Internet Software Consortium
10 * Permission to use, copy, modify, and distribute this software for any
11 * purpose with or without fee is hereby granted, provided that the above
12 * copyright notice and this permission notice appear in all copies.
14 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
15 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
17 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
20 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 * Internet Systems Consortium, Inc.
24 * Redwood City, CA 94063
26 * https://www.isc.org/
30 isc_result_t
omapi_buffer_new (omapi_buffer_t
**, const char *, int);
31 isc_result_t
omapi_buffer_reference (omapi_buffer_t
**,
32 omapi_buffer_t
*, const char *, int);
33 isc_result_t
omapi_buffer_dereference (omapi_buffer_t
**, const char *, int);
35 #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
36 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
37 #define DMDOFFSET (sizeof (struct dmalloc_preamble))
40 #define DMDSIZE (DMDOFFSET + DMLFSIZE + DMUFSIZE)
42 struct dmalloc_preamble
{
43 struct dmalloc_preamble
*prev
, *next
;
47 unsigned long generation
;
48 unsigned char low_fence
[DMLFSIZE
];
55 /* rc_history flags... */
59 #if defined (DEBUG_RC_HISTORY)
60 #if !defined (RC_HISTORY_MAX)
61 # define RC_HISTORY_MAX 256
64 #if !defined (RC_HISTORY_FLAGS)
65 # define RC_HISTORY_FLAGS (RC_LEASE | RC_MISC)
68 struct rc_history_entry
{
76 #define rc_register(x, l, r, y, z, d, f) do { \
77 if (RC_HISTORY_FLAGS & ~(f)) { \
78 rc_history [rc_history_index].file = (x); \
79 rc_history [rc_history_index].line = (l); \
80 rc_history [rc_history_index].reference = (r); \
81 rc_history [rc_history_index].addr = (y); \
82 rc_history [rc_history_index].refcnt = (z); \
83 rc_history_next (d); \
86 #define rc_register_mdl(r, y, z, d, f) \
87 rc_register (__FILE__, __LINE__, r, y, z, d, f)
89 #define rc_register(file, line, reference, addr, refcnt, d, f)
90 #define rc_register_mdl(reference, addr, refcnt, d, f)
93 #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
94 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
95 extern struct dmalloc_preamble
*dmalloc_list
;
96 extern unsigned long dmalloc_outstanding
;
97 extern unsigned long dmalloc_longterm
;
98 extern unsigned long dmalloc_generation
;
99 extern unsigned long dmalloc_cutoff_generation
;
102 #if defined (DEBUG_RC_HISTORY)
103 extern struct rc_history_entry rc_history
[RC_HISTORY_MAX
];
104 extern int rc_history_index
;
105 extern int rc_history_count
;