diff options
author | Asias He <asias.hejun@gmail.com> | 2011-04-08 22:12:50 +0800 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2015-06-01 16:39:41 +0100 |
commit | b4405289e6180bd98050ebb6ab5192bf6a62a0a0 (patch) | |
tree | ebe708044a172adccc9c69ead1831d3ec43556ea /main.c | |
parent | 3ee180ed9444228dc07cb9a73965cff55d8b36bf (diff) | |
download | kvmtool-b4405289e6180bd98050ebb6ab5192bf6a62a0a0.tar.gz |
kvm tools: Move terminal related code to a new file term.c
This patch is a preparational step for virtio console and 8250 serial console
code consolidation.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 35 |
1 files changed, 3 insertions, 32 deletions
@@ -5,9 +5,9 @@ #include "kvm/disk-image.h" #include "kvm/util.h" #include "kvm/pci.h" +#include "kvm/term.h" #include <inttypes.h> -#include <termios.h> #include <signal.h> #include <stdint.h> #include <stdlib.h> @@ -29,32 +29,6 @@ static void usage(char *argv[]) static struct kvm *kvm; -static struct termios orig_term; - -static void setup_console(void) -{ - struct termios term; - - if (tcgetattr(STDIN_FILENO, &orig_term) < 0) - die("unable to save initial standard input settings"); - - term = orig_term; - - term.c_lflag &= ~(ICANON|ECHO); - - tcsetattr(STDIN_FILENO, TCSANOW, &term); -} - -static void cleanup_console(void) -{ - tcsetattr(STDIN_FILENO, TCSANOW, &orig_term); -} - -static void shutdown(void) -{ - cleanup_console(); -} - static void handle_sigint(int sig) { exit(1); @@ -65,7 +39,6 @@ static void handle_sigquit(int sig) kvm__show_registers(kvm); kvm__show_code(kvm); kvm__show_page_tables(kvm); - kvm__delete(kvm); exit(1); @@ -92,10 +65,6 @@ int main(int argc, char *argv[]) signal(SIGQUIT, handle_sigquit); signal(SIGINT, handle_sigint); - setup_console(); - - atexit(shutdown); - for (i = 1; i < argc; i++) { if (option_matches(argv[i], "--kernel=")) { kernel_filename = &argv[i][9]; @@ -138,6 +107,8 @@ int main(int argc, char *argv[]) if (!kernel_filename) usage(argv); + term_init(); + kvm = kvm__init(kvm_dev, ram_size); if (image_filename) { |