From: Stefan Hajnoczi <stefanha@redhat.com>
To: Claudio Fontana <cfontana@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, Dario Faggioli <dfaggioli@suse.com>,
Fabiano Rosas <farosas@suse.de>
Subject: Re: [PATCH] tools/kvm_stat: fix termination behavior when not on a terminal
Date: Mon, 12 Aug 2024 11:33:16 -0400 [thread overview]
Message-ID: <20240812153316.GA68729@fedora> (raw)
In-Reply-To: <20240807172334.1006-1-cfontana@suse.de>
[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]
On Wed, Aug 07, 2024 at 07:23:34PM +0200, Claudio Fontana wrote:
> For the -l and -L options (logging mode), replace the use of the
> KeyboardInterrupt exception to gracefully terminate in favor
> of handling the SIGINT and SIGTERM signals.
>
> This allows the program to be run from scripts and still be
> signaled to gracefully terminate without an interactive terminal.
>
> Before this change, something like this script:
>
> kvm_stat -p 85896 -d -t -s 1 -c -L kvm_stat_85896.csv &
> sleep 10
> pkill -TERM -P $$
>
> would yield an empty log:
> -rw-r--r-- 1 root root 0 Aug 7 16:17 kvm_stat_85896.csv
>
> after this commit:
> -rw-r--r-- 1 root root 13466 Aug 7 16:57 kvm_stat_85896.csv
>
> Signed-off-by: Claudio Fontana <cfontana@suse.de>
> Cc: Dario Faggioli <dfaggioli@suse.com>
> Cc: Fabiano Rosas <farosas@suse.de>
> ---
> tools/kvm/kvm_stat/kvm_stat | 64 ++++++++++++++++-----------------
> tools/kvm/kvm_stat/kvm_stat.txt | 12 +++++++
> 2 files changed, 44 insertions(+), 32 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2024-08-12 15:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 17:23 [PATCH] tools/kvm_stat: fix termination behavior when not on a terminal Claudio Fontana
2024-08-12 15:33 ` Stefan Hajnoczi [this message]
2024-10-21 13:26 ` Juergen Gross
2024-11-27 16:30 ` Claudio Fontana
2025-04-03 14:01 ` Claudio Fontana
2025-04-03 14:24 ` Claudio Fontana
2025-04-07 11:03 ` Juergen Gross
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=20240812153316.GA68729@fedora \
--to=stefanha@redhat.com \
--cc=cfontana@suse.de \
--cc=dfaggioli@suse.com \
--cc=farosas@suse.de \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox