mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-08-28 18:15:41 +00:00
2a24f96d64
Rename kvm-[command] into builtin-[command] to prevent clashes with non-command files such as kvm-cpu.h Suggested-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
33 lines
593 B
C
33 lines
593 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <signal.h>
|
|
|
|
#include <kvm/util.h>
|
|
#include <kvm/kvm-cmd.h>
|
|
#include <kvm/builtin-pause.h>
|
|
#include <kvm/kvm.h>
|
|
|
|
static void do_pause(const char *name, int pid)
|
|
{
|
|
kill(pid, SIGUSR2);
|
|
}
|
|
|
|
int kvm_cmd_pause(int argc, const char **argv, const char *prefix)
|
|
{
|
|
int pid;
|
|
|
|
if (argc != 1)
|
|
die("Usage: kvm debug [instance name]\n");
|
|
|
|
if (strcmp(argv[0], "all") == 0) {
|
|
kvm__enumerate_instances(do_pause);
|
|
return 0;
|
|
}
|
|
|
|
pid = kvm__get_pid_by_instance(argv[0]);
|
|
if (pid < 0)
|
|
die("Failed locating instance name");
|
|
|
|
return kill(pid, SIGUSR2);
|
|
}
|