diff options
-rw-r--r-- | runtime/staprun/common.c | 9 | ||||
-rw-r--r-- | runtime/staprun/mainloop.c | 2 | ||||
-rw-r--r-- | runtime/staprun/staprun.c | 7 | ||||
-rw-r--r-- | runtime/transport/control.c | 5 | ||||
-rw-r--r-- | runtime/transport/procfs.c | 2 | ||||
-rw-r--r-- | runtime/transport/symbols.c | 6 | ||||
-rw-r--r-- | runtime/transport/transport.c | 4 | ||||
-rw-r--r-- | runtime/transport/transport_msgs.h | 10 |
8 files changed, 29 insertions, 16 deletions
diff --git a/runtime/staprun/common.c b/runtime/staprun/common.c index dca45e4d..fd16b4b8 100644 --- a/runtime/staprun/common.c +++ b/runtime/staprun/common.c @@ -14,6 +14,8 @@ #include <sys/types.h> #include <unistd.h> #include <sys/utsname.h> +#include <assert.h> + /* variables needed by parse_args() */ int verbose; @@ -323,11 +325,11 @@ err: * @len: length of the data to be sent * * Returns 0 on success, negative otherwise. - * XXX: no, it doesn't ... it should return @len on success. */ int send_request(int type, void *data, int len) { char buf[1024]; + int rc = 0; /* Before doing memcpy, make sure 'buf' is big enough. */ if ((len + 4) > (int)sizeof(buf)) { @@ -337,5 +339,8 @@ int send_request(int type, void *data, int len) memcpy(buf, &type, 4); memcpy(&buf[4], data, len); - return write(control_channel, buf, len + 4); + assert (control_channel >= 0); + rc = write (control_channel, buf, len + 4); + if (rc < 0) return rc; + return (rc != len+4); } diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c index 42037473..a7b919cb 100644 --- a/runtime/staprun/mainloop.c +++ b/runtime/staprun/mainloop.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * - * mainloop - staprun main loop + * mainloop - stapio main loop * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General diff --git a/runtime/staprun/staprun.c b/runtime/staprun/staprun.c index daebe705..6eb6d8b5 100644 --- a/runtime/staprun/staprun.c +++ b/runtime/staprun/staprun.c @@ -385,8 +385,13 @@ void send_relocation_modules () int send_relocations () { - int rc = send_relocation_kernel (); + int rc; + rc = init_ctl_channel (modname, 0); + if (rc < 0) goto out; + rc = send_relocation_kernel (); send_relocation_modules (); + close_ctl_channel (); + out: return rc; } diff --git a/runtime/transport/control.c b/runtime/transport/control.c index b366ccef..09506bb1 100644 --- a/runtime/transport/control.c +++ b/runtime/transport/control.c @@ -30,7 +30,9 @@ static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, siz count -= sizeof(u32); buf += sizeof(u32); + #ifdef DEBUG_TRANS + printk (KERN_INFO " control write_cmd: Got %s. len=%d\n", _stp_command_name[type], (int)count); if (type < STP_MAX_CMD) _dbug("Got %s. len=%d\n", _stp_command_name[type], (int)count); #endif @@ -57,7 +59,8 @@ static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, siz return -1; #endif case STP_RELOCATION: - _stp_do_relocation (buf, count); + _stp_do_relocation (buf, count); + break; case STP_READY: break; diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c index 750e1994..64b48e4d 100644 --- a/runtime/transport/procfs.c +++ b/runtime/transport/procfs.c @@ -122,6 +122,8 @@ static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, siz if (get_user(type, (int __user *)buf)) return -EFAULT; + printk (KERN_INFO " procfs write_cmd: Got %s. len=%d\n", _stp_command_name[type], (int)count); + #if DEBUG_TRANSPORT > 0 if (type < STP_MAX_CMD) _dbug("Got %s. len=%d\n", _stp_command_name[type], (int)count); diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c index cc0a1ce5..77263284 100644 --- a/runtime/transport/symbols.c +++ b/runtime/transport/symbols.c @@ -203,8 +203,7 @@ static int _stp_init_kernel_symbols(void) _stp_kretprobe_trampoline = 0; /* XXX */ _stp_modules_by_addr[0] = _stp_modules[0]; - printk (KERN_INFO "stap kernel data: symbols[%u]=%p\n", - _stp_num_kernel_symbols, _stp_kernel_symbols); + dbug_sym(2, "systemtap supplied %u kernel symbols\n", _stp_num_kernel_symbols); return 0; } @@ -222,8 +221,7 @@ static void _stp_do_relocation(const char __user *buf, size_t count) if (unlikely(copy_from_user (& msg, buf, count))) return; - dbug_sym (1, "STP_RELOCATE (%s %s %lx)\n", msg.module, msg.reloc, - (unsigned long) msg.address); + dbug_sym(2, "relocate (%s %s 0x%lx)\n", msg.module, msg.reloc, (unsigned long) msg.address); if (!strcmp (msg.module, "kernel") && !strcmp (msg.reloc, "_stext")) diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c index d149dd15..c6ca4c62 100644 --- a/runtime/transport/transport.c +++ b/runtime/transport/transport.c @@ -272,6 +272,10 @@ int _stp_transport_init(void) if (_stp_init_modules() < 0) goto err4; */ + + /* Signal stapio to send us STP_START back (XXX: ?!?!?!). */ + _stp_ctl_send(STP_TRANSPORT, NULL, 0); + return 0; err4: diff --git a/runtime/transport/transport_msgs.h b/runtime/transport/transport_msgs.h index 493c7105..596f4925 100644 --- a/runtime/transport/transport_msgs.h +++ b/runtime/transport/transport_msgs.h @@ -29,13 +29,11 @@ enum STP_DISCONNECT, STP_BULK, STP_READY, -#ifdef STP_OLD_TRANSPORT - /** deprecated **/ + STP_RELOCATION, + /** deprecated STP_OLD_TRANSPORT **/ STP_BUF_INFO, STP_SUBBUFS_CONSUMED, STP_REALTIME_DATA, -#endif - STP_RELOCATION, STP_MAX_CMD }; @@ -50,12 +48,10 @@ static const char *_stp_command_name[] = { "STP_DISCONNECT", "STP_BULK", "STP_READY", -#ifdef STP_OLD_TRANSPORT + "STP_RELOCATION", "STP_BUF_INFO", "STP_SUBBUFS_CONSUMED", "STP_REALTIME_DATA", -#endif - "STP_RELOCATION", }; #endif /* DEBUG_TRANS */ |