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
..
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#ifndef KImem
#define KImem
#include <k/type.h>
#ifndef KFclean
# define Kmsz(e) ( sizeof (e) / sizeof (e) [0] )
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef enum kmcond {
kmcond_ok,
kmcond_unnecessary,
kmcond_fail,
kmcond_unhandled,
kmcond_mismatch,
kmcond_bad_address,
} kmcond;
typedef enum kmkind {
kmkind_none,
kmkind_fail,
kmkind_linear,
kmkind_heap,
................................................................................
kmkind kind;
kmshred shred;
void* ref;
} kmptr;
/* heap functions */
void* kmheapa(sz);
kmptr kmheapao(sz);
kmcond kmheapf(void*);
/* generic functions */
kmcond kmfree(kmptr);
kmkind kmtell(void*);
void kmzero(void*,sz);
void kmozero(kmptr);
|
>
|
>
>
>
>
>
>
>
>
|
|
|
|
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
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#ifndef KImem
#define KImem
#include <k/type.h>
#include <k/internal.egroup.h>
#ifndef KFclean
# define Kmsz(e) ( sizeof (e) / sizeof (e) [0] )
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef enum kmcond {
kmcond_ok = kmcond_id,
kmcond_unnecessary,
kmcond_fail,
kmcond_unhandled,
kmcond_mismatch,
kmcond_bad_address,
kmcond_bad_lock,
kmcond_bad_size,
kmcond_no_room,
kmcond_too_many,
/* when something truly should
* never happen: */
kmcond_fail_assert,
} kmcond;
typedef enum kmkind {
kmkind_none,
kmkind_fail,
kmkind_linear,
kmkind_heap,
................................................................................
kmkind kind;
kmshred shred;
void* ref;
} kmptr;
/* heap functions */
kmcond kmheapa (void**, sz);
kmcond kmheapao(kmptr*, sz);
kmcond kmheapf (void*);
/* generic functions */
kmcond kmfree(kmptr);
kmkind kmtell(void*);
void kmzero(void*,sz);
void kmozero(kmptr);
|