]> sourceware.org Git - systemtap.git/commitdiff
2005-06-18 Martin Hunt <hunt@redhat.com>
authorhunt <hunt>
Sat, 18 Jun 2005 07:06:38 +0000 (07:06 +0000)
committerhunt <hunt>
Sat, 18 Jun 2005 07:06:38 +0000 (07:06 +0000)
* 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.

31 files changed:
runtime/probes/ChangeLog [new file with mode: 0644]
runtime/probes/Makefile.template [moved from runtime/probes/scf/Makefile with 89% similarity]
runtime/probes/README
runtime/probes/agg/README [new file with mode: 0644]
runtime/probes/agg/build [new file with mode: 0755]
runtime/probes/agg/count1.c [new file with mode: 0644]
runtime/probes/agg/count2.c [new file with mode: 0644]
runtime/probes/agg/stat1.c [new file with mode: 0644]
runtime/probes/agg/stp [new file with mode: 0755]
runtime/probes/agg/targets [new file with mode: 0644]
runtime/probes/build
runtime/probes/build_probe [new file with mode: 0755]
runtime/probes/scf/build [new file with mode: 0755]
runtime/probes/scf/scf.c
runtime/probes/scf/targets [new file with mode: 0644]
runtime/probes/shellsnoop/Makefile [deleted file]
runtime/probes/shellsnoop/build [new file with mode: 0755]
runtime/probes/shellsnoop/shellsnoop.c
runtime/probes/shellsnoop/targets [new file with mode: 0644]
runtime/probes/tasklet/Makefile [deleted file]
runtime/probes/tasklet/build [new file with mode: 0755]
runtime/probes/tasklet/targets [new file with mode: 0644]
runtime/probes/test4/Makefile [deleted file]
runtime/probes/test4/build [new file with mode: 0755]
runtime/probes/test4/targets [new file with mode: 0644]
runtime/probes/test4/test4.c
runtime/probes/where_func/Makefile [deleted file]
runtime/probes/where_func/README
runtime/probes/where_func/build [new file with mode: 0755]
runtime/probes/where_func/kprobe_where_funct.c
runtime/probes/where_func/targets [new file with mode: 0644]

diff --git a/runtime/probes/ChangeLog b/runtime/probes/ChangeLog
new file mode 100644 (file)
index 0000000..2464a5c
--- /dev/null
@@ -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.
+
similarity index 89%
rename from runtime/probes/scf/Makefile
rename to runtime/probes/Makefile.template
index 3f80332b2f5698f3bed6f0acfe55c54dfca62df9..ccdbbdee876b6414dd2e2eb1cc461fe1bc368df4 100644 (file)
@@ -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
index dd9fcd0c73b0d98f2b9b28d2de1e1e1d6cf6fd86..f3cd9fb2e5d446782a729fb114ebdb08a7bf0ec1 100644 (file)
@@ -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 (file)
index 0000000..b48db1b
--- /dev/null
@@ -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 (executable)
index 0000000..f3e8324
--- /dev/null
@@ -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 (file)
index 0000000..870dc32
--- /dev/null
@@ -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 (file)
index 0000000..ab13f5a
--- /dev/null
@@ -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 (file)
index 0000000..1d3cb3b
--- /dev/null
@@ -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 (executable)
index 0000000..185a590
--- /dev/null
@@ -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 (file)
index 0000000..614a00d
--- /dev/null
@@ -0,0 +1,3 @@
+count1
+count2
+stat1
index ac9994a9ae824424f084cd4f22cb02078f86e3d7..584f792af7a5841dcf67126bc4aab2df187ca9a8 100755 (executable)
@@ -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 (executable)
index 0000000..29846b2
--- /dev/null
@@ -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 (executable)
index 0000000..f3e8324
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+../build_probe $*
index dfdb7b0a51c0f9378c3ef6694dab7432de17ea05..a8798f511c3bea3eccab7df01ed46e6833e5bb9f 100644 (file)
@@ -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 (file)
index 0000000..aafcca2
--- /dev/null
@@ -0,0 +1 @@
+scf
diff --git a/runtime/probes/shellsnoop/Makefile b/runtime/probes/shellsnoop/Makefile
deleted file mode 100644 (file)
index 74e3559..0000000
+++ /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 (executable)
index 0000000..f3e8324
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+../build_probe $*
index 081ac700d649c2b064b645aa4c03b02fe006c8ef..86d2e54d03b28b6b22d451c774a8d9817e2919c8 100644 (file)
@@ -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 (file)
index 0000000..fdd0d72
--- /dev/null
@@ -0,0 +1 @@
+shellsnoop
diff --git a/runtime/probes/tasklet/Makefile b/runtime/probes/tasklet/Makefile
deleted file mode 100644 (file)
index a15e643..0000000
+++ /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 (executable)
index 0000000..f3e8324
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+../build_probe $*
diff --git a/runtime/probes/tasklet/targets b/runtime/probes/tasklet/targets
new file mode 100644 (file)
index 0000000..236dbd9
--- /dev/null
@@ -0,0 +1 @@
+stp_tasklet
diff --git a/runtime/probes/test4/Makefile b/runtime/probes/test4/Makefile
deleted file mode 100644 (file)
index 60afe8a..0000000
+++ /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 (executable)
index 0000000..f3e8324
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+../build_probe $*
diff --git a/runtime/probes/test4/targets b/runtime/probes/test4/targets
new file mode 100644 (file)
index 0000000..d234c5e
--- /dev/null
@@ -0,0 +1 @@
+test4
index f89cc6b9592985f4c3e757be6c17f1d8f6e88e10..9867d8efd59d5d6c456f97f96a55451f0d033c9d 100644 (file)
@@ -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 (file)
index c2c7d6b..0000000
+++ /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
index 4c57614b67111d5310832396d3d17945cd0c09ea..b73aca059c2cb908fee17dd4d592e41646c2ae90 100644 (file)
@@ -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 (executable)
index 0000000..f3e8324
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+../build_probe $*
index a325693abd99b3c05e11eb3aa187997887175acb..e029a080f24c257f61b914f5f1cfeaa1ce3cead4 100644 (file)
@@ -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 (file)
index 0000000..7e8e4cf
--- /dev/null
@@ -0,0 +1 @@
+kprobe_where_funct
This page took 0.41531 seconds and 5 git commands to generate.