[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RISU PATCH v6 07/10] risu: handle trace through stdin/stdo
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [RISU PATCH v6 07/10] risu: handle trace through stdin/stdout |
Date: |
Wed, 21 Jun 2017 16:42:41 +0100 |
Trace files can get quite large so it would be useful to be able to
just capture the trace stream with stdin/stdout for processing in a
pipe line. The sort of case where this is useful is for building
static binaries where zlib support is missing for whatever reason.
It can also be used in testing pipelines.
Signed-off-by: Alex Bennée <address@hidden>
---
v6
- use STDIN/OUT_FILENO instead of fileno(foo)
- strcmp instead of strncmp
---
risu.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/risu.c b/risu.c
index 93c274b..476475c 100644
--- a/risu.c
+++ b/risu.c
@@ -312,7 +312,11 @@ int main(int argc, char **argv)
if (ismaster) {
if (trace) {
- master_fd = open(trace_fn, O_WRONLY|O_CREAT, S_IRWXU);
+ if (strcmp(trace_fn, "-")==0) {
+ master_fd = STDOUT_FILENO;
+ } else {
+ master_fd = open(trace_fn, O_WRONLY|O_CREAT, S_IRWXU);
+ }
} else {
fprintf(stderr, "master port %d\n", port);
master_fd = master_connect(port);
@@ -320,7 +324,11 @@ int main(int argc, char **argv)
return master();
} else {
if (trace) {
- apprentice_fd = open(trace_fn, O_RDONLY);
+ if (strcmp(trace_fn, "-")==0) {
+ apprentice_fd = STDIN_FILENO;
+ } else {
+ apprentice_fd = open(trace_fn, O_RDONLY);
+ }
} else {
fprintf(stderr, "apprentice host %s port %d\n", hostname, port);
apprentice_fd = apprentice_connect(hostname, port);
--
2.13.0
- [Qemu-devel] [RISU PATCH v6 00/10] Record/replay patches, Alex Bennée, 2017/06/21
- [Qemu-devel] [RISU PATCH v6 04/10] risu: paramterise send/receive functions, Alex Bennée, 2017/06/21
- [Qemu-devel] [RISU PATCH v6 01/10] README: document the coding style used for risu, Alex Bennée, 2017/06/21
- [Qemu-devel] [RISU PATCH v6 03/10] risu: a bit more verbosity when starting, Alex Bennée, 2017/06/21
- [Qemu-devel] [RISU PATCH v6 07/10] risu: handle trace through stdin/stdout,
Alex Bennée <=
- [Qemu-devel] [RISU PATCH v6 06/10] risu: add simple trace and replay support, Alex Bennée, 2017/06/21
- [Qemu-devel] [RISU PATCH v6 05/10] risu: add header to trace stream, Alex Bennée, 2017/06/21
- [Qemu-devel] [RISU PATCH v6 10/10] new: run_risu.sh script, Alex Bennée, 2017/06/21
- [Qemu-devel] [RISU PATCH v6 08/10] risu: add support compressed tracefiles, Alex Bennée, 2017/06/21
- [Qemu-devel] [RISU PATCH v6 09/10] new: record_traces.sh helper script, Alex Bennée, 2017/06/21
- Re: [Qemu-devel] [RISU PATCH v6 00/10] Record/replay patches, Peter Maydell, 2017/06/29