diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-01-23 14:28:47 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-01-23 14:28:47 +0100 |
commit | c3bad3042df505a3470f1e20b09822a9df1d4761 (patch) | |
tree | 6842e8eaa705e406379d34cf07a85431b6d71344 /tapset/task.stp | |
parent | 750b1f2f5c84acaf0776de5239dc81e2e95c1dec (diff) | |
parent | f120873cb40cfc16cc94f06fd722abc927b96227 (diff) | |
download | systemtap-steved-c3bad3042df505a3470f1e20b09822a9df1d4761.tar.gz systemtap-steved-c3bad3042df505a3470f1e20b09822a9df1d4761.tar.xz systemtap-steved-c3bad3042df505a3470f1e20b09822a9df1d4761.zip |
Merge branch 'master' into pr6866.
Diffstat (limited to 'tapset/task.stp')
-rw-r--r-- | tapset/task.stp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tapset/task.stp b/tapset/task.stp index 9215e83f..684cef93 100644 --- a/tapset/task.stp +++ b/tapset/task.stp @@ -12,6 +12,9 @@ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) #include <linux/fdtable.h> #endif +#ifndef STAPCONF_TASK_UID +#include <linux/cred.h> +#endif %} // Return the task_struct representing the current process @@ -74,7 +77,18 @@ function task_tid:long (task:long) %{ /* pure */ // Return the group id of the given task function task_gid:long (task:long) %{ /* pure */ struct task_struct *t = (struct task_struct *)(long)THIS->task; +#ifdef STAPCONF_TASK_UID THIS->__retvalue = kread(&(t->gid)); +#else + /* XXX: We can't easily kread this rcu-protected field. */ + /* XXX: no task_gid() in 2.6.28 */ + struct cred *cred; + rcu_read_lock(); + cred = get_task_cred (t); + rcu_read_unlock(); + THIS->__retvalue = cred->gid; +#endif + CATCH_DEREF_FAULT(); %} @@ -82,7 +96,17 @@ function task_gid:long (task:long) %{ /* pure */ // Return the effective group id of the given task function task_egid:long (task:long) %{ /* pure */ struct task_struct *t = (struct task_struct *)(long)THIS->task; +#ifdef STAPCONF_TASK_UID THIS->__retvalue = kread(&(t->egid)); +#else + /* XXX: We can't easily kread this rcu-protected field. */ + /* XXX: no task_egid() in 2.6.28 */ + struct cred *cred; + rcu_read_lock(); + cred = get_task_cred (t); + rcu_read_unlock(); + THIS->__retvalue = cred->egid; +#endif CATCH_DEREF_FAULT(); %} @@ -90,7 +114,13 @@ function task_egid:long (task:long) %{ /* pure */ // Return the user id of the given task function task_uid:long (task:long) %{ /* pure */ struct task_struct *t = (struct task_struct *)(long)THIS->task; +#ifdef STAPCONF_TASK_UID THIS->__retvalue = kread(&(t->uid)); +#else + /* XXX: We can't easily kread this rcu-protected field. */ + THIS->__retvalue = task_uid (t); +#endif + CATCH_DEREF_FAULT(); %} @@ -98,7 +128,12 @@ function task_uid:long (task:long) %{ /* pure */ // Return the effective user id of the given task function task_euid:long (task:long) %{ /* pure */ struct task_struct *t = (struct task_struct *)(long)THIS->task; +#ifdef STAPCONF_TASK_UID THIS->__retvalue = kread(&(t->euid)); +#else + /* XXX: We can't easily kread this rcu-protected field. */ + THIS->__retvalue = task_euid (t); +#endif CATCH_DEREF_FAULT(); %} |