diff --git a/c_examples/pause.c b/c_examples/pause.c new file mode 100644 index 00000000..36b4cb72 --- /dev/null +++ b/c_examples/pause.c @@ -0,0 +1,27 @@ +#include +#include "libmicrovmi.h" + +void pause(MicrovmiContext* driver) { + if (microvmi_pause(driver) == MicrovmiSuccess) { + printf("Paused.\n"); + } else { + printf("Unable to pause VM.\n"); + return; + } + if (microvmi_resume(driver) == MicrovmiSuccess) { + printf("Resumed.\n"); + } else { + printf("Unable to resume VM.\n"); + } +} + +int main(int argc, char* argv[]) { + if (argc < 2) { + printf("No domain name given.\n"); + return 1; + } + MicrovmiContext* driver = microvmi_init(argv[1], Xen); + pause(driver); + microvmi_destroy(driver); + return 0; +} diff --git a/c_examples/regs-dump.c b/c_examples/regs-dump.c index 02cc030b..3b8c5bcc 100644 --- a/c_examples/regs-dump.c +++ b/c_examples/regs-dump.c @@ -35,4 +35,4 @@ int main(int argc, char* argv[]) { read_registers(driver, argv[1]); microvmi_destroy(driver); return 0; -} \ No newline at end of file +}