summaryrefslogtreecommitdiffstats
path: root/runtime/transport/procfs.c
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 /runtime/transport/procfs.c
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.
Diffstat (limited to 'runtime/transport/procfs.c')
-rw-r--r--runtime/transport/procfs.c34
1 files changed, 33 insertions, 1 deletions
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);