All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [RISU PATCH v5 10/13] risu: handle trace through stdin/stdout
Date: Tue, 20 Jun 2017 15:58:52 +0100	[thread overview]
Message-ID: <87tw3au2mr.fsf@linaro.org> (raw)
In-Reply-To: <CAFEAcA9oPkE_5TVO6ameGqYO9b_jGXFn-yrPp3tjfnS5x8adCw@mail.gmail.com>


Peter Maydell <peter.maydell@linaro.org> writes:

> On 19 June 2017 at 11:46, Alex Bennée <alex.bennee@linaro.org> wrote:
>> 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 <alex.bennee@linaro.org>
>> ---
>>  risu.c | 12 ++++++++++--
>>  1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/risu.c b/risu.c
>> index 93c274b..e94b54b 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 (strncmp(trace_fn, "-", strlen(trace_fn))==0) {
>
> Why not just strcmp() ?

Years of habit...

>
>> +                master_fd = fileno(stdout);
>
>    = STDOUT_FILENO;

heh , the original version used that. I'll put it back.

>
>> +            } 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 (strncmp(trace_fn, "-", strlen(trace_fn))==0) {
>> +                apprentice_fd = fileno(stdin);
>
>  = 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
>>
>
> thanks
> -- PMM


--
Alex Bennée

  reply	other threads:[~2017-06-20 14:58 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-19 10:46 [Qemu-devel] [RISU PATCH v5 00/13] RISU record/replay patches Alex Bennée
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 01/13] .gitignore: ignore build directories Alex Bennée
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 02/13] README: document the coding style used for risu Alex Bennée
2017-06-20 12:54   ` Peter Maydell
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 03/13] all: fix up code consitency Alex Bennée
2017-06-20 13:13   ` Peter Maydell
2017-06-20 14:16     ` Peter Maydell
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 04/13] build-all-archs: support --static flag Alex Bennée
2017-06-20 14:07   ` Peter Maydell
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 05/13] build-all-archs: support cross building via docker Alex Bennée
2017-06-20 14:09   ` Peter Maydell
2017-06-20 14:57     ` Alex Bennée
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 06/13] risu: a bit more verbosity when starting Alex Bennée
2017-06-20 13:33   ` Peter Maydell
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 07/13] risu: paramterise send/receive functions Alex Bennée
2017-06-20 13:40   ` Peter Maydell
2017-06-20 13:54     ` Alex Bennée
2017-06-29 15:45     ` Alex Bennée
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 08/13] risu: add header to trace stream Alex Bennée
2017-06-20 13:55   ` Peter Maydell
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 09/13] risu: add simple trace and replay support Alex Bennée
2017-06-20 14:06   ` Peter Maydell
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 10/13] risu: handle trace through stdin/stdout Alex Bennée
2017-06-20 14:14   ` Peter Maydell
2017-06-20 14:58     ` Alex Bennée [this message]
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 11/13] risu: add support compressed tracefiles Alex Bennée
2017-06-20 14:15   ` Peter Maydell
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 12/13] new: record_traces.sh helper script Alex Bennée
2017-06-20 14:12   ` Peter Maydell
2017-06-20 14:57     ` Alex Bennée
2017-06-19 10:46 ` [Qemu-devel] [RISU PATCH v5 13/13] new: run_risu.sh script Alex Bennée
2017-06-20 14:11   ` Peter Maydell
2017-06-20 14:57     ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tw3au2mr.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.