File: heap_entry.h

package info (click to toggle)
njamd 0.9.3pre2-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,704 kB
  • ctags: 1,056
  • sloc: ansic: 9,367; sh: 7,921; makefile: 121; perl: 52
file content (36 lines) | stat: -rw-r--r-- 1,094 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/** 
 * @file heap_entry.h
 * Header for heap entry.
 *
 * Copyright (C) 2000 by Mike Perry.
 * Distributed WITHOUT WARRANTY under the GPL. See COPYING for details.
 * 
 */
#ifndef __NJ_LIB_HEAP_ENTRY_H__
#define __NJ_LIB_HEAP_ENTRY_H__
#include <lib/callstack.h>
#include <config.h>

/** Heap entry. Describes a block of memory */
struct nj_heap_entry
{
	nj_addr_t block; 			 		/**< Location of block in memory */
	struct nj_callstack freed;			/**< Free callstack */
	struct nj_callstack alloced;		/**< Allocation callstack */
	u_int  alloc_type : 2;				/**< Allocation Type */
	u_int  align_shift : 3;				/**< Logarithmic scale of alignment (max 128) */
	size_t user_len : sizeof(size_t)*8 - 5; /**< Length of the user segment (max 128M) */
};

/** @TODO writeme */
#define LOG2(x)

/** 
 * Determines if an entry is free. We store a special return address
 * (NJ_RETADDR_NOTFREE) in the freed stacktrace if an entry is not free.
 * @see __nj_new_heap_entry()
 */
#define NJ_HEAP_ENTRY_FREED(entry)		((entry)->freed.index != NJ_CALLSTACK_INDEX_NOTFREE)

#endif /* Heap entry.h */
// vim:ts=4