* 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.
--- /dev/null
+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.
+
# Makefile
-
PWD := $(shell pwd)
RT := $(PWD)/../..
KVERSION := $(shell uname -r)
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
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.
--- /dev/null
+/** @dir agg
+Test probes to use the Counter and Stat aggregations.
+*/
--- /dev/null
+#!/bin/bash
+../build_probe $*
--- /dev/null
+#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");
+
--- /dev/null
+#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");
+
--- /dev/null
+#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");
+
--- /dev/null
+#!/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
--- /dev/null
+count1
+count2
+stat1
#!/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 ..
}
--- /dev/null
+#!/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}
+
+
--- /dev/null
+#!/bin/bash
+../build_probe $*
#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"
+++ /dev/null
-# 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
--- /dev/null
+#!/bin/bash
+../build_probe $*
#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"
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 */
--- /dev/null
+shellsnoop
+++ /dev/null
-# 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
--- /dev/null
+#!/bin/bash
+../build_probe $*
--- /dev/null
+stp_tasklet
+++ /dev/null
-# 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
--- /dev/null
+#!/bin/bash
+../build_probe $*
#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"
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;
}
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;
}
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);
+++ /dev/null
-# 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
/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
*/
--- /dev/null
+#!/bin/bash
+../build_probe $*
#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"
--- /dev/null
+kprobe_where_funct