From e361ac2bdb6f1996e020a5612cec71762b556e25 Mon Sep 17 00:00:00 2001 From: Malte Nuhn Date: Fri, 8 May 2009 12:20:33 -0400 Subject: context tapset: sid() function to return task session leader pid --- tapset/context.stp | 12 ++++++++++++ testsuite/buildok/context_test.stp | 1 + 2 files changed, 13 insertions(+) diff --git a/tapset/context.stp b/tapset/context.stp index fcb60201..5d855f80 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -63,6 +63,18 @@ function ppid:long () %{ /* pure */ #endif %} +/** + * sfunction sid - Returns the session ID of the current process. + * + * The session ID of a process is the process group ID of the session + * leader. Session ID is stored in the signal_struct since Kernel 2.6.0. + */ +function sid:long () %{ /* pure */ + struct signal_struct *ss = kread( &(current->signal) ); + THIS->__retvalue = kread ( &(ss->session) ); + CATCH_DEREF_FAULT(); +%} + /** * sfunction pexecname - Returns the execname of a target process's parent process. */ diff --git a/testsuite/buildok/context_test.stp b/testsuite/buildok/context_test.stp index 84f1cbf1..d0b42890 100755 --- a/testsuite/buildok/context_test.stp +++ b/testsuite/buildok/context_test.stp @@ -18,6 +18,7 @@ function print_stuff () { printf("gid is %d\n", gid()) printf("egid is %d\n", egid()) printf("pp is %s\n", pp()) + printf("sid is %d\n", sid()) } probe kernel.function("uptime_read_proc") ? { -- cgit