summaryrefslogtreecommitdiff
path: root/blktrace.c
diff options
context:
space:
mode:
authorAlan D. Brunelle <alan.brunelle@hp.com>2010-09-16 09:26:22 -0400
committerAlan D. Brunelle <alan.brunelle@hp.com>2010-09-16 09:26:22 -0400
commitce2151ebdca6f2741dbd903aa3845c56adcba8f4 (patch)
tree4c69b8f9136a8d709d535aff93567b876e5e59b7 /blktrace.c
parentfb7f86674a516ddff0d60bfab3bd284a4812075f (diff)
downloadblktrace-ce2151ebdca6f2741dbd903aa3845c56adcba8f4.tar.gz
blktrace-ce2151ebdca6f2741dbd903aa3845c56adcba8f4.tar.bz2
blktrace: disallow -o when using multiple devices
Document that "-o" does not work when specyfing multiple devices to blktrace, also: enforce this by stopping blktrace when one tries do do this. The technical reason why "-o" doesn't work with multiple devices is because we use multiple threads of execution - one per device/CPU pair - and each of them opens a file named "<prefix>.blktrace.<cpu>". With the "-o" all of the "<prefix>" values are the same - so multiple threads open the same file and try to do output. Not good. Without the "-o" we get unique files named: "<device>.blktrace.<cpu>" - as the tuple (<device>,<cpu>) is unique. Signed-off-by: Alan D. Brunelle <Alan.Brunelle@hp.com>
Diffstat (limited to 'blktrace.c')
-rw-r--r--blktrace.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/blktrace.c b/blktrace.c
index b9f9b68..4671a04 100644
--- a/blktrace.c
+++ b/blktrace.c
@@ -2626,6 +2626,12 @@ int main(int argc, char *argv[])
goto out;
}
+ if (ndevs > 1 && output_name && strcmp(output_name, "-") != 0) {
+ fprintf(stderr, "-o not supported with multiple devices\n");
+ ret = 1;
+ goto out;
+ }
+
signal(SIGINT, handle_sigint);
signal(SIGHUP, handle_sigint);
signal(SIGTERM, handle_sigint);