#include #include #include #include #include #include #include #include static const char * const stop_usage[] = { "kvm stop ", NULL }; static const struct option stop_options[] = { OPT_END() }; static int do_stop(const char *name, int pid) { return kill(pid, SIGKVMSTOP); } int kvm_cmd_stop(int argc, const char **argv, const char *prefix) { int pid; if (argc != 1) usage_with_options(stop_usage, stop_options); if (strcmp(argv[0], "all") == 0) { return kvm__enumerate_instances(do_stop); } pid = kvm__get_pid_by_instance(argv[0]); if (pid < 0) die("Failed locating instance name"); return kill(pid, SIGKVMSTOP); }