Skip to contentSkip to conversation

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

PATCH Applied Peter Maydell 4 participants 4 messages Mar 30, 2011 – Apr 3, 2011

lore
Share & tools
lore
#0 lore raw

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

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.

---
 vl.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
vl.c +9 -2
index 5c9205f..4d9e503 100644
@@ -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;
     }
 }
Signature · 1 line
1.7.1
Acked-by on v1 1/1
#2 lore raw
In reply to Peter Maydell
Quoted 5 lines · Peter Maydell

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.

Quoted 28 lines
---
 vl.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
vl.c +9 -2
index 5c9205f..4d9e503 100644
@@ -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;
     }
 }
Signature · 1 line
1.7.1

--
Gleb.

#3 lore raw
In reply to Peter Maydell
Quoted 8 lines · Peter Maydell

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.

---
 vl.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

Thanks, applied.

Quoted 27 lines
vl.c +9 -2
index 5c9205f..4d9e503 100644
@@ -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;
     }
 }
Signature · 1 line
1.7.1
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net