diff options
author | hunt <hunt> | 2007-04-02 17:03:57 +0000 |
---|---|---|
committer | hunt <hunt> | 2007-04-02 17:03:57 +0000 |
commit | da5bc00621edbd01f290b8f779b075d3048c99a0 (patch) | |
tree | d982f578f7a116e98512a9cde171c808b3fe2d5d /runtime/staprun/ctl.c | |
parent | 81406e9df9fe0b6f52fce796f070c4419bdf7986 (diff) | |
download | systemtap-steved-da5bc00621edbd01f290b8f779b075d3048c99a0.tar.gz systemtap-steved-da5bc00621edbd01f290b8f779b075d3048c99a0.tar.xz systemtap-steved-da5bc00621edbd01f290b8f779b075d3048c99a0.zip |
2007-04-02 Martin Hunt <hunt@redhat.com>
* relay_old.c (close_oldrelayfs): If just detaching, call
pthread_cancel.
(open_relayfs_files): Just return 0 if relay_fd[cpu] not opened.
(init_oldrelayfs): Scan percpu files to calculate ncpus.
* mainloop.c (init_staprun): Call old transport init when necessary.
(cleanup_and_exit): Ignore signals when cleaning up.
* ctl.c (read_buffer_info): For old transport, need to read transport
parameters.
Diffstat (limited to 'runtime/staprun/ctl.c')
-rw-r--r-- | runtime/staprun/ctl.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/runtime/staprun/ctl.c b/runtime/staprun/ctl.c index a217d270..95337f59 100644 --- a/runtime/staprun/ctl.c +++ b/runtime/staprun/ctl.c @@ -12,6 +12,40 @@ #include "staprun.h" +/* This is only used in the old relayfs code */ +static void read_buffer_info(void) +{ + char buf[128]; + struct statfs st; + int fd, len, ret; + + if (!use_old_transport) + return; + + if (statfs("/sys/kernel/debug", &st) == 0 && (int) st.f_type == (int) DEBUGFS_MAGIC) + return; + + sprintf (buf, "/proc/systemtap/%s/bufsize", modname); + fd = open(buf, O_RDONLY); + if (fd < 0) + return; + + len = read(fd, buf, sizeof(buf)); + if (len <= 0) { + fprintf (stderr, "ERROR: couldn't read bufsize.\n"); + close(fd); + return; + } + ret = sscanf(buf, "%u,%u", &n_subbufs, &subbuf_size); + if (ret != 2) + fprintf (stderr, "ERROR: couldn't read bufsize.\n"); + + dbug("n_subbufs= %u, size=%u\n", n_subbufs, subbuf_size); + close(fd); + return; +} + + int init_ctl_channel(void) { char buf[128]; @@ -32,6 +66,8 @@ int init_ctl_channel(void) fprintf (stderr, "errcode = %s\n", strerror(errno)); return -1; } + + read_buffer_info(); return 0; } |