From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com, berrange@redhat.com,
alistair.francis@xilinx.com, Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH v5 1/4] shutdown: Simplify shutdown_signal
Date: Thu, 27 Apr 2017 21:13:14 -0500 [thread overview]
Message-ID: <20170428021317.24711-2-eblake@redhat.com> (raw)
In-Reply-To: <20170428021317.24711-1-eblake@redhat.com>
There is no signal 0 (kill(pid, 0) has special semantics to probe whether
a process is alive), rather than actually sending a signal 0). So we
can use the simpler 0, instead of -1, for our sentinel of whether a
shutdown request due to a signal has happened.
Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
v3: new patch
---
vl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/vl.c b/vl.c
index f46e070..879786a 100644
--- a/vl.c
+++ b/vl.c
@@ -1598,7 +1598,7 @@ void vm_state_notify(int running, RunState state)
}
static int reset_requested;
-static int shutdown_requested, shutdown_signal = -1;
+static int shutdown_requested, shutdown_signal;
static pid_t shutdown_pid;
static int powerdown_requested;
static int debug_requested;
@@ -1629,7 +1629,7 @@ static int qemu_shutdown_requested(void)
static void qemu_kill_report(void)
{
- if (!qtest_driver() && shutdown_signal != -1) {
+ if (!qtest_driver() && shutdown_signal) {
if (shutdown_pid == 0) {
/* This happens for eg ^C at the terminal, so it's worth
* avoiding printing an odd message in that case.
@@ -1643,7 +1643,7 @@ static void qemu_kill_report(void)
shutdown_cmd ? shutdown_cmd : "<unknown process>");
g_free(shutdown_cmd);
}
- shutdown_signal = -1;
+ shutdown_signal = 0;
}
}
--
2.9.3
next prev parent reply other threads:[~2017-04-28 2:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-28 2:13 [Qemu-devel] [PATCH v5 0/4] event: Add source information to SHUTDOWN Eric Blake
2017-04-28 2:13 ` Eric Blake [this message]
2017-04-28 14:42 ` [Qemu-devel] [PATCH v5 1/4] shutdown: Simplify shutdown_signal Markus Armbruster
2017-04-28 2:13 ` [Qemu-devel] [PATCH v5 2/4] shutdown: Prepare for use of an enum in reset/shutdown_request Eric Blake
2017-04-28 8:08 ` Dr. David Alan Gilbert
2017-04-28 14:35 ` Eric Blake
2017-04-28 15:27 ` Dr. David Alan Gilbert
2017-04-28 15:57 ` Eric Blake
2017-04-28 16:09 ` Dr. David Alan Gilbert
2017-04-28 18:05 ` Eric Blake
2017-04-28 18:13 ` Dr. David Alan Gilbert
2017-04-28 14:45 ` Markus Armbruster
2017-04-28 14:42 ` Markus Armbruster
2017-04-28 22:34 ` Eric Blake
2017-05-02 11:47 ` Markus Armbruster
2017-04-28 2:13 ` [Qemu-devel] [PATCH v5 3/4] shutdown: Add source information to SHUTDOWN and RESET Eric Blake
2017-04-28 15:01 ` Markus Armbruster
2017-04-28 22:44 ` [Qemu-devel] replay help [was: [PATCH v5 3/4] shutdown: Add source information to SHUTDOWN and RESET] Eric Blake
2017-05-02 10:54 ` Pavel Dovgalyuk
2017-05-02 8:13 ` [Qemu-devel] [PATCH v5 3/4] shutdown: Add source information to SHUTDOWN and RESET Pavel Dovgalyuk
2017-05-01 3:58 ` David Gibson
2017-05-05 8:36 ` Mark Cave-Ayland
2017-04-28 2:13 ` [Qemu-devel] [PATCH v5 4/4] RFC: shutdown: Expose full ShutdownCause across QMP Eric Blake
2017-04-28 22:48 ` Eric Blake
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=20170428021317.24711-2-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=alistair.francis@xilinx.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).