summaryrefslogtreecommitdiffstats
path: root/tapset/task.stp
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-07-23 12:43:03 -0400
committerDave Brolley <brolley@redhat.com>2009-07-23 12:43:03 -0400
commitc04c525de43003fb00612df635a7c819b5a1d645 (patch)
tree22cd1e41f84a66d7eaece8e17138bf83427f4bab /tapset/task.stp
parent6c456acd35009630facd95cca91483a92aa50e9f (diff)
parent4a8636a307a9a532dcc60b5ad8bf809a20dc24c3 (diff)
downloadsystemtap-steved-c04c525de43003fb00612df635a7c819b5a1d645.tar.gz
systemtap-steved-c04c525de43003fb00612df635a7c819b5a1d645.tar.xz
systemtap-steved-c04c525de43003fb00612df635a7c819b5a1d645.zip
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Diffstat (limited to 'tapset/task.stp')
-rw-r--r--tapset/task.stp12
1 files changed, 9 insertions, 3 deletions
diff --git a/tapset/task.stp b/tapset/task.stp
index 1f4e0e6f..8776a014 100644
--- a/tapset/task.stp
+++ b/tapset/task.stp
@@ -67,13 +67,19 @@ function task_pid:long (task:long)
function pid2task:long (pid:long) %{ /* pure */
struct task_struct *t = NULL;
pid_t t_pid = (pid_t)(long)THIS->pid;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ struct pid *p_pid = find_get_pid(t_pid);
+ t = pid_task(p_pid, PIDTYPE_PID);
+ put_pid(p_pid);
+#else
rcu_read_lock();
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
- t = find_task_by_vpid (t_pid);
+ t = find_task_by_vpid (t_pid);
#else
- t = find_task_by_pid (t_pid);
-#endif
+ t = find_task_by_pid (t_pid);
+#endif /* 2.6.24 */
rcu_read_unlock();
+#endif /* 2.6.31 */
THIS->__retvalue = (long)t;
CATCH_DEREF_FAULT();
%}