diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-12-06 10:06:11 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2009-12-06 10:06:11 -0500 |
commit | 64357ed468025614d48daa6cc87674ae5616f8fb (patch) | |
tree | 2467c239364d7602755b73203025d329c6f84b22 /kernel/trace/trace.c | |
parent | be404f0212ffa8f67361f8ee460a25d901d88991 (diff) | |
parent | 6ec22f9b037fc0c2e00ddb7023fad279c365324d (diff) |
Merge branch 'master' into for-linus
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index c820b0310a12..874f2893cff0 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -129,7 +129,7 @@ static int tracing_set_tracer(const char *buf); | |||
129 | static char bootup_tracer_buf[MAX_TRACER_SIZE] __initdata; | 129 | static char bootup_tracer_buf[MAX_TRACER_SIZE] __initdata; |
130 | static char *default_bootup_tracer; | 130 | static char *default_bootup_tracer; |
131 | 131 | ||
132 | static int __init set_ftrace(char *str) | 132 | static int __init set_cmdline_ftrace(char *str) |
133 | { | 133 | { |
134 | strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE); | 134 | strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE); |
135 | default_bootup_tracer = bootup_tracer_buf; | 135 | default_bootup_tracer = bootup_tracer_buf; |
@@ -137,7 +137,7 @@ static int __init set_ftrace(char *str) | |||
137 | ring_buffer_expanded = 1; | 137 | ring_buffer_expanded = 1; |
138 | return 1; | 138 | return 1; |
139 | } | 139 | } |
140 | __setup("ftrace=", set_ftrace); | 140 | __setup("ftrace=", set_cmdline_ftrace); |
141 | 141 | ||
142 | static int __init set_ftrace_dump_on_oops(char *str) | 142 | static int __init set_ftrace_dump_on_oops(char *str) |
143 | { | 143 | { |
@@ -1361,10 +1361,11 @@ int trace_array_vprintk(struct trace_array *tr, | |||
1361 | pause_graph_tracing(); | 1361 | pause_graph_tracing(); |
1362 | raw_local_irq_save(irq_flags); | 1362 | raw_local_irq_save(irq_flags); |
1363 | __raw_spin_lock(&trace_buf_lock); | 1363 | __raw_spin_lock(&trace_buf_lock); |
1364 | len = vsnprintf(trace_buf, TRACE_BUF_SIZE, fmt, args); | 1364 | if (args == NULL) { |
1365 | 1365 | strncpy(trace_buf, fmt, TRACE_BUF_SIZE); | |
1366 | len = min(len, TRACE_BUF_SIZE-1); | 1366 | len = strlen(trace_buf); |
1367 | trace_buf[len] = 0; | 1367 | } else |
1368 | len = vsnprintf(trace_buf, TRACE_BUF_SIZE, fmt, args); | ||
1368 | 1369 | ||
1369 | size = sizeof(*entry) + len + 1; | 1370 | size = sizeof(*entry) + len + 1; |
1370 | buffer = tr->buffer; | 1371 | buffer = tr->buffer; |
@@ -1373,10 +1374,10 @@ int trace_array_vprintk(struct trace_array *tr, | |||
1373 | if (!event) | 1374 | if (!event) |
1374 | goto out_unlock; | 1375 | goto out_unlock; |
1375 | entry = ring_buffer_event_data(event); | 1376 | entry = ring_buffer_event_data(event); |
1376 | entry->ip = ip; | 1377 | entry->ip = ip; |
1377 | 1378 | ||
1378 | memcpy(&entry->buf, trace_buf, len); | 1379 | memcpy(&entry->buf, trace_buf, len); |
1379 | entry->buf[len] = 0; | 1380 | entry->buf[len] = '\0'; |
1380 | if (!filter_check_discard(call, entry, buffer, event)) | 1381 | if (!filter_check_discard(call, entry, buffer, event)) |
1381 | ring_buffer_unlock_commit(buffer, event); | 1382 | ring_buffer_unlock_commit(buffer, event); |
1382 | 1383 | ||
@@ -2440,7 +2441,7 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf, | |||
2440 | return ret; | 2441 | return ret; |
2441 | } | 2442 | } |
2442 | 2443 | ||
2443 | filp->f_pos += cnt; | 2444 | *ppos += cnt; |
2444 | 2445 | ||
2445 | return cnt; | 2446 | return cnt; |
2446 | } | 2447 | } |
@@ -2582,7 +2583,7 @@ tracing_ctrl_write(struct file *filp, const char __user *ubuf, | |||
2582 | } | 2583 | } |
2583 | mutex_unlock(&trace_types_lock); | 2584 | mutex_unlock(&trace_types_lock); |
2584 | 2585 | ||
2585 | filp->f_pos += cnt; | 2586 | *ppos += cnt; |
2586 | 2587 | ||
2587 | return cnt; | 2588 | return cnt; |
2588 | } | 2589 | } |
@@ -2764,7 +2765,7 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf, | |||
2764 | if (err) | 2765 | if (err) |
2765 | return err; | 2766 | return err; |
2766 | 2767 | ||
2767 | filp->f_pos += ret; | 2768 | *ppos += ret; |
2768 | 2769 | ||
2769 | return ret; | 2770 | return ret; |
2770 | } | 2771 | } |
@@ -3299,7 +3300,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, | |||
3299 | } | 3300 | } |
3300 | } | 3301 | } |
3301 | 3302 | ||
3302 | filp->f_pos += cnt; | 3303 | *ppos += cnt; |
3303 | 3304 | ||
3304 | /* If check pages failed, return ENOMEM */ | 3305 | /* If check pages failed, return ENOMEM */ |
3305 | if (tracing_disabled) | 3306 | if (tracing_disabled) |
@@ -3319,22 +3320,11 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, | |||
3319 | return cnt; | 3320 | return cnt; |
3320 | } | 3321 | } |
3321 | 3322 | ||
3322 | static int mark_printk(const char *fmt, ...) | ||
3323 | { | ||
3324 | int ret; | ||
3325 | va_list args; | ||
3326 | va_start(args, fmt); | ||
3327 | ret = trace_vprintk(0, fmt, args); | ||
3328 | va_end(args); | ||
3329 | return ret; | ||
3330 | } | ||
3331 | |||
3332 | static ssize_t | 3323 | static ssize_t |
3333 | tracing_mark_write(struct file *filp, const char __user *ubuf, | 3324 | tracing_mark_write(struct file *filp, const char __user *ubuf, |
3334 | size_t cnt, loff_t *fpos) | 3325 | size_t cnt, loff_t *fpos) |
3335 | { | 3326 | { |
3336 | char *buf; | 3327 | char *buf; |
3337 | char *end; | ||
3338 | 3328 | ||
3339 | if (tracing_disabled) | 3329 | if (tracing_disabled) |
3340 | return -EINVAL; | 3330 | return -EINVAL; |
@@ -3342,7 +3332,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, | |||
3342 | if (cnt > TRACE_BUF_SIZE) | 3332 | if (cnt > TRACE_BUF_SIZE) |
3343 | cnt = TRACE_BUF_SIZE; | 3333 | cnt = TRACE_BUF_SIZE; |
3344 | 3334 | ||
3345 | buf = kmalloc(cnt + 1, GFP_KERNEL); | 3335 | buf = kmalloc(cnt + 2, GFP_KERNEL); |
3346 | if (buf == NULL) | 3336 | if (buf == NULL) |
3347 | return -ENOMEM; | 3337 | return -ENOMEM; |
3348 | 3338 | ||
@@ -3350,14 +3340,13 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, | |||
3350 | kfree(buf); | 3340 | kfree(buf); |
3351 | return -EFAULT; | 3341 | return -EFAULT; |
3352 | } | 3342 | } |
3343 | if (buf[cnt-1] != '\n') { | ||
3344 | buf[cnt] = '\n'; | ||
3345 | buf[cnt+1] = '\0'; | ||
3346 | } else | ||
3347 | buf[cnt] = '\0'; | ||
3353 | 3348 | ||
3354 | /* Cut from the first nil or newline. */ | 3349 | cnt = trace_vprintk(0, buf, NULL); |
3355 | buf[cnt] = '\0'; | ||
3356 | end = strchr(buf, '\n'); | ||
3357 | if (end) | ||
3358 | *end = '\0'; | ||
3359 | |||
3360 | cnt = mark_printk("%s\n", buf); | ||
3361 | kfree(buf); | 3350 | kfree(buf); |
3362 | *fpos += cnt; | 3351 | *fpos += cnt; |
3363 | 3352 | ||
@@ -3730,7 +3719,7 @@ tracing_stats_read(struct file *filp, char __user *ubuf, | |||
3730 | 3719 | ||
3731 | s = kmalloc(sizeof(*s), GFP_KERNEL); | 3720 | s = kmalloc(sizeof(*s), GFP_KERNEL); |
3732 | if (!s) | 3721 | if (!s) |
3733 | return ENOMEM; | 3722 | return -ENOMEM; |
3734 | 3723 | ||
3735 | trace_seq_init(s); | 3724 | trace_seq_init(s); |
3736 | 3725 | ||