diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-17 05:37:37 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-17 05:37:37 -0400 |
commit | 4176935b58eeb636917e65a2c388e4607e36cce6 (patch) | |
tree | dac4e0005cda5a3a5a313dde35bbac2877d9bd93 /kernel/trace/trace.c | |
parent | c269fc8c537d761f36cb98e637ae934d9331a9d5 (diff) | |
parent | 6adaad14d7d4d3ef31b4e2dc992b18b5da7c4eb3 (diff) |
Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index ae32d3b99b4b..1ce6208fd727 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -770,30 +770,34 @@ static void trace_save_cmdline(struct task_struct *tsk) | |||
770 | __raw_spin_unlock(&trace_cmdline_lock); | 770 | __raw_spin_unlock(&trace_cmdline_lock); |
771 | } | 771 | } |
772 | 772 | ||
773 | char *trace_find_cmdline(int pid) | 773 | void trace_find_cmdline(int pid, char comm[]) |
774 | { | 774 | { |
775 | char *cmdline = "<...>"; | ||
776 | unsigned map; | 775 | unsigned map; |
777 | 776 | ||
778 | if (!pid) | 777 | if (!pid) { |
779 | return "<idle>"; | 778 | strcpy(comm, "<idle>"); |
779 | return; | ||
780 | } | ||
780 | 781 | ||
781 | if (pid > PID_MAX_DEFAULT) | 782 | if (pid > PID_MAX_DEFAULT) { |
782 | goto out; | 783 | strcpy(comm, "<...>"); |
784 | return; | ||
785 | } | ||
783 | 786 | ||
787 | __raw_spin_lock(&trace_cmdline_lock); | ||
784 | map = map_pid_to_cmdline[pid]; | 788 | map = map_pid_to_cmdline[pid]; |
785 | if (map >= SAVED_CMDLINES) | 789 | if (map >= SAVED_CMDLINES) |
786 | goto out; | 790 | goto out; |
787 | 791 | ||
788 | cmdline = saved_cmdlines[map]; | 792 | strcpy(comm, saved_cmdlines[map]); |
789 | 793 | ||
790 | out: | 794 | out: |
791 | return cmdline; | 795 | __raw_spin_unlock(&trace_cmdline_lock); |
792 | } | 796 | } |
793 | 797 | ||
794 | void tracing_record_cmdline(struct task_struct *tsk) | 798 | void tracing_record_cmdline(struct task_struct *tsk) |
795 | { | 799 | { |
796 | if (atomic_read(&trace_record_cmdline_disabled)) | 800 | if (atomic_read(&trace_record_cmdline_disabled) || !tracing_is_on()) |
797 | return; | 801 | return; |
798 | 802 | ||
799 | trace_save_cmdline(tsk); | 803 | trace_save_cmdline(tsk); |