summaryrefslogtreecommitdiffstats
path: root/tapset/context.stp
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-09-16 12:18:15 -0400
committerDave Brolley <brolley@redhat.com>2009-09-16 12:18:15 -0400
commitd83d7b513d38791751e46a05e382b1e6876abefc (patch)
treef1fe74246300c62e5f55745f7ee12dc5db0a53ce /tapset/context.stp
parent1393520fe0a1064665938bcea0d6382610a478b0 (diff)
downloadsystemtap-steved-d83d7b513d38791751e46a05e382b1e6876abefc.tar.gz
systemtap-steved-d83d7b513d38791751e46a05e382b1e6876abefc.tar.xz
systemtap-steved-d83d7b513d38791751e46a05e382b1e6876abefc.zip
Create is_myproc helper function.
Diffstat (limited to 'tapset/context.stp')
-rw-r--r--tapset/context.stp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tapset/context.stp b/tapset/context.stp
index 5be9f21f..92c325ce 100644
--- a/tapset/context.stp
+++ b/tapset/context.stp
@@ -147,6 +147,20 @@ function euid:long () %{ /* pure */
#endif
%}
+/**
+ * sfunction is_myproc - Determines if the current probe point has occurred in
+ * the user's own process.
+ *
+ * Return 1 if the current probe point has occurred in the user's own process.
+ */
+function is_myproc:long () %{ /* pure */ /* unprivileged */
+#ifdef STAPCONF_TASK_UID
+ THIS->__retvalue = (current->euid == _stp_uid);
+#else
+ THIS->__retvalue = (task_euid(current) == _stp_uid);
+#endif
+%}
+
// cpuid() is not documented
function cpuid:long () %{ /* pure */
THIS->__retvalue = smp_processor_id();