summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/mainloop.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2009-03-20 12:11:30 -0400
committerMasami Hiramatsu <mhiramat@redhat.com>2009-03-20 12:11:30 -0400
commitacd56c22068963ad48f39890f5307600ff7d5278 (patch)
treeacd04f64c1e90a1399c3682a93580b8a9313c82b /runtime/staprun/mainloop.c
parent54892f28a2747079fae4aa35b80598cbb993a4c3 (diff)
downloadsystemtap-steved-acd56c22068963ad48f39890f5307600ff7d5278.tar.gz
systemtap-steved-acd56c22068963ad48f39890f5307600ff7d5278.tar.xz
systemtap-steved-acd56c22068963ad48f39890f5307600ff7d5278.zip
PR6930: stapio: support file switching
Add file-switching option(-S size[,N]) to stapio. This option has two arguments, 'size' and 'N', and requires -o option. - When the size of output file exceeds specified 'size'MB, staprun switches output file to the next file. For this purpose, all output file has a serial number as a suffix only when user specifies this option. - Using this option in bulk mode, the output file name will be 'FILE_cpuX.SERIAL'. - When the number of files exceeds specified N, staprun removes the oldest file. This argument can be omitted.
Diffstat (limited to 'runtime/staprun/mainloop.c')
-rw-r--r--runtime/staprun/mainloop.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c
index b0d88073..c80bbba4 100644
--- a/runtime/staprun/mainloop.c
+++ b/runtime/staprun/mainloop.c
@@ -489,18 +489,11 @@ int stp_main_loop(void)
switch (type) {
#ifdef STP_OLD_TRANSPORT
case STP_REALTIME_DATA:
- {
- ssize_t bw = write(out_fd[0], data, nb);
- if (bw >= 0 && bw != nb) {
- nb = nb - bw;
- bw = write(out_fd[0], data, nb);
- }
- if (bw != nb) {
- _perr("write error (nb=%ld)", (long)nb);
- cleanup_and_exit(0);
- }
- break;
+ if (write_realtime_data(data, nb)) {
+ _perr("write error (nb=%ld)", (long)nb);
+ cleanup_and_exit(0);
}
+ break;
#endif
case STP_OOB_DATA:
eprintf("%s", (char *)data);