diff options
author | hunt <hunt> | 2005-08-24 04:46:50 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-08-24 04:46:50 +0000 |
commit | cc1681194e8477ee7b253686ffffeff3b282d988 (patch) | |
tree | 7e9fdde1fb9baf1391c7749041281eed8354f1da /runtime/transport/procfs.c | |
parent | 856b5264e82294dd8dfe000f22d19d8535aeb754 (diff) | |
download | systemtap-steved-cc1681194e8477ee7b253686ffffeff3b282d988.tar.gz systemtap-steved-cc1681194e8477ee7b253686ffffeff3b282d988.tar.xz systemtap-steved-cc1681194e8477ee7b253686ffffeff3b282d988.zip |
2005-08-23 Martin Hunt <hunt@redhat.com>
* transport.c (_stp_cleanup_and_exit): Remove a 2 second sleep
that should no longer be necessary.
* procfs.c (_stp_write): If the ready queue is not empty
then attempt to grab the last buffer in it and append our data
to it.
Diffstat (limited to 'runtime/transport/procfs.c')
-rw-r--r-- | runtime/transport/procfs.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c index 8af2d018..6406908d 100644 --- a/runtime/transport/procfs.c +++ b/runtime/transport/procfs.c @@ -115,6 +115,7 @@ static ssize_t _stp_proc_write_cmd (struct file *file, const char __user *buf, struct _stp_buffer { struct list_head list; int len; + int type; char buf[STP_BUFFER_SIZE]; }; @@ -124,6 +125,21 @@ static int _stp_write (int type, void *data, int len) { struct _stp_buffer *bptr; +#define WRITE_AGG +#ifdef WRITE_AGG + spin_lock(&_stp_ready_lock); + if (!list_empty(&_stp_ready_q)) { + bptr = (struct _stp_buffer *)_stp_ready_q.prev; + if (bptr->len + len <= STP_BUFFER_SIZE && bptr->type == type) { + memcpy (bptr->buf + bptr->len - 1, data, len); + bptr->len += len - 1; + spin_unlock(&_stp_ready_lock); + return len; + } + } + spin_unlock(&_stp_ready_lock); +#endif + spin_lock(&_stp_pool_lock); if (list_empty(&_stp_pool_q)) { spin_unlock(&_stp_pool_lock); @@ -135,8 +151,8 @@ static int _stp_write (int type, void *data, int len) list_del_init(&bptr->list); spin_unlock(&_stp_pool_lock); - memcpy (bptr->buf, &type, 4); - memcpy (&bptr->buf[4], data, len); + bptr->type = type; + memcpy (bptr->buf, data, len); bptr->len = len; @@ -151,7 +167,6 @@ static int _stp_write (int type, void *data, int len) return len; } - static ssize_t _stp_proc_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *ppos) { @@ -176,7 +191,7 @@ _stp_proc_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *p /* write it out */ len = bptr->len + 4; - if (copy_to_user(buf, bptr->buf, len)) { + if (copy_to_user(buf, &bptr->type, len)) { /* now what? We took it off the queue then failed to send it */ /* we can't put it back on the queue because it will likely be out-of-order */ /* fortunately this should never happen */ @@ -193,7 +208,6 @@ _stp_proc_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *p } - static struct file_operations _stp_proc_fops_cmd = { .owner = THIS_MODULE, .read = _stp_proc_read_cmd, |