Debian Codegraph @

runtime/dyninst/alloc.c

raw
1 /* -*- linux-c -*-
2 * Memory allocation functions
3 * Copyright (C) 2012 Red Hat Inc.
4 *
5 * This file is part of systemtap, and is free software. You can
6 * redistribute it and/or modify it under the terms of the GNU General
7 * Public License (GPL); either version 2, or (at your option) any
8 * later version.
9 */
10
11 #ifndef _STAPDYN_ALLOC_C_
12 #define _STAPDYN_ALLOC_C_
13
14 #include <stdlib.h>
15
16
17 #define STP_ALLOC_FLAGS 0
18 #define STP_ALLOC_SLEEP_FLAGS 0
19
20
21 #define _stp_kmalloc(size) malloc((size))
22 #define _stp_kmalloc_gfp(size, gfp_mask) malloc((size))
23
24 #define _stp_kzalloc(size) calloc((size), 1)
25 #define _stp_kzalloc_gfp(size, gfp_mask) calloc((size), 1)
26
27 #define _stp_kfree(addr) free(addr)
28
29
30 /* XXX for now, act like uniprocessor... */
31 #define _stp_alloc_percpu(size) calloc((size), 1)
32 #define _stp_free_percpu(addr) free((addr))
33 #define per_cpu_ptr(ptr, cpu) (ptr)
34
35
36 /* XXX for now, we're NUMA unaware */
37 #define _stp_kmalloc_node(size, node) malloc((size))
38 #define _stp_kmalloc_node_gfp(size, node, gfp_mask) malloc((size))
39
40 #define _stp_kzalloc_node(size, node) calloc((size), 1)
41 #define _stp_kzalloc_node_gfp(size, node, gfp_mask) calloc((size), 1)
42
43
44 #endif /* _STAPDYN_ALLOC_C_ */
45