From cc20d8532b08f7755642ecb30f22126f7ac332c2 Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Fri, 3 Apr 2009 13:47:57 -0400 Subject: new process/errsnoop.stp sample script --- testsuite/systemtap.examples/process/errsnoop.meta | 7 ++++ testsuite/systemtap.examples/process/errsnoop.stp | 43 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 testsuite/systemtap.examples/process/errsnoop.meta create mode 100644 testsuite/systemtap.examples/process/errsnoop.stp (limited to 'testsuite/systemtap.examples/process') diff --git a/testsuite/systemtap.examples/process/errsnoop.meta b/testsuite/systemtap.examples/process/errsnoop.meta new file mode 100644 index 00000000..34b8cb7c --- /dev/null +++ b/testsuite/systemtap.examples/process/errsnoop.meta @@ -0,0 +1,7 @@ +title: tabulate system call errors +name: errsnoop.stp +keywords: process syscall +subsystem: general +description: The script prints a periodic tabular report about failing system calls, by process and by syscall failure. The first optional argument specifies the reporting interval (in seconds, default 5); the second optional argument gives a screen height (number of lines in the report, default 20). +test_check: stap -p4 errsnoop.stp +test_installcheck: stap errsnoop.stp 1 10 -c "sleep 3" diff --git a/testsuite/systemtap.examples/process/errsnoop.stp b/testsuite/systemtap.examples/process/errsnoop.stp new file mode 100644 index 00000000..d9fba3b7 --- /dev/null +++ b/testsuite/systemtap.examples/process/errsnoop.stp @@ -0,0 +1,43 @@ +#!/usr/bin/env stap +# errsnoop.stp +# Copyright (C) 2009 Red Hat, Inc., Eugene Teo +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# attack "stupid userspace" apps +# + +global error, trace + +probe syscall.* { + # assume syscall don't nest + trace[tid()] = argstr +} + +probe syscall.*.return { + errno = errno_p(returnval()) + if (errno != 0) { + t = tid() + argstr = trace[t] + delete trace[t] + + error[name, execname(), pid(), errno, argstr] <<< 1 + } +} + +probe timer.s(%( $# > 0 %? $1 %: 5 %)) { + ansi_clear_screen() + printf("%17s %15s %5s %4s %-12s %s\n", + "SYSCALL", "PROCESS", "PID", "HITS", "ERRSTR", "ARGSTR") + foreach([fn, comm, pid, errno, argstr] in error- limit %( $# > 1 %? $2 %: 20 %)) { + errstr = sprintf("%3d (%s)", errno, errno_str(errno)) + printf("%17s %15s %5d %4d %-12s %s\n", fn, comm, pid, + @count(error[fn, comm, pid, errno, argstr]), +# errstr, substr(argstr,0,22)) # within cols#80 + errstr, argstr) + + } + delete error +} -- cgit From 4e1801d37ecda01c75181a345dcd07a23cd64da0 Mon Sep 17 00:00:00 2001 From: Eugeniy Meshcheryakov Date: Sat, 4 Apr 2009 21:36:52 +0200 Subject: Make examples executable --- testsuite/systemtap.examples/process/errsnoop.stp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 testsuite/systemtap.examples/process/errsnoop.stp (limited to 'testsuite/systemtap.examples/process') diff --git a/testsuite/systemtap.examples/process/errsnoop.stp b/testsuite/systemtap.examples/process/errsnoop.stp old mode 100644 new mode 100755 -- cgit From a03c97419b5192fd594afb1f84e9ae4d0801e3a9 Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Sun, 5 Apr 2009 11:52:44 +0800 Subject: Amend process/errsnoop.stp shebang --- testsuite/systemtap.examples/process/errsnoop.stp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'testsuite/systemtap.examples/process') diff --git a/testsuite/systemtap.examples/process/errsnoop.stp b/testsuite/systemtap.examples/process/errsnoop.stp index d9fba3b7..a3f17b77 100755 --- a/testsuite/systemtap.examples/process/errsnoop.stp +++ b/testsuite/systemtap.examples/process/errsnoop.stp @@ -1,4 +1,5 @@ -#!/usr/bin/env stap +#!/bin/sh +//usr/bin/env stap -DMAXMAPENTRIES=20480 $0 $@; exit $? # errsnoop.stp # Copyright (C) 2009 Red Hat, Inc., Eugene Teo # -- cgit From 1f65cc4ffd1bd362b10d7f07d1cb9c4e7de68027 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 14 Apr 2009 12:34:12 -0700 Subject: PR9953: split up the two process.* tapsets The overlapping process.* tapsets are now separated. Those probe points documented in stapprobes(3stap) remain the same. Those that were formerly in stapprobes.process(3stap) have been renamed to kprocess, to reflect their kernel perspective on processes. --- testsuite/systemtap.examples/process/proc_snoop.stp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'testsuite/systemtap.examples/process') diff --git a/testsuite/systemtap.examples/process/proc_snoop.stp b/testsuite/systemtap.examples/process/proc_snoop.stp index 06425d45..9a3768c2 100755 --- a/testsuite/systemtap.examples/process/proc_snoop.stp +++ b/testsuite/systemtap.examples/process/proc_snoop.stp @@ -18,30 +18,30 @@ function id:string(task:long) { task_execname(task)) } -probe process.create { +probe kprocess.create { report(sprintf("create %s", id(task))) } -probe process.start { +probe kprocess.start { report("start") } -probe process.exec { +probe kprocess.exec { report(sprintf("exec %s", filename)) } -probe process.exec_complete { +probe kprocess.exec_complete { if (success) report("exec success") else report(sprintf("exec failed %d (%s)", errno, errno_str(errno))) } -probe process.exit { +probe kprocess.exit { report(sprintf("exit %d", code)) } -probe process.release { +probe kprocess.release { report(sprintf("remove %s", id(task))) } -- cgit From 3a748561b96b9f67cf37731055a665cb491b48ab Mon Sep 17 00:00:00 2001 From: Sunzen Wang Date: Wed, 22 Apr 2009 13:52:15 +0200 Subject: Correct sigmon.meta example title and name. * testsuite/systemtap.examples/process/sigmon.meta: Correct title and name. * testsuite/systemtap.examples/index.html: Regenerated. * testsuite/systemtap.examples/index.txt: Likewise. * testsuite/systemtap.examples/keyword-index.html: Likewise. * testsuite/systemtap.examples/keyword-index.txt: Likewise. --- testsuite/systemtap.examples/process/sigmon.meta | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'testsuite/systemtap.examples/process') diff --git a/testsuite/systemtap.examples/process/sigmon.meta b/testsuite/systemtap.examples/process/sigmon.meta index 18834997..fe192248 100644 --- a/testsuite/systemtap.examples/process/sigmon.meta +++ b/testsuite/systemtap.examples/process/sigmon.meta @@ -1,5 +1,5 @@ -title: System-Wide Count of Syscalls by PID -name: syscalls_by_pid.stp +title: Track a particular signal to a specific process +name: sigmon.stp version: 1.0 author: IBM keywords: signals -- cgit