summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhunt <hunt>2007-04-02 17:03:26 +0000
committerhunt <hunt>2007-04-02 17:03:26 +0000
commit81406e9df9fe0b6f52fce796f070c4419bdf7986 (patch)
tree3e7852c9791351045aeb5bcd300e3952e94bf7d5
parentb8da0ad19d9dfcf88c4cd6dcf7b8aa73fc5016d7 (diff)
downloadsystemtap-steved-81406e9df9fe0b6f52fce796f070c4419bdf7986.tar.gz
systemtap-steved-81406e9df9fe0b6f52fce796f070c4419bdf7986.tar.xz
systemtap-steved-81406e9df9fe0b6f52fce796f070c4419bdf7986.zip
2007-04-02 Martin Hunt <hunt@redhat.com>
* transport_msgs.h (struct _stp_msg_trans): Deleted. Transport parameters are now read from procfs. * transport.c (_stp_ask_for_symbols): STP_TRANSPORT message is empty. * procfs.c (_stp_ctl_open_cmd): New. Set _stp_ pid. (_stp_ctl_close_cmd): New. Unset _stp_pid. (_stp_proc_fops_cmd): Add pointers to above funcs. (_stp_ctl_read_bufsize): New. (_stp_register_ctl_channel): Create a proc read entry "bufsize" containing transport buffer sizes.
-rw-r--r--runtime/transport/ChangeLog15
-rw-r--r--runtime/transport/procfs.c34
-rw-r--r--runtime/transport/transport.c10
-rw-r--r--runtime/transport/transport_msgs.h10
4 files changed, 49 insertions, 20 deletions
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog
index 319c50ac..23257b5e 100644
--- a/runtime/transport/ChangeLog
+++ b/runtime/transport/ChangeLog
@@ -1,3 +1,18 @@
+2007-04-02 Martin Hunt <hunt@redhat.com>
+
+ * transport_msgs.h (struct _stp_msg_trans): Deleted.
+ Transport parameters are now read from procfs.
+
+ * transport.c (_stp_ask_for_symbols): STP_TRANSPORT
+ message is empty.
+
+ * procfs.c (_stp_ctl_open_cmd): New. Set _stp_ pid.
+ (_stp_ctl_close_cmd): New. Unset _stp_pid.
+ (_stp_proc_fops_cmd): Add pointers to above funcs.
+ (_stp_ctl_read_bufsize): New.
+ (_stp_register_ctl_channel): Create a proc read entry
+ "bufsize" containing transport buffer sizes.
+
2007-03-28 Martin Hunt <hunt@redhat.com>
* control.c (_stp_ctl_open_cmd): Set _stp_pid.
diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c
index 92724f9f..a7b4cee5 100644
--- a/runtime/transport/procfs.c
+++ b/runtime/transport/procfs.c
@@ -237,11 +237,25 @@ _stp_ctl_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *pp
return len;
}
+static int _stp_ctl_open_cmd (struct inode *inode, struct file *file)
+{
+ _stp_pid = current->pid;
+ return 0;
+}
+
+static int _stp_ctl_close_cmd (struct inode *inode, struct file *file)
+{
+ _stp_pid = 0;
+ return 0;
+
+}
static struct file_operations _stp_proc_fops_cmd = {
.owner = THIS_MODULE,
.read = _stp_ctl_read_cmd,
.write = _stp_ctl_write_cmd,
+ .open = _stp_ctl_open_cmd,
+ .release = _stp_ctl_close_cmd,
};
static struct proc_dir_entry *_stp_proc_root, *_stp_proc_mod;
@@ -292,6 +306,21 @@ err:
return _stp_current_buffers;
}
+static int _stp_ctl_read_bufsize (char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ int len = sprintf(page, "%d,%d\n", _stp_nsubbufs, _stp_subbuf_size);
+ if (len <= off+count)
+ *eof = 1;
+ *start = page + off;
+ len -= off;
+ if (len > count)
+ len = count;
+ if (len < 0)
+ len = 0;
+ return len;
+}
+
static int _stp_register_ctl_channel (void)
{
int i;
@@ -301,7 +330,7 @@ static int _stp_register_ctl_channel (void)
int j;
#endif
- struct proc_dir_entry *de;
+ struct proc_dir_entry *de, *bs = NULL;
struct list_head *p, *tmp;
INIT_LIST_HEAD(&_stp_ready_q);
@@ -360,6 +389,7 @@ static int _stp_register_ctl_channel (void)
}
*(int *)de->data = i;
}
+ bs = create_proc_read_entry("bufsize", 0, _stp_proc_mod, _stp_ctl_read_bufsize, NULL);
#endif /* STP_BULKMODE */
/* finally create /proc/systemtap/module_name/cmd */
@@ -380,6 +410,7 @@ err1:
remove_proc_entry (buf, _stp_proc_mod);
}
+ if (bs) remove_proc_entry ("bufsize", _stp_proc_mod);
#endif /* STP_BULKMODE */
err0:
list_for_each_safe(p, tmp, &_stp_pool_q) {
@@ -407,6 +438,7 @@ static void _stp_unregister_ctl_channel (void)
sprintf(buf, "%d", i);
remove_proc_entry (buf, _stp_proc_mod);
}
+ remove_proc_entry ("bufsize", _stp_proc_mod);
#endif /* STP_BULKMODE */
remove_proc_entry ("cmd", _stp_proc_mod);
diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
index 50348f34..e2737dd6 100644
--- a/runtime/transport/transport.c
+++ b/runtime/transport/transport.c
@@ -69,7 +69,6 @@ void _stp_ask_for_symbols(void)
{
struct _stp_msg_symbol req;
struct _stp_module mod;
- struct _stp_msg_trans tran;
/* ask for symbols, modules, and send transport info */
kbug("AFS\n");
@@ -81,14 +80,7 @@ void _stp_ask_for_symbols(void)
strcpy(mod.name, "");
_stp_ctl_send(STP_MODULE, &mod, sizeof(mod));
-#ifdef STP_BULKMODE
- tran.bulk_mode = 1;
-#else
- tran.bulk_mode = 0;
-#endif
- tran.subbuf_size =_stp_subbuf_size;
- tran.n_subbufs = _stp_nsubbufs;
- _stp_ctl_send(STP_TRANSPORT, &tran, sizeof(tran));
+ _stp_ctl_send(STP_TRANSPORT, NULL, 0);
}
/*
diff --git a/runtime/transport/transport_msgs.h b/runtime/transport/transport_msgs.h
index be1a2914..dbbee41d 100644
--- a/runtime/transport/transport_msgs.h
+++ b/runtime/transport/transport_msgs.h
@@ -57,16 +57,6 @@ struct _stp_msg_start
int32_t res; // for reply: result of probe_start()
};
-/* transport information. sent to staprun */
-struct _stp_msg_trans
-{
- int32_t bulk_mode;
-
- /* old relayfs uses these */
- uint32_t subbuf_size;
- uint32_t n_subbufs;
-};
-
#ifdef STP_OLD_TRANSPORT
/**** for compatibility with old relayfs ****/
struct _stp_buf_info