diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2009-04-02 18:44:34 -0400 |
---|---|---|
committer | Masami Hiramatsu <mhiramat@redhat.com> | 2009-04-02 18:44:34 -0400 |
commit | 5aa1f218c5ff8a459c324ac64ee7a9b8046e683d (patch) | |
tree | 323698c22c97a7d466a10990d3d810528d85ba2e | |
parent | 093421c6ba933754aa52cf6399aae5b8f86d86d9 (diff) | |
download | systemtap-steved-5aa1f218c5ff8a459c324ac64ee7a9b8046e683d.tar.gz systemtap-steved-5aa1f218c5ff8a459c324ac64ee7a9b8046e683d.tar.xz systemtap-steved-5aa1f218c5ff8a459c324ac64ee7a9b8046e683d.zip |
Fix a bug in file size limitation code.
This fixes a bug in stapio, which checks written data size and switches
new file when it exceeds a limit. The problem is that written-data-size
counter ignores the first written-data size when switching files. So,
actual file size always exceeds the limit. This changes stapio to
initialize written-data-size counter with the size of the data which
will be written in new file.
-rw-r--r-- | runtime/staprun/relay.c | 2 | ||||
-rw-r--r-- | runtime/staprun/relay_old.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/runtime/staprun/relay.c b/runtime/staprun/relay.c index 50f295b5..694cb27e 100644 --- a/runtime/staprun/relay.c +++ b/runtime/staprun/relay.c @@ -200,7 +200,7 @@ static void *reader_thread(void *data) perr("Couldn't open file for cpu %d, exiting.", cpu); return(NULL); } - wsize = 0; + wsize = rc; } if (write(out_fd[cpu], buf, rc) != rc) { perr("Couldn't write to output %d for cpu %d, exiting.", out_fd[cpu], cpu); diff --git a/runtime/staprun/relay_old.c b/runtime/staprun/relay_old.c index ef8fd0da..469a5831 100644 --- a/runtime/staprun/relay_old.c +++ b/runtime/staprun/relay_old.c @@ -241,7 +241,7 @@ static int process_subbufs(struct _stp_buf_info *info, perr("Couldn't open file for cpu %d, exiting.", cpu); exit(1); } - scb->wsize = 0; + scb->wsize = len; } if (len) { if (fwrite_unlocked (subbuf_ptr, len, 1, percpu_tmpfile[cpu]) != 1) { @@ -320,7 +320,7 @@ int write_realtime_data(void *data, ssize_t nb) perr("Couldn't open file, exiting."); return -1; } - global_scb.wsize = 0; + global_scb.wsize = nb; } bw = write(out_fd[0], data, nb); if (bw >= 0 && bw != nb) { |