diff options
Diffstat (limited to 'runtime/probes/shellsnoop')
-rw-r--r-- | runtime/probes/shellsnoop/dtr.c | 56 | ||||
-rwxr-xr-x | runtime/probes/shellsnoop/stp | 16 |
2 files changed, 55 insertions, 17 deletions
diff --git a/runtime/probes/shellsnoop/dtr.c b/runtime/probes/shellsnoop/dtr.c index e529b054..b857a618 100644 --- a/runtime/probes/shellsnoop/dtr.c +++ b/runtime/probes/shellsnoop/dtr.c @@ -100,36 +100,62 @@ static struct jprobe dtr_probes[] = { #define MAX_DTR_ROUTINE (sizeof(dtr_probes)/sizeof(struct jprobe)) +static unsigned n_subbufs = 4; +module_param(n_subbufs, uint, 0); +MODULE_PARM_DESC(n_subbufs, "number of sub-buffers per per-cpu buffer"); + +static unsigned subbuf_size = 65536; +module_param(subbuf_size, uint, 0); +MODULE_PARM_DESC(subbuf_size, "size of each per-cpu sub-buffers"); + +static int pid; +module_param(pid, int, 0); +MODULE_PARM_DESC(pid, "daemon pid"); + static int init_dtr(void) { - int ret; + int ret; - if (_stp_netlink_open() < 0) - return -1; + if (!pid) { + printk("init_dtr: Can't start without daemon pid\n"); + return -1; + } - pids = _stp_map_new (10000, INT64); - arglist = _stp_list_new (10, STRING); + if (_stp_transport_open(n_subbufs, subbuf_size, pid) < 0) { + printk("init_dtr: Couldn't open transport\n"); + return -1; + } - ret = _stp_register_jprobes (dtr_probes, MAX_DTR_ROUTINE); + pids = _stp_map_new (10000, INT64); + arglist = _stp_list_new (10, STRING); - _stp_log("instrumentation is enabled... %s\n", __this_module.name); - return ret; + ret = _stp_register_jprobes (dtr_probes, MAX_DTR_ROUTINE); + + printk("instrumentation is enabled... %s\n", __this_module.name); + + return ret; } +static int exited; /* FIXME: this is a stopgap - if we don't do this + * and are manually removed, bad things happen */ + static void probe_exit (void) { - _stp_unregister_jprobes (dtr_probes, MAX_DTR_ROUTINE); + exited = 1; - _stp_print ("In probe_exit now."); - _stp_map_del (pids); - _stp_print_flush(); -} + _stp_unregister_jprobes (dtr_probes, MAX_DTR_ROUTINE); + _stp_print ("In probe_exit now."); + _stp_map_del (pids); + _stp_print_flush(); +} static void cleanup_dtr(void) { - _stp_netlink_close(); - + if (!exited) + probe_exit(); + + _stp_transport_close(); } module_init(init_dtr); diff --git a/runtime/probes/shellsnoop/stp b/runtime/probes/shellsnoop/stp index d10fcaab..14e8f47a 100755 --- a/runtime/probes/shellsnoop/stp +++ b/runtime/probes/shellsnoop/stp @@ -24,13 +24,25 @@ then mount -t relayfs relayfs /mnt/relay fi -/sbin/insmod $modulename +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 +../../stpd/stpd -b 8192 -n 4 $modulename + +# log to files (relayfs), 4 8K buffers +#../../stpd/stpd -r -b 8192 -n 4 $modulename + # print to screen and log to files, 4 8K buffers -../../stpd/stpd -b 8192 -n 4 +#../../stpd/stpd -b 8192 -n 4 # no screen or log #../../stpd/stpd -q -b 8192 -n 4 |