diff options
-rw-r--r-- | tapset/context.stp | 12 | ||||
-rwxr-xr-x | testsuite/buildok/context_test.stp | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/tapset/context.stp b/tapset/context.stp index fcb60201..5d855f80 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -64,6 +64,18 @@ function ppid:long () %{ /* pure */ %} /** + * 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. */ function pexecname:string () %{ /* pure */ 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") ? { |