diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-05 12:53:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-05 12:53:21 -0500 |
commit | 7a797cdcca2b3c0031e580203f18d6c9483aaec5 (patch) | |
tree | e35526b99793c08fd76c9a41e969c1c070adcc51 | |
parent | bb2166c898adb5fe29bc450004926802d2a16035 (diff) | |
parent | c13d2f7c3231e873f30db92b96c8caa48f100f33 (diff) |
Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
tracing: Fix trace_marker output
tracing: Fix event format export
tracing: Fix return value of tracing_stats_read()
-rw-r--r-- | include/trace/ftrace.h | 2 | ||||
-rw-r--r-- | kernel/trace/trace.c | 41 |
2 files changed, 16 insertions, 27 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index cc0d9667e182..dacb8ef67000 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -159,7 +159,7 @@ | |||
159 | #undef __get_str | 159 | #undef __get_str |
160 | 160 | ||
161 | #undef TP_printk | 161 | #undef TP_printk |
162 | #define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args) | 162 | #define TP_printk(fmt, args...) "\"%s\", %s\n", fmt, __stringify(args) |
163 | 163 | ||
164 | #undef TP_fast_assign | 164 | #undef TP_fast_assign |
165 | #define TP_fast_assign(args...) args | 165 | #define TP_fast_assign(args...) args |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index b20d3ec75de9..12b49caedf82 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -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 | ||
@@ -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 | ||