Skip to contentSkip to conversation

ftrace: show virtual PID

PATCH In review Lai Jiangshan 1 participant 2 messages Mar 24, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ftrace: show virtual PID

When current namespace is not the global namespace, pid read from set_ftrace_pid is no correct.

# ~/newpid_namespace_run bash

# echo $$
1
# echo 1 > set_ftrace_pid
# cat set_ftrace_pid
3756

Since we write virtual PID to set_ftrace_pid, we need get virtual PID when we read it.

---

kernel/trace/ftrace.c +1 -1
index 7847806..7d7f201 100644
@@ -2262,7 +2262,7 @@ ftrace_pid_read(struct file *file, char __user *ubuf,
 	if (ftrace_pid_trace == ftrace_swapper_pid)
 		r = sprintf(buf, "swapper tasks\n");
 	else if (ftrace_pid_trace)
-		r = sprintf(buf, "%u\n", pid_nr(ftrace_pid_trace));
+		r = sprintf(buf, "%u\n", pid_vnr(ftrace_pid_trace));
 	else
 		r = sprintf(buf, "no pid\n");
 
#1 lore raw
Commit-ID:  cc59c9e8d0165c632fd056c4a23e36f917507fb4
Gitweb:     http://git.kernel.org/tip/cc59c9e8d0165c632fd056c4a23e36f917507fb4
Author:     Lai Jiangshan <[email protected]>
AuthorDate: Tue, 24 Mar 2009 11:03:01 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 24 Mar 2009 16:42:49 +0100

ftrace: show virtual PID

Impact: fix PID output under namespaces

When current namespace is not the global namespace, pid read from set_ftrace_pid is no correct.

# ~/newpid_namespace_run bash

 # echo $$
 1
 # echo 1 > set_ftrace_pid
 # cat set_ftrace_pid
 3756

Since we write virtual PID to set_ftrace_pid, we need get virtual PID when we read it.

Cc Steven Rostedt <[email protected]>
Cc Frederic Weisbecker <[email protected]>

LKML-Reference: <[email protected]>

---
 kernel/trace/ftrace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/ftrace.c +1 -1
index 02d2de9..bb37711 100644
@@ -2264,7 +2264,7 @@ ftrace_pid_read(struct file *file, char __user *ubuf,
 	if (ftrace_pid_trace == ftrace_swapper_pid)
 		r = sprintf(buf, "swapper tasks\n");
 	else if (ftrace_pid_trace)
-		r = sprintf(buf, "%u\n", pid_nr(ftrace_pid_trace));
+		r = sprintf(buf, "%u\n", pid_vnr(ftrace_pid_trace));
 	else
 		r = sprintf(buf, "no pid\n");