diff options
Diffstat (limited to 'tapset')
-rw-r--r-- | tapset/ChangeLog | 5 | ||||
-rw-r--r-- | tapset/context.stp | 18 | ||||
-rw-r--r-- | tapset/task.stp | 35 |
3 files changed, 57 insertions, 1 deletions
diff --git a/tapset/ChangeLog b/tapset/ChangeLog index 626ad67b..da184191 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,8 @@ +2009-01-06 Frank Ch. Eigler <fche@elastic.org> + + PR 9699. + * context.stp, task.stp: Adapt to STAPCONF_TASK_UID. + 2008-12-09 Frank Ch. Eigler <fche@elastic.org> PR 6961. diff --git a/tapset/context.stp b/tapset/context.stp index c737edd0..7fd961c8 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -1,5 +1,5 @@ // context tapset -// Copyright (C) 2005, 2006, 2007 Red Hat Inc. +// Copyright (C) 2005-2009 Red Hat Inc. // Copyright (C) 2006 Intel Corporation. // // This file is part of systemtap, and is free software. You can @@ -76,7 +76,11 @@ function pexecname:string () %{ /* pure */ * Return the gid of the current process. */ function gid:long () %{ /* pure */ +#ifdef STAPCONF_TASK_UID THIS->__retvalue = current->gid; +#else + THIS->__retvalue = current_gid(); +#endif %} /** @@ -85,7 +89,11 @@ function gid:long () %{ /* pure */ * Return the effective gid of the current process. */ function egid:long () %{ /* pure */ +#ifdef STAPCONF_TASK_UID THIS->__retvalue = current->egid; +#else + THIS->__retvalue = current_egid(); +#endif %} /** @@ -94,7 +102,11 @@ function egid:long () %{ /* pure */ * Return the uid of the current process. */ function uid:long () %{ /* pure */ +#ifdef STAPCONF_TASK_UID THIS->__retvalue = current->uid; +#else + THIS->__retvalue = current_uid(); +#endif %} /** @@ -103,7 +115,11 @@ function uid:long () %{ /* pure */ * Return the effective uid of the current process. */ function euid:long () %{ /* pure */ +#ifdef STAPCONF_TASK_UID THIS->__retvalue = current->euid; +#else + THIS->__retvalue = current_euid(); +#endif %} // cpuid() is not documented 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(); %} |