summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();