diff options
author | hunt <hunt> | 2008-01-15 19:54:25 +0000 |
---|---|---|
committer | hunt <hunt> | 2008-01-15 19:54:25 +0000 |
commit | 9012e89f2c17fddccac864f366af495ba7703f9b (patch) | |
tree | 8d0856fc9007feb7ea701a10b2fc4aa1268b1e89 /runtime/transport/procfs.c | |
parent | f4740301228bdc839e8c506dff9561b848dcc8f8 (diff) | |
download | systemtap-steved-9012e89f2c17fddccac864f366af495ba7703f9b.tar.gz systemtap-steved-9012e89f2c17fddccac864f366af495ba7703f9b.tar.xz systemtap-steved-9012e89f2c17fddccac864f366af495ba7703f9b.zip |
PR4037 and fixes to better synchronize staprun and stapio.
Diffstat (limited to 'runtime/transport/procfs.c')
-rw-r--r-- | runtime/transport/procfs.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c index 5d40cae4..85e97d15 100644 --- a/runtime/transport/procfs.c +++ b/runtime/transport/procfs.c @@ -68,35 +68,38 @@ static struct file_operations _stp_proc_fops = { static ssize_t _stp_sym_write_cmd (struct file *file, const char __user *buf, size_t count, loff_t *ppos) { + static int saved_type = 0; int type; - if (count < sizeof(int)) + if (count < sizeof(int32_t)) return 0; - if (get_user(type, (int __user *)buf)) - return -EFAULT; - - kbug ("count:%d type:%d\n", (int)count, type); - - if (type == STP_SYMBOLS) { - count -= sizeof(long); - buf += sizeof(long); + /* Allow sending of packet type followed by data in the next packet.*/ + if (count == sizeof(int32_t)) { + if (get_user(saved_type, (int __user *)buf)) + return -EFAULT; + return count; + } else if (saved_type) { + type = saved_type; + saved_type = 0; } else { + if (get_user(type, (int __user *)buf)) + return -EFAULT; count -= sizeof(int); buf += sizeof(int); } + + // kbug ("count:%d type:%d\n", (int)count, type); switch (type) { - case STP_SYMBOLS: - - if (count) - count = _stp_do_symbols(buf, count); + case STP_SYMBOLS: + count = _stp_do_symbols(buf, count); break; case STP_MODULE: - if (count) + if (count > 1) count = _stp_do_module(buf, count); else { - /* count == 0 indicates end of initial modules list */ + /* count == 1 indicates end of initial modules list */ _stp_ctl_send(STP_TRANSPORT, NULL, 0); } break; @@ -106,6 +109,7 @@ static ssize_t _stp_sym_write_cmd (struct file *file, const char __user *buf, } return count; + } static ssize_t _stp_ctl_write_cmd (struct file *file, const char __user *buf, size_t count, loff_t *ppos) @@ -139,6 +143,10 @@ static ssize_t _stp_ctl_write_cmd (struct file *file, const char __user *buf, case STP_EXIT: _stp_exit_flag = 1; break; + case STP_READY: + /* request symbolic information */ + _stp_ask_for_symbols(); + break; default: errk ("invalid command type %d\n", type); return -EINVAL; |