]> jfr.im git - irc/rqf/shadowircd.git/blob - libratbox/include/rb_balloc.h
aea1f790c870b771977665c16dcf7a0165d476ca
[irc/rqf/shadowircd.git] / libratbox / include / rb_balloc.h
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 *
24 * $Id: rb_balloc.h 24324 2007-08-31 22:05:45Z androsyn $
25 */
26
27 #ifndef RB_LIB_H
28 # error "Do not use balloc.h directly"
29 #endif
30
31 #ifndef INCLUDED_balloc_h
32 #define INCLUDED_balloc_h
33
34
35 struct rb_bh;
36 typedef struct rb_bh rb_bh;
37 typedef void rb_bh_usage_cb(size_t bused, size_t bfree, size_t bmemusage, size_t heapalloc, const char *desc, void *data);
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);
44 int rb_bh_destroy(rb_bh * bh);
45 int rb_bh_gc(rb_bh *bh);
46 void rb_init_bh(void);
47 void rb_bh_usage(rb_bh * bh, size_t * bused, size_t * bfree, size_t * bmemusage, const char **desc);
48 void rb_bh_usage_all(rb_bh_usage_cb *cb, void *data);
49 void rb_bh_total_usage(size_t *total_alloc, size_t *total_used);
50
51 #endif /* INCLUDED_balloc_h */