]>
Commit | Line | Data |
---|---|---|
db137867 AC |
1 | /* |
2 | * ircd-ratbox: A slightly useful ircd. | |
3 | * balloc.h: The ircd block allocator header. | |
4 | * | |
5 | * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center | |
6 | * Copyright (C) 1996-2002 Hybrid Development Team | |
7 | * Copyright (C) 2002-2005 ircd-ratbox development team | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License as published by | |
11 | * the Free Software Foundation; either version 2 of the License, or | |
12 | * (at your option) any later version. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | * GNU General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with this program; if not, write to the Free Software | |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 | |
22 | * USA | |
23 | * | |
db137867 AC |
24 | */ |
25 | ||
26 | #ifndef RB_LIB_H | |
27 | # error "Do not use balloc.h directly" | |
28 | #endif | |
29 | ||
30 | #ifndef INCLUDED_balloc_h | |
31 | #define INCLUDED_balloc_h | |
32 | ||
33 | ||
34 | struct rb_bh; | |
35 | typedef struct rb_bh rb_bh; | |
3202e249 VY |
36 | typedef void rb_bh_usage_cb (size_t bused, size_t bfree, size_t bmemusage, size_t heapalloc, |
37 | const char *desc, void *data); | |
db137867 AC |
38 | |
39 | ||
40 | int rb_bh_free(rb_bh *, void *); | |
41 | void *rb_bh_alloc(rb_bh *); | |
42 | ||
43 | rb_bh *rb_bh_create(size_t elemsize, int elemsperblock, const char *desc); | |
3202e249 | 44 | int rb_bh_destroy(rb_bh *bh); |
db137867 | 45 | void rb_init_bh(void); |
3202e249 | 46 | void rb_bh_usage(rb_bh *bh, size_t *bused, size_t *bfree, size_t *bmemusage, const char **desc); |
db137867 AC |
47 | void rb_bh_usage_all(rb_bh_usage_cb *cb, void *data); |
48 | void rb_bh_total_usage(size_t *total_alloc, size_t *total_used); | |
49 | ||
50 | #endif /* INCLUDED_balloc_h */ |