summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorTim Moore <timoore@redhat.com>2009-12-10 21:36:43 +0100
committerTim Moore <timoore@redhat.com>2009-12-10 21:36:43 +0100
commita6b3c131a27bbf3533d7ce52bb320698edb60f9c (patch)
treee11b9ef96482de802cb4c078296dcb7ee88f13c5 /runtime
parent1b9fad80af5504ef03c2a88504dbc47bea003721 (diff)
parentb25c01a187d636f1bd3c8c414e7dbe3e84c1b266 (diff)
downloadsystemtap-steved-a6b3c131a27bbf3533d7ce52bb320698edb60f9c.tar.gz
systemtap-steved-a6b3c131a27bbf3533d7ce52bb320698edb60f9c.tar.xz
systemtap-steved-a6b3c131a27bbf3533d7ce52bb320698edb60f9c.zip
Merge commit 'origin/master'
Diffstat (limited to 'runtime')
-rw-r--r--runtime/addr-map.c11
-rw-r--r--runtime/itrace.c9
-rw-r--r--runtime/stat-common.c18
3 files changed, 24 insertions, 14 deletions
diff --git a/runtime/addr-map.c b/runtime/addr-map.c
index 35de7a64..abb723f3 100644
--- a/runtime/addr-map.c
+++ b/runtime/addr-map.c
@@ -163,12 +163,11 @@ add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr,
spin_unlock(&addr_map_lock);
if (new_map)
{
- kfree(new_map);
+ _stp_kfree(new_map);
new_map = 0;
}
- new_map = kmalloc(sizeof(*new_map)
- + sizeof(*new_entry) * (old_size + 1),
- GFP_KERNEL);
+ new_map = _stp_kmalloc(sizeof(*new_map)
+ + sizeof(*new_entry) * (old_size + 1));
if (!new_map)
return -ENOMEM;
new_map->size = old_size + 1;
@@ -191,7 +190,7 @@ add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr,
if (existing_max)
*existing_max = max_entry;
spin_unlock(&addr_map_lock);
- kfree(new_map);
+ _stp_kfree(new_map);
return 1;
}
existing = upper_bound(min_addr, old_map);
@@ -210,7 +209,7 @@ add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr,
blackmap = new_map;
spin_unlock(&addr_map_lock);
if (old_map)
- kfree(old_map);
+ _stp_kfree(old_map);
return 0;
}
diff --git a/runtime/itrace.c b/runtime/itrace.c
index f2ed86f2..5b2437a4 100644
--- a/runtime/itrace.c
+++ b/runtime/itrace.c
@@ -219,7 +219,12 @@ static struct itrace_info *create_itrace_info(
if (debug)
printk(KERN_INFO "create_itrace_info: tid=%d\n", tsk->pid);
/* initialize ui */
- ui = kzalloc(sizeof(struct itrace_info), GFP_USER);
+ ui = _stp_kzalloc(sizeof(struct itrace_info));
+ if (ui == NULL) {
+ printk(KERN_ERR "%s:%d: Unable to allocate memory\n",
+ __FUNCTION__, __LINE__);
+ return NULL;
+ }
ui->tsk = tsk;
ui->tid = tsk->pid;
ui->step_flag = step_flag;
@@ -329,7 +334,7 @@ void static remove_usr_itrace_info(struct itrace_info *ui)
spin_lock(&itrace_lock);
list_del(&ui->link);
spin_unlock(&itrace_lock);
- kfree(ui);
+ _stp_kfree(ui);
}
void static cleanup_usr_itrace(void)
diff --git a/runtime/stat-common.c b/runtime/stat-common.c
index f9703049..fabe8404 100644
--- a/runtime/stat-common.c
+++ b/runtime/stat-common.c
@@ -34,9 +34,10 @@ static int _stp_stat_calc_buckets(int stop, int start, int interval)
return buckets;
}
-static int needed_space(uint64_t v)
+static int needed_space(int64_t v)
{
int space = 0;
+ uint64_t tmp;
if (v == 0)
return 1;
@@ -45,9 +46,10 @@ static int needed_space(uint64_t v)
space++;
v = -v;
}
- while (v) {
+ tmp = v;
+ while (tmp) {
/* v /= 10; */
- do_div (v, 10);
+ do_div(tmp, 10);
space++;
}
return space;
@@ -134,7 +136,8 @@ static void _stp_stat_print_histogram_buf(char *buf, size_t size, Hist st, stat
{
int scale, i, j, val_space, cnt_space;
int low_bucket = -1, high_bucket = 0, over = 0, under = 0;
- uint64_t val, v, valmax = 0;
+ int64_t val, valmax = 0;
+ uint64_t v;
int eliding = 0;
char *cur_buf = buf, *fake = buf;
char **bufptr = (buf == NULL ? &fake : &cur_buf);
@@ -282,7 +285,7 @@ static void _stp_stat_print_histogram(Hist st, stat *sd)
_stp_print_flush();
}
-static void __stp_stat_add (Hist st, stat *sd, uint64_t val)
+static void __stp_stat_add(Hist st, stat *sd, int64_t val)
{
int n;
if (sd->count == 0) {
@@ -310,7 +313,10 @@ static void __stp_stat_add (Hist st, stat *sd, uint64_t val)
if (val < 0)
val = 0;
else {
- do_div (val, st->interval);
+ uint64_t tmp = val;
+
+ do_div(tmp, st->interval);
+ val = tmp;
val++;
}