summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/relay_old.c
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/staprun/relay_old.c')
-rw-r--r--runtime/staprun/relay_old.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/runtime/staprun/relay_old.c b/runtime/staprun/relay_old.c
index 11a73cd7..01acbbd6 100644
--- a/runtime/staprun/relay_old.c
+++ b/runtime/staprun/relay_old.c
@@ -14,7 +14,6 @@
#include "staprun.h"
/* temporary per-cpu output written here for relayfs, filebase0...N */
-static char *percpu_tmpfilebase = "stpd_cpu";
static int relay_fd[NR_CPUS];
static int proc_fd[NR_CPUS];
static FILE *percpu_tmpfile[NR_CPUS];
@@ -98,7 +97,15 @@ static int open_relayfs_files(int cpu, const char *relay_filebase, const char *p
goto err1;
}
- sprintf(tmp, "%s%d", percpu_tmpfilebase, cpu);
+ if (outfile_name) {
+ /* special case: for testing we sometimes want to write to /dev/null */
+ if (strcmp(outfile_name, "/dev/null") == 0)
+ strcpy(tmp, outfile_name);
+ else
+ sprintf(tmp, "%s_%d", outfile_name, cpu);
+ } else
+ sprintf(tmp, "stpd_cpu%d", cpu);
+
if((percpu_tmpfile[cpu] = fopen(tmp, "w+")) == NULL) {
fprintf(stderr, "ERROR: Couldn't open output file %s: errcode = %s\n", tmp, strerror(errno));
goto err2;