summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/probes/ChangeLog16
-rw-r--r--runtime/probes/Makefile.template (renamed from runtime/probes/scf/Makefile)6
-rw-r--r--runtime/probes/README6
-rw-r--r--runtime/probes/agg/README3
-rwxr-xr-xruntime/probes/agg/build2
-rw-r--r--runtime/probes/agg/count1.c127
-rw-r--r--runtime/probes/agg/count2.c107
-rw-r--r--runtime/probes/agg/stat1.c97
-rwxr-xr-xruntime/probes/agg/stp45
-rw-r--r--runtime/probes/agg/targets3
-rwxr-xr-xruntime/probes/build74
-rwxr-xr-xruntime/probes/build_probe126
-rwxr-xr-xruntime/probes/scf/build2
-rw-r--r--runtime/probes/scf/scf.c6
-rw-r--r--runtime/probes/scf/targets1
-rw-r--r--runtime/probes/shellsnoop/Makefile21
-rwxr-xr-xruntime/probes/shellsnoop/build2
-rw-r--r--runtime/probes/shellsnoop/shellsnoop.c12
-rw-r--r--runtime/probes/shellsnoop/targets1
-rw-r--r--runtime/probes/tasklet/Makefile21
-rwxr-xr-xruntime/probes/tasklet/build2
-rw-r--r--runtime/probes/tasklet/targets1
-rw-r--r--runtime/probes/test4/Makefile21
-rwxr-xr-xruntime/probes/test4/build2
-rw-r--r--runtime/probes/test4/targets1
-rw-r--r--runtime/probes/test4/test4.c16
-rw-r--r--runtime/probes/where_func/Makefile21
-rw-r--r--runtime/probes/where_func/README3
-rwxr-xr-xruntime/probes/where_func/build2
-rw-r--r--runtime/probes/where_func/kprobe_where_funct.c5
-rw-r--r--runtime/probes/where_func/targets1
31 files changed, 583 insertions, 170 deletions
diff --git a/runtime/probes/ChangeLog b/runtime/probes/ChangeLog
new file mode 100644
index 00000000..2464a5c3
--- /dev/null
+++ b/runtime/probes/ChangeLog
@@ -0,0 +1,16 @@
+2005-06-18 Martin Hunt <hunt@redhat.com>
+
+ * build: Modified to use build_probe.
+
+ * build_probe: New file. This does the work of building
+ a single probe or set of probes in a directory.
+
+ * Makefile.template: New file. Template used by
+ build_probe to create Makefiles.
+
+ * agg: New set of probes to test/demonstrate
+ Counter and Stat aggregations.
+
+ * all probes modified for latest changes and new build
+ process.
+
diff --git a/runtime/probes/scf/Makefile b/runtime/probes/Makefile.template
index 3f80332b..ccdbbdee 100644
--- a/runtime/probes/scf/Makefile
+++ b/runtime/probes/Makefile.template
@@ -1,5 +1,4 @@
# Makefile
-
PWD := $(shell pwd)
RT := $(PWD)/../..
KVERSION := $(shell uname -r)
@@ -11,11 +10,10 @@ KTA := 0x$(firstword $(shell grep "__kernel_text_address" /boot/System.map-$(KVE
EXTRA_CFLAGS := -I $(RT) -I $(RT)/relayfs -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME) -D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP) -DKTA=$(KTA)
-obj-m := scf.o
-
+obj-m := XXX.o
default:
$(MAKE) V=1 -C $(KDIR) M=$(PWD) RT=$(RT) modules
clean:
- /bin/rm -rf *.o *.ko *~ *.mod.c .*.cmd .tmp_versions
+ /bin/rm -rf *.o *.o.d *.ko *~ *.mod.c .*.cmd .tmp_versions
diff --git a/runtime/probes/README b/runtime/probes/README
index dd9fcd0c..f3cd9fb2 100644
--- a/runtime/probes/README
+++ b/runtime/probes/README
@@ -2,3 +2,9 @@
This directory contains working example probes that demonstrate and test
the runtime library. They are tested on i386 and x86_64.
*/
+
+To build all probes, just type "./build"
+To clean up, "./build clean"
+To see a verbose build "./build -v"
+
+The same commands work in any probe subdirectory.
diff --git a/runtime/probes/agg/README b/runtime/probes/agg/README
new file mode 100644
index 00000000..b48db1b8
--- /dev/null
+++ b/runtime/probes/agg/README
@@ -0,0 +1,3 @@
+/** @dir agg
+Test probes to use the Counter and Stat aggregations.
+*/
diff --git a/runtime/probes/agg/build b/runtime/probes/agg/build
new file mode 100755
index 00000000..f3e83244
--- /dev/null
+++ b/runtime/probes/agg/build
@@ -0,0 +1,2 @@
+#!/bin/bash
+../build_probe $*
diff --git a/runtime/probes/agg/count1.c b/runtime/probes/agg/count1.c
new file mode 100644
index 00000000..870dc32e
--- /dev/null
+++ b/runtime/probes/agg/count1.c
@@ -0,0 +1,127 @@
+#define STP_NETLINK_ONLY
+#define STP_NUM_STRINGS 1
+
+#include "runtime.h"
+
+#include "counter.c"
+#include "probes.c"
+
+MODULE_DESCRIPTION("SystemTap probe: count1");
+MODULE_AUTHOR("Martin Hunt <hunt@redhat.com>");
+
+Counter opens;
+Counter reads;
+Counter writes;
+Counter sched;
+Counter idle;
+
+static int inst_sys_open (struct kprobe *p, struct pt_regs *regs)
+{
+ _stp_counter_add (opens, 1);
+ return 0;
+}
+
+static int inst_sys_read (struct kprobe *p, struct pt_regs *regs)
+{
+ _stp_counter_add (reads, 1);
+ return 0;
+}
+
+static int inst_sys_write (struct kprobe *p, struct pt_regs *regs)
+{
+ _stp_counter_add (writes, 1);
+ return 0;
+}
+
+static int inst_schedule(struct kprobe *p, struct pt_regs *regs)
+{
+ _stp_counter_add (sched, 1);
+ return 0;
+}
+
+static int inst_idle_cpu(struct kprobe *p, struct pt_regs *regs)
+{
+ _stp_counter_add (idle, 1);
+ return 0;
+}
+
+static struct kprobe stp_probes[] = {
+ {
+ .addr = "sys_open",
+ .pre_handler = inst_sys_open
+ },
+ {
+ .addr = "sys_read",
+ .pre_handler = inst_sys_read
+ },
+ {
+ .addr = "sys_write",
+ .pre_handler = inst_sys_write
+ },
+ {
+ .addr = "schedule",
+ .pre_handler = inst_schedule
+ },
+ {
+ .addr = "idle_cpu",
+ .pre_handler = inst_idle_cpu
+ },
+};
+
+#define MAX_STP_ROUTINE (sizeof(stp_probes)/sizeof(struct kprobe))
+
+static int pid;
+module_param(pid, int, 0);
+MODULE_PARM_DESC(pid, "daemon pid");
+
+int init_module(void)
+{
+ int ret;
+
+ if (!pid) {
+ printk("init: Can't start without daemon pid\n");
+ return -1;
+ }
+
+ if (_stp_transport_open(n_subbufs, subbuf_size, pid) < 0) {
+ printk("init: Couldn't open transport\n");
+ return -1;
+ }
+
+ opens = _stp_counter_init();
+ reads = _stp_counter_init();
+ writes = _stp_counter_init();
+ sched = _stp_counter_init();
+ idle = _stp_counter_init();
+
+ ret = _stp_register_kprobes (stp_probes, MAX_STP_ROUTINE);
+
+ return ret;
+}
+
+static void probe_exit (void)
+{
+ int i;
+
+ _stp_unregister_kprobes (stp_probes, MAX_STP_ROUTINE);
+
+ for_each_cpu(i)
+ _stp_printf ("sched calls for cpu %d = %lld\n", i, _stp_counter_get_cpu(sched, i, 0));
+
+ _stp_print ("\n\n");
+
+ _stp_printf ("open calls: %lld\n", _stp_counter_get(opens, 0));
+ _stp_printf ("read calls: %lld\n", _stp_counter_get(reads, 0));
+ _stp_printf ("write calls: %lld\n", _stp_counter_get(writes, 0));
+ _stp_printf ("sched calls: %lld\n", _stp_counter_get(sched, 0));
+ _stp_printf ("idle calls: %lld\n", _stp_counter_get(idle, 0));
+ _stp_print_flush();
+}
+
+void cleanup_module(void)
+{
+ _stp_transport_close();
+}
+
+MODULE_LICENSE("GPL");
+
diff --git a/runtime/probes/agg/count2.c b/runtime/probes/agg/count2.c
new file mode 100644
index 00000000..ab13f5af
--- /dev/null
+++ b/runtime/probes/agg/count2.c
@@ -0,0 +1,107 @@
+#define STP_NETLINK_ONLY
+#define STP_NUM_STRINGS 1
+#include "runtime.h"
+
+#include "counter.c"
+#include "probes.c"
+
+MODULE_DESCRIPTION("SystemTap probe: count1");
+MODULE_AUTHOR("Martin Hunt <hunt@redhat.com>");
+
+Counter opens;
+Counter reads;
+Counter writes;
+Counter read_bytes;
+Counter write_bytes;
+
+asmlinkage long inst_sys_open (const char __user * filename, int flags, int mode)
+{
+ _stp_counter_add (opens, 1);
+ jprobe_return();
+ return 0;
+}
+
+asmlinkage ssize_t inst_sys_read (unsigned int fd, char __user * buf, size_t count)
+{
+ _stp_counter_add (reads, 1);
+ _stp_counter_add (read_bytes, count);
+ jprobe_return();
+ return 0;
+}
+
+asmlinkage ssize_t inst_sys_write (unsigned int fd, const char __user * buf, size_t count)
+{
+ _stp_counter_add (writes, 1);
+ _stp_counter_add (write_bytes, count);
+ jprobe_return();
+ return 0;
+}
+
+static struct jprobe stp_probes[] = {
+ {
+ .kp.addr = (kprobe_opcode_t *)"sys_open",
+ .entry = (kprobe_opcode_t *) inst_sys_open
+ },
+ {
+ .kp.addr = (kprobe_opcode_t *)"sys_read",
+ .entry = (kprobe_opcode_t *) inst_sys_read
+ },
+ {
+ .kp.addr = (kprobe_opcode_t *)"sys_write",
+ .entry = (kprobe_opcode_t *) inst_sys_write
+ },
+};
+
+#define MAX_STP_ROUTINE (sizeof(stp_probes)/sizeof(struct jprobe))
+
+static int pid;
+module_param(pid, int, 0);
+MODULE_PARM_DESC(pid, "daemon pid");
+
+int init_module(void)
+{
+ int ret;
+
+ if (!pid) {
+ printk("init: Can't start without daemon pid\n");
+ return -1;
+ }
+
+ if (_stp_transport_open(n_subbufs, subbuf_size, pid) < 0) {
+ printk("init: Couldn't open transport\n");
+ return -1;
+ }
+
+ opens = _stp_counter_init();
+ reads = _stp_counter_init();
+ writes = _stp_counter_init();
+ read_bytes = _stp_counter_init();
+ write_bytes = _stp_counter_init();
+
+ ret = _stp_register_jprobes (stp_probes, MAX_STP_ROUTINE);
+
+ return ret;
+}
+
+static void probe_exit (void)
+{
+ int i;
+
+ _stp_unregister_jprobes (stp_probes, MAX_STP_ROUTINE);
+
+ _stp_printf ("open calls: %lld\n", _stp_counter_get(opens, 0));
+ _stp_printf ("read calls: %lld\n", _stp_counter_get(reads, 0));
+ _stp_printf ("read bytes: %lld\n", _stp_counter_get(read_bytes, 0));
+ _stp_printf ("write calls: %lld\n", _stp_counter_get(writes, 0));
+ _stp_printf ("write bytes: %lld\n", _stp_counter_get(write_bytes, 0));
+
+ _stp_print_flush();
+}
+
+void cleanup_module(void)
+{
+ _stp_transport_close();
+}
+
+MODULE_LICENSE("GPL");
+
diff --git a/runtime/probes/agg/stat1.c b/runtime/probes/agg/stat1.c
new file mode 100644
index 00000000..1d3cb3b0
--- /dev/null
+++ b/runtime/probes/agg/stat1.c
@@ -0,0 +1,97 @@
+#define STP_NETLINK_ONLY
+#define STP_NUM_STRINGS 1
+#include "runtime.h"
+#include "stat.c"
+#include "counter.c"
+#include "probes.c"
+
+MODULE_DESCRIPTION("SystemTap probe: count1");
+MODULE_AUTHOR("Martin Hunt <hunt@redhat.com>");
+
+
+Counter opens;
+Stat reads;
+Stat writes;
+
+asmlinkage long inst_sys_open (const char __user * filename, int flags, int mode)
+{
+ _stp_counter_add (opens, 1);
+ jprobe_return();
+ return 0;
+}
+
+asmlinkage ssize_t inst_sys_read (unsigned int fd, char __user * buf, size_t count)
+{
+ _stp_stat_add (reads, count);
+ jprobe_return();
+ return 0;
+}
+
+asmlinkage ssize_t inst_sys_write (unsigned int fd, const char __user * buf, size_t count)
+{
+ _stp_stat_add (writes, count);
+ jprobe_return();
+ return 0;
+}
+
+static struct jprobe stp_probes[] = {
+ {
+ .kp.addr = (kprobe_opcode_t *)"sys_open",
+ .entry = (kprobe_opcode_t *) inst_sys_open
+ },
+ {
+ .kp.addr = (kprobe_opcode_t *)"sys_read",
+ .entry = (kprobe_opcode_t *) inst_sys_read
+ },
+ {
+ .kp.addr = (kprobe_opcode_t *)"sys_write",
+ .entry = (kprobe_opcode_t *) inst_sys_write
+ },
+};
+
+#define MAX_STP_ROUTINE (sizeof(stp_probes)/sizeof(struct jprobe))
+
+static int pid;
+module_param(pid, int, 0);
+MODULE_PARM_DESC(pid, "daemon pid");
+
+int init_module(void)
+{
+ int ret;
+
+ if (!pid) {
+ printk("init: Can't start without daemon pid\n");
+ return -1;
+ }
+
+ if (_stp_transport_open(n_subbufs, subbuf_size, pid) < 0) {
+ printk("init: Couldn't open transport\n");
+ return -1;
+ }
+
+ opens = _stp_counter_init();
+ reads = _stp_stat_init(HIST_LOG,24);
+ writes = _stp_stat_init(HIST_LINEAR,0,1000,50);
+
+ ret = _stp_register_jprobes (stp_probes, MAX_STP_ROUTINE);
+ return ret;
+}
+
+static void probe_exit (void)
+{
+ _stp_unregister_jprobes (stp_probes, MAX_STP_ROUTINE);
+
+ _stp_printf ("OPENS: %lld\n", _stp_counter_get(opens, 0));
+ _stp_stat_print (reads, "READS: count:%C sum:%S avg:%A min:%m max:%M\n%H", 0);
+ _stp_stat_print (writes, "WRITES: count:%C sum:%S avg:%A min:%m max:%M\n%H", 0);
+
+ _stp_print_flush();
+}
+
+void cleanup_module(void)
+{
+ _stp_transport_close();
+}
+
+MODULE_LICENSE("GPL");
+
diff --git a/runtime/probes/agg/stp b/runtime/probes/agg/stp
new file mode 100755
index 00000000..185a5905
--- /dev/null
+++ b/runtime/probes/agg/stp
@@ -0,0 +1,45 @@
+#!/bin/bash
+if [ -n "$1" ]
+then
+ modulename=$1
+else
+ echo "Usage: stp modulename"
+ exit
+fi
+
+RELAYFS=`lsmod | grep relayfs |awk '{print $1}'`
+if [ "$RELAYFS" != "relayfs" ]
+then
+ /sbin/insmod ../../relayfs/relayfs.ko
+fi
+
+if [ ! -d "/mnt/relay" ]
+then
+ mkdir /mnt/relay
+fi
+
+MOUNT=`mount | grep relayfs |awk '{print $1}'`
+if [ "$MOUNT" != "relayfs" ]
+then
+ mount -t relayfs relayfs /mnt/relay
+fi
+
+STP_CONTROL=`lsmod | grep stp_control |awk '{print $1}'`
+if [ "$STP_CONTROL" != "stp_control" ]
+then
+ /sbin/insmod ../../transport/stp-control.ko
+fi
+
+#/sbin/insmod $modulename
+
+# print to screen only, 4 8K buffers
+#../../stpd/stpd -p -b 8192 -n 4
+
+# print to screen and log to files, 4 8K buffers
+../../stpd/stpd -b 8192 -n 4 $modulename
+
+# no screen or log
+#../../stpd/stpd -q -b 8192 -n 4
+
+# stpd will remove module when it exits
+#/sbin/rmmod $modulename
diff --git a/runtime/probes/agg/targets b/runtime/probes/agg/targets
new file mode 100644
index 00000000..614a00d2
--- /dev/null
+++ b/runtime/probes/agg/targets
@@ -0,0 +1,3 @@
+count1
+count2
+stat1
diff --git a/runtime/probes/build b/runtime/probes/build
index ac9994a9..584f792a 100755
--- a/runtime/probes/build
+++ b/runtime/probes/build
@@ -1,81 +1,37 @@
#!/usr/bin/tclsh
# -*- tcl -*-
-# simple script to do a make or "make clean" in each probe directory
+# simple script to build each probe directory
proc usage {} {
- puts "Usage: build \[clean\]"
+ puts "Usage: build \[-v\] \[clean\]"
exit
}
-set clean 0
+set clean ""
+set verbose ""
foreach arg $argv {
if {$arg == "clean"} {
- set clean 1
+ set clean $arg
+ } elseif {$arg == "-v"} {
+ set verbose $arg
} else {
usage
}
}
-set dirs {shellsnoop test4 where_func scf}
+set cmd "exec ../build_probe $verbose $clean"
-foreach i $dirs {
- cd $i
- if {$clean} {
- puts "Cleaning $i"
- if {[catch {exec make clean >& compile.errors} res]} {
- [exec cat compile.errors]
+foreach filename [lsort [glob *]] {
+ if {$filename != "CVS" && [file isdirectory $filename]} {
+ cd $filename
+ if {[catch {exec ../build_probe $verbose $clean} res]} {
+ puts $res
exit
}
- } else {
- puts "Building $i"
- if {[catch {exec make >& compile.errors} res]} {
- puts "\n------------ Compile error in $i -------------------\n"
- if {[catch {open compile.errors r} fd]} {
- puts "Compile failed for unknown reasons"
- exit
- }
- while {[gets $fd line] >= 0} {
- puts $line
- }
- close $fd
- exit
- } else {
- if {![catch {open compile.errors r} fd]} {
- # search for warnings
- set bad 0
- while {[gets $fd line] >= 0} {
- if {[regexp {[^W]*([A-Za-z][A-Za-z0-9_]*)[^\"]*\"([^\"]*)} $line match warn var]} {
- if {$warn == "Warning"} {
- switch $var {
- _stp_ctrl_unregister -
- _stp_ctrl_register -
- relay_subbufs_consumed -
- _stp_ctrl_send -
- relay_open -
- relayfs_create_dir -
- relayfs_remove_dir -
- relay_close {}
- default {
- if {$bad == 0} {
- puts "\n------------ Unexpected Warnings in $i -------------------\n"
- }
- puts $line
- set bad 1
- }
- }
- }
- }
- }
- close $fd
- }
- if {$bad} {
- exit
- }
- }
+ puts $res
+ cd ..
}
- catch {exec /bin/rm compile.errors}
- cd ..
}
diff --git a/runtime/probes/build_probe b/runtime/probes/build_probe
new file mode 100755
index 00000000..29846b2a
--- /dev/null
+++ b/runtime/probes/build_probe
@@ -0,0 +1,126 @@
+#!/usr/bin/tclsh
+# -*- tcl -*-
+
+proc usage {} {
+ puts "Usage: build \[-v\] \[clean\]"
+ exit -1
+}
+
+# use Makefile.template to generate a Makefile
+proc create_makefile {target} {
+ if {[catch {open ../Makefile.template r} fd]} {
+ puts "ERROR opening ../Makefile.template"
+ exit -1
+ }
+ if {[catch {open Makefile w} mfd]} {
+ puts "ERROR creating Makefile"
+ exit -1
+ }
+ while {[gets $fd line] >= 0} {
+ if {[regsub XXX $line $target newline]} {
+ set line $newline
+ }
+ puts $mfd $line
+ }
+ close $fd
+ close $mfd
+}
+
+proc build {{target ""}} {
+ global clean verbose
+ if {$target == ""} {
+ set target [file tail [pwd]]
+ }
+ if {$clean} {
+ puts "Cleaning $target"
+ if {[catch {exec make clean >& compile.errors} res]} {
+ [exec cat compile.errors]
+ exit -1
+ }
+ } else {
+ puts "Building $target"
+ if {[catch {exec make >& compile.errors} res]} {
+ puts "\n------------ Compile error in $target -------------------\n"
+ if {[catch {open compile.errors r} fd]} {
+ puts "Compile failed for unknown reasons"
+ exit -1
+ }
+ while {[gets $fd line] >= 0} {
+ puts $line
+ }
+ close $fd
+ exit -1
+ } else {
+ if {![catch {open compile.errors r} fd]} {
+ # search for warnings
+ set bad 0
+ while {[gets $fd line] >= 0} {
+ if {$verbose} {
+ puts $line
+ } else {
+ if {[regexp {[^W]*([A-Za-z][A-Za-z0-9_]*)[^\"]*\"([^\"]*)} $line match warn var]} {
+ if {$warn == "Warning"} {
+ switch $var {
+ _stp_ctrl_unregister -
+ _stp_ctrl_register -
+ relay_subbufs_consumed -
+ _stp_ctrl_send -
+ relay_open -
+ relayfs_create_dir -
+ relayfs_remove_dir -
+ relay_close {}
+ default {
+ if {$bad == 0} {
+ puts "\n------------ Unexpected Warnings in $target -------------------\n"
+ }
+ puts $line
+ set bad 1
+ }
+ }
+ }
+ }
+ }
+ }
+ close $fd
+ }
+ if {$bad} {
+ exit -1
+ }
+ }
+ }
+}
+
+set clean 0
+set verbose 0
+
+foreach arg $argv {
+ if {$arg == "clean"} {
+ set clean 1
+ } elseif {$arg == "-v"} {
+ set verbose 1
+ } elseif {$arg != ""} {
+ usage
+ }
+}
+
+if {![catch {open targets r} tfd]} {
+ while {[gets $tfd line] >= 0} {
+ set target [lindex $line 0]
+ create_makefile $target
+ build $target
+ catch {exec /bin/rm Makefile}
+ }
+ close $tfd
+} else {
+ if {![file exists Makefile]} {
+ puts "Now in [pwd]"
+ puts "ERROR: No targets file found and no Makefile either"
+ exit -1
+ }
+ build
+}
+
+puts "Done"
+catch {exec /bin/rm compile.errors}
+
+
diff --git a/runtime/probes/scf/build b/runtime/probes/scf/build
new file mode 100755
index 00000000..f3e83244
--- /dev/null
+++ b/runtime/probes/scf/build
@@ -0,0 +1,2 @@
+#!/bin/bash
+../build_probe $*
diff --git a/runtime/probes/scf/scf.c b/runtime/probes/scf/scf.c
index dfdb7b0a..a8798f51 100644
--- a/runtime/probes/scf/scf.c
+++ b/runtime/probes/scf/scf.c
@@ -1,14 +1,12 @@
#define STP_NETLINK_ONLY
-#define STP_NUM_STRINGS 2
+#define STP_NUM_STRINGS 1
#include "runtime.h"
#define MAP_STRING_LENGTH 512
+#define NEED_INT64_VALS
#define KEY1_TYPE STRING
#include "map-keys.c"
-#define VALUE_TYPE INT64
-#include "map-values.c"
-
#include "map.c"
#include "sym.c"
#include "current.c"
diff --git a/runtime/probes/scf/targets b/runtime/probes/scf/targets
new file mode 100644
index 00000000..aafcca22
--- /dev/null
+++ b/runtime/probes/scf/targets
@@ -0,0 +1 @@
+scf
diff --git a/runtime/probes/shellsnoop/Makefile b/runtime/probes/shellsnoop/Makefile
deleted file mode 100644
index 74e35596..00000000
--- a/runtime/probes/shellsnoop/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# Makefile
-
-PWD := $(shell pwd)
-RT := $(PWD)/../..
-KVERSION := $(shell uname -r)
-KDIR := /lib/modules/$(KVERSION)/build include
-
-KALLSYMS_LOOKUP_NAME := 0x$(firstword $(shell grep " kallsyms_lookup_name" /boot/System.map-$(KVERSION)))
-KALLSYMS_LOOKUP := 0x$(firstword $(shell grep " kallsyms_lookup$$" /boot/System.map-$(KVERSION)))
-KTA := 0x$(firstword $(shell grep "__kernel_text_address" /boot/System.map-$(KVERSION)))
-
-EXTRA_CFLAGS := -I $(RT) -I $(RT)/relayfs -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME) -D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP) -DKTA=$(KTA)
-
-obj-m := shellsnoop.o
-
-
-default:
- $(MAKE) V=1 -C $(KDIR) M=$(PWD) RT=$(RT) modules
-
-clean:
- /bin/rm -rf *.o *.ko *~ *.mod.c .*.cmd .tmp_versions
diff --git a/runtime/probes/shellsnoop/build b/runtime/probes/shellsnoop/build
new file mode 100755
index 00000000..f3e83244
--- /dev/null
+++ b/runtime/probes/shellsnoop/build
@@ -0,0 +1,2 @@
+#!/bin/bash
+../build_probe $*
diff --git a/runtime/probes/shellsnoop/shellsnoop.c b/runtime/probes/shellsnoop/shellsnoop.c
index 081ac700..86d2e54d 100644
--- a/runtime/probes/shellsnoop/shellsnoop.c
+++ b/runtime/probes/shellsnoop/shellsnoop.c
@@ -1,17 +1,14 @@
#define STP_NETLINK_ONLY
#define STP_NUM_STRINGS 1
-
#include "runtime.h"
+#define NEED_INT64_VALS
+#define NEED_STRING_VALS
+
#define KEY1_TYPE INT64
#include "map-keys.c"
-#define VALUE_TYPE INT64
-#include "map-values.c"
-
-#define VALUE_TYPE STRING
-#include "map-values.c"
-
+#include "map.c"
#include "list.c"
#include "copy.c"
#include "probes.c"
@@ -24,6 +21,7 @@ MAP pids, arglist ;
int inst_do_execve (char * filename, char __user *__user *argv, char __user *__user *envp, struct pt_regs * regs)
{
struct map_node *ptr;
+
/* watch shells only */
/* FIXME: detect more shells, like csh, tcsh, zsh */
diff --git a/runtime/probes/shellsnoop/targets b/runtime/probes/shellsnoop/targets
new file mode 100644
index 00000000..fdd0d724
--- /dev/null
+++ b/runtime/probes/shellsnoop/targets
@@ -0,0 +1 @@
+shellsnoop
diff --git a/runtime/probes/tasklet/Makefile b/runtime/probes/tasklet/Makefile
deleted file mode 100644
index a15e643f..00000000
--- a/runtime/probes/tasklet/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# Makefile
-
-PWD := $(shell pwd)
-RT := $(PWD)/../..
-KVERSION := $(shell uname -r)
-KDIR := /lib/modules/$(KVERSION)/build include
-
-KALLSYMS_LOOKUP_NAME := 0x$(firstword $(shell grep " kallsyms_lookup_name" /boot/System.map-$(KVERSION)))
-KALLSYMS_LOOKUP := 0x$(firstword $(shell grep " kallsyms_lookup$$" /boot/System.map-$(KVERSION)))
-KTA := 0x$(firstword $(shell grep "__kernel_text_address" /boot/System.map-$(KVERSION)))
-
-EXTRA_CFLAGS := -I $(RT) -I $(RT)/relayfs -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME) -D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP)
-
-obj-m := tasklet.o
-
-
-default:
- $(MAKE) V=1 -C $(KDIR) M=$(PWD) RT=$(RT) modules
-
-clean:
- /bin/rm -rf *.o *.ko *~ *.mod.c .*.cmd .tmp_versions
diff --git a/runtime/probes/tasklet/build b/runtime/probes/tasklet/build
new file mode 100755
index 00000000..f3e83244
--- /dev/null
+++ b/runtime/probes/tasklet/build
@@ -0,0 +1,2 @@
+#!/bin/bash
+../build_probe $*
diff --git a/runtime/probes/tasklet/targets b/runtime/probes/tasklet/targets
new file mode 100644
index 00000000..236dbd95
--- /dev/null
+++ b/runtime/probes/tasklet/targets
@@ -0,0 +1 @@
+stp_tasklet
diff --git a/runtime/probes/test4/Makefile b/runtime/probes/test4/Makefile
deleted file mode 100644
index 60afe8ab..00000000
--- a/runtime/probes/test4/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# Makefile
-
-PWD := $(shell pwd)
-RT := $(PWD)/../..
-KVERSION := $(shell uname -r)
-KDIR := /lib/modules/$(KVERSION)/build include
-
-KALLSYMS_LOOKUP_NAME := 0x$(firstword $(shell grep " kallsyms_lookup_name" /boot/System.map-$(KVERSION)))
-KALLSYMS_LOOKUP := 0x$(firstword $(shell grep " kallsyms_lookup$$" /boot/System.map-$(KVERSION)))
-KTA := 0x$(firstword $(shell grep "__kernel_text_address" /boot/System.map-$(KVERSION)))
-
-EXTRA_CFLAGS := -I $(RT) -I $(RT)/relayfs -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME) -D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP) -DKTA=$(KTA)
-
-obj-m := test4.o
-
-
-default:
- $(MAKE) V=1 -C $(KDIR) M=$(PWD) RT=$(RT) modules
-
-clean:
- /bin/rm -rf *.o *.ko *~ *.mod.c .*.cmd .tmp_versions
diff --git a/runtime/probes/test4/build b/runtime/probes/test4/build
new file mode 100755
index 00000000..f3e83244
--- /dev/null
+++ b/runtime/probes/test4/build
@@ -0,0 +1,2 @@
+#!/bin/bash
+../build_probe $*
diff --git a/runtime/probes/test4/targets b/runtime/probes/test4/targets
new file mode 100644
index 00000000..d234c5e0
--- /dev/null
+++ b/runtime/probes/test4/targets
@@ -0,0 +1 @@
+test4
diff --git a/runtime/probes/test4/test4.c b/runtime/probes/test4/test4.c
index f89cc6b9..9867d8ef 100644
--- a/runtime/probes/test4/test4.c
+++ b/runtime/probes/test4/test4.c
@@ -2,15 +2,12 @@
#define STP_NUM_STRINGS 1
#include "runtime.h"
+#define NEED_INT64_VALS
+#define NEED_STAT_VALS
+
#define KEY1_TYPE STRING
#include "map-keys.c"
-#define VALUE_TYPE INT64
-#include "map-values.c"
-
-#define VALUE_TYPE STAT
-#include "map-values.c"
-
#include "map.c"
#include "probes.c"
@@ -31,7 +28,7 @@ asmlinkage long inst_sys_open (const char __user * filename, int flags, int mode
asmlinkage ssize_t inst_sys_read (unsigned int fd, char __user * buf, size_t count)
{
_stp_map_key_str (reads, current->comm);
- _stp_map_add_int64_stat (reads, count);
+ _stp_map_add_int64 (reads, count);
jprobe_return();
return 0;
}
@@ -39,7 +36,7 @@ asmlinkage ssize_t inst_sys_read (unsigned int fd, char __user * buf, size_t cou
asmlinkage ssize_t inst_sys_write (unsigned int fd, const char __user * buf, size_t count)
{
_stp_map_key_str (writes, current->comm);
- _stp_map_add_int64_stat (writes, count);
+ _stp_map_add_int64 (writes, count);
jprobe_return();
return 0;
}
@@ -78,7 +75,8 @@ int init_module(void)
printk("init: Couldn't open transport\n");
return -1;
}
-
+
+ /* FIXME. Check return values */
opens = _stp_map_new_str (1000, INT64);
reads = _stp_map_new_str (1000, HSTAT_LOG, 8);
writes = _stp_map_new_str (1000, HSTAT_LOG, 8);
diff --git a/runtime/probes/where_func/Makefile b/runtime/probes/where_func/Makefile
deleted file mode 100644
index c2c7d6bd..00000000
--- a/runtime/probes/where_func/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# Makefile
-
-PWD := $(shell pwd)
-RT := $(PWD)/../..
-KVERSION := $(shell uname -r)
-KDIR := /lib/modules/$(KVERSION)/build include
-
-KALLSYMS_LOOKUP_NAME := 0x$(firstword $(shell grep " kallsyms_lookup_name" /boot/System.map-$(KVERSION)))
-KALLSYMS_LOOKUP := 0x$(firstword $(shell grep " kallsyms_lookup$$" /boot/System.map-$(KVERSION)))
-KTA := 0x$(firstword $(shell grep "__kernel_text_address" /boot/System.map-$(KVERSION)))
-
-EXTRA_CFLAGS := -I $(RT) -I $(RT)/relayfs -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME) -D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP) -DKTA=$(KTA)
-
-obj-m := kprobe_where_funct.o
-
-
-default:
- $(MAKE) V=1 -C $(KDIR) M=$(PWD) RT=$(RT) modules
-
-clean:
- /bin/rm -rf *.o *.ko *~ *.mod.c .*.cmd .tmp_versions
diff --git a/runtime/probes/where_func/README b/runtime/probes/where_func/README
index 4c57614b..b73aca05 100644
--- a/runtime/probes/where_func/README
+++ b/runtime/probes/where_func/README
@@ -23,4 +23,7 @@ The instrumentation is removed as root with:
/sbin/rmmod kprobe_funct_where
\endcode
-Will Cohen
+
+Note that this module is broken now because we don't pass the module parameter
+tp stpd. FIXME
*/
diff --git a/runtime/probes/where_func/build b/runtime/probes/where_func/build
new file mode 100755
index 00000000..f3e83244
--- /dev/null
+++ b/runtime/probes/where_func/build
@@ -0,0 +1,2 @@
+#!/bin/bash
+../build_probe $*
diff --git a/runtime/probes/where_func/kprobe_where_funct.c b/runtime/probes/where_func/kprobe_where_funct.c
index a325693a..e029a080 100644
--- a/runtime/probes/where_func/kprobe_where_funct.c
+++ b/runtime/probes/where_func/kprobe_where_funct.c
@@ -8,12 +8,11 @@
#define STP_NUM_STRINGS 1
#include "runtime.h"
+#define NEED_INT64_VALS
+
#define KEY1_TYPE INT64
#include "map-keys.c"
-#define VALUE_TYPE INT64
-#include "map-values.c"
-
#include "map.c"
#include "probes.c"
#include "sym.c"
diff --git a/runtime/probes/where_func/targets b/runtime/probes/where_func/targets
new file mode 100644
index 00000000..7e8e4cf1
--- /dev/null
+++ b/runtime/probes/where_func/targets
@@ -0,0 +1 @@
+kprobe_where_funct