diff mbox

vl.c: Tidy up message printed when we exit on a signal

Message ID 1301519018-26680-1-git-send-email-peter.maydell@linaro.org
State Accepted
Commit f1d3fb04d55f46d39073e7089a5be43a16e80aa9
Headers show

Commit Message

Peter Maydell March 30, 2011, 9:03 p.m. UTC
Tidy up the message printed when qemu exits due to a signal, so that
it's clearer where the message is coming from and that it's not just
stray debug output.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 vl.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

Comments

Stefan Hajnoczi March 31, 2011, 6:19 a.m. UTC | #1
On Wed, Mar 30, 2011 at 10:03 PM, Peter Maydell
<peter.maydell@linaro.org> wrote:
> Tidy up the message printed when qemu exits due to a signal, so that
> it's clearer where the message is coming from and that it's not just
> stray debug output.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  vl.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Gleb Natapov March 31, 2011, 8:37 a.m. UTC | #2
On Wed, Mar 30, 2011 at 10:03:38PM +0100, Peter Maydell wrote:
> Tidy up the message printed when qemu exits due to a signal, so that
> it's clearer where the message is coming from and that it's not just
> stray debug output.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Gleb Natapov <gleb@redhat.com>

> ---
>  vl.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/vl.c b/vl.c
> index 5c9205f..4d9e503 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1169,8 +1169,15 @@ int qemu_shutdown_requested(void)
>  void qemu_kill_report(void)
>  {
>      if (shutdown_signal != -1) {
> -        fprintf(stderr, "Got signal %d from pid %d\n",
> -                         shutdown_signal, shutdown_pid);
> +        fprintf(stderr, "qemu: terminating on signal %d", 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.
> +             */
> +            fputc('\n', stderr);
> +        } else {
> +            fprintf(stderr, " from pid %d\n", shutdown_pid);
> +        }
>          shutdown_signal = -1;
>      }
>  }
> -- 
> 1.7.1

--
			Gleb.
Aurelien Jarno April 3, 2011, 10:25 p.m. UTC | #3
On Wed, Mar 30, 2011 at 10:03:38PM +0100, Peter Maydell wrote:
> Tidy up the message printed when qemu exits due to a signal, so that
> it's clearer where the message is coming from and that it's not just
> stray debug output.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  vl.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)

Thanks, applied.

> diff --git a/vl.c b/vl.c
> index 5c9205f..4d9e503 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1169,8 +1169,15 @@ int qemu_shutdown_requested(void)
>  void qemu_kill_report(void)
>  {
>      if (shutdown_signal != -1) {
> -        fprintf(stderr, "Got signal %d from pid %d\n",
> -                         shutdown_signal, shutdown_pid);
> +        fprintf(stderr, "qemu: terminating on signal %d", 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.
> +             */
> +            fputc('\n', stderr);
> +        } else {
> +            fprintf(stderr, " from pid %d\n", shutdown_pid);
> +        }
>          shutdown_signal = -1;
>      }
>  }
> -- 
> 1.7.1
> 
> 
>
diff mbox

Patch

diff --git a/vl.c b/vl.c
index 5c9205f..4d9e503 100644
--- a/vl.c
+++ b/vl.c
@@ -1169,8 +1169,15 @@  int qemu_shutdown_requested(void)
 void qemu_kill_report(void)
 {
     if (shutdown_signal != -1) {
-        fprintf(stderr, "Got signal %d from pid %d\n",
-                         shutdown_signal, shutdown_pid);
+        fprintf(stderr, "qemu: terminating on signal %d", 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.
+             */
+            fputc('\n', stderr);
+        } else {
+            fprintf(stderr, " from pid %d\n", shutdown_pid);
+        }
         shutdown_signal = -1;
     }
 }