Use clean shutdown request for ctrl-a x
PATCH 1/1 Use clean shutdown request for ctrl-a x
--- qemu-char.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-char.c +1 -1
@@ -353,7 +353,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch) {const char *term ="QEMU: Terminated\n\r" ; chr->chr_write (chr,(uint8_t *)term,strlen (term)); -exit (0 ); +qemu_system_shutdown_request ();break ; }case 's' :
Signature · 1 line
1.7.9.5
Quoted 20 lines · Fabien Chouteau
Signed-off-by Fabien Chouteau <[email protected]>--- qemu-char.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)qemu-char.c +1
-2@@ -353,7 +353,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch) {const char *term ="QEMU: Terminated\n\r" ; chr->chr_write (chr,(uint8_t *)term,strlen (term)); -exit (0 ); +qemu_system_shutdown_request ();break ; }case 's' : --
Quoted 1 line
1.7.9.5
I was just talking on #qemu this morning about the equivalent question of whether the ARM semihosting exit function ought to be doing a qemu_system_shutdown_request rather than a plain exit()...
The interesting question for the qemu-char case is whether the code that feeds this magic byte to us is expecting it to have immediate effect or is happy to continue execution and let us shut down with a slight delay.
-- PMM
Il 03/07/2012 16:00, Peter Maydell ha scritto:
Quoted 8 lines
I was just talking on #qemu this morning about the equivalent question of whether the ARM semihosting exit function ought to be doing a
qemu_system_shutdown_requestrather than a plainexit()...The interesting question for the qemu-char case is whether the code that feeds this magic byte to us is expecting it to have immediate effect or is happy to continue execution and let us shut down with a slight delay.
And also whether it is supposed to obey -no-shutdown...
Paolo
Quoted 11 lines · Paolo Bonzini
Il 03/07/2012 16:00, Peter Maydell ha scritto:
Quoted 8 lines
I was just talking on #qemu this morning about the equivalent question of whether the ARM semihosting exit function ought to be doing a
qemu_system_shutdown_requestrather than a plainexit()...The interesting question for the qemu-char case is whether the code that feeds this magic byte to us is expecting it to have immediate effect or is happy to continue execution and let us shut down with a slight delay.
And also whether it is supposed to obey -no-shutdown...
I didn't know this option...
My goal is to make ctrl-a x to close Qemu in a clean way. The current exit(0) skips a lot of cleanup/close functions, for example in block drivers.
We can create a new shutdown function that will override the -no-shutdown option to keep a consistent behavior with ctrl-a x.
void qemu_system_force_shutdown(void)
{
no_shutdown = 0;
qemu_system_shutdown_request();
}Signature · 1 line
Fabien Chouteau
Am 03.07.2012 17:07, schrieb Fabien Chouteau:
Quoted 19 lines · Paolo Bonzini
Quoted 11 lines
Il 03/07/2012 16:00, Peter Maydell ha scritto:
Quoted 8 lines
I was just talking on #qemu this morning about the equivalent question of whether the ARM semihosting exit function ought to be doing a
qemu_system_shutdown_requestrather than a plainexit()...The interesting question for the qemu-char case is whether the code that feeds this magic byte to us is expecting it to have immediate effect or is happy to continue execution and let us shut down with a slight delay.
And also whether it is supposed to obey -no-shutdown...
I didn't know this option...
My goal is to make ctrl-a x to close Qemu in a clean way. The current exit(0) skips a lot of cleanup/close functions, for example in block drivers.
Quoted 8 lines
We can create a new shutdown function that will override the -no-shutdown option to keep a consistent behavior with ctrl-a x.
void
qemu_system_force_shutdown(void){ no_shutdown = 0; qemu_system_shutdown_request(); }
The same thing already exists in qemu_system_killed(). It could use the same new function if you added it. Or you could reuse the existing code in the ctrl-a x handler by sending SIGTERM.
Kevin
Quoted 29 lines · Kevin Wolf
Am 03.07.2012 17:07, schrieb Fabien Chouteau:
Quoted 19 lines · Paolo Bonzini
Quoted 11 lines
Il 03/07/2012 16:00, Peter Maydell ha scritto:
Quoted 8 lines
I was just talking on #qemu this morning about the equivalent question of whether the ARM semihosting exit function ought to be doing a
qemu_system_shutdown_requestrather than a plainexit()...The interesting question for the qemu-char case is whether the code that feeds this magic byte to us is expecting it to have immediate effect or is happy to continue execution and let us shut down with a slight delay.
And also whether it is supposed to obey -no-shutdown...
I didn't know this option...
My goal is to make ctrl-a x to close Qemu in a clean way. The current exit(0) skips a lot of cleanup/close functions, for example in block drivers.
Quoted 8 lines
We can create a new shutdown function that will override the -no-shutdown option to keep a consistent behavior with ctrl-a x.
void
qemu_system_force_shutdown(void){ no_shutdown = 0; qemu_system_shutdown_request(); }
Quoted 4 lines
The same thing already exists in
qemu_system_killed(). It could use the same new function if you added it. Or you could reuse the existing code in the ctrl-a x handler by sending SIGTERM.
This function will change the behavior of ctrl-a x by printing "qemu:
terminating on signal 0".
Signature · 1 line
Fabien Chouteau
Am 04.07.2012 12:27, schrieb Fabien Chouteau:
Quoted 30 lines · Kevin Wolf
Quoted 29 lines
Am 03.07.2012 17:07, schrieb Fabien Chouteau:
Quoted 27 lines · Paolo Bonzini
Quoted 11 lines
Il 03/07/2012 16:00, Peter Maydell ha scritto:
Quoted 8 lines
I was just talking on #qemu this morning about the equivalent question of whether the ARM semihosting exit function ought to be doing a
qemu_system_shutdown_requestrather than a plainexit()...The interesting question for the qemu-char case is whether the code that feeds this magic byte to us is expecting it to have immediate effect or is happy to continue execution and let us shut down with a slight delay.
And also whether it is supposed to obey -no-shutdown...
I didn't know this option...
My goal is to make ctrl-a x to close Qemu in a clean way. The current exit(0) skips a lot of cleanup/close functions, for example in block drivers.
We can create a new shutdown function that will override the -no-shutdown option to keep a consistent behavior with ctrl-a x.
void
qemu_system_force_shutdown(void){ no_shutdown = 0; qemu_system_shutdown_request(); }
Quoted 7 lines
Quoted 4 lines
The same thing already exists in
qemu_system_killed(). It could use the same new function if you added it. Or you could reuse the existing code in the ctrl-a x handler by sending SIGTERM.This function will change the behavior of ctrl-a x by printing "qemu:
terminating on signal 0".
True (on signal 15 actually if you send SIGTERM). So using a new qemu_system_force_shutdown() in both places is fine with me.
Kevin
Quoted 36 lines · Kevin Wolf
Am 04.07.2012 12:27, schrieb Fabien Chouteau:
Quoted 35 lines · Kevin Wolf
Quoted 33 lines
Am 03.07.2012 17:07, schrieb Fabien Chouteau:
Quoted 19 lines · Paolo Bonzini
Quoted 11 lines
Il 03/07/2012 16:00, Peter Maydell ha scritto:
Quoted 8 lines
I was just talking on #qemu this morning about the equivalent question of whether the ARM semihosting exit function ought to be doing a
qemu_system_shutdown_requestrather than a plainexit()...The interesting question for the qemu-char case is whether the code that feeds this magic byte to us is expecting it to have immediate effect or is happy to continue execution and let us shut down with a slight delay.
And also whether it is supposed to obey -no-shutdown...
I didn't know this option...
My goal is to make ctrl-a x to close Qemu in a clean way. The current exit(0) skips a lot of cleanup/close functions, for example in block drivers.
Quoted 8 lines
We can create a new shutdown function that will override the -no-shutdown option to keep a consistent behavior with ctrl-a x.
void
qemu_system_force_shutdown(void){ no_shutdown = 0; qemu_system_shutdown_request(); }The same thing already exists in
qemu_system_killed(). It could use the same new function if you added it. Or you could reuse the existing code in the ctrl-a x handler by sending SIGTERM.
Quoted 6 lines
Quoted 2 lines
This function will change the behavior of ctrl-a x by printing "qemu:
terminating on signal 0".True (on signal 15 actually if you send SIGTERM). So using a new
qemu_system_force_shutdown()in both places is fine with me.
OK, patch on the way...
Thanks,
Signature · 1 line
Fabien Chouteau