Skip to content

Commit

Permalink
add pause C example
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorian Eikenberg committed Jan 8, 2020
1 parent 5dcd7d8 commit ef83fc4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions c_examples/pause.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <stdio.h>
#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;
}
2 changes: 1 addition & 1 deletion c_examples/regs-dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ int main(int argc, char* argv[]) {
read_registers(driver, argv[1]);
microvmi_destroy(driver);
return 0;
}
}

0 comments on commit ef83fc4

Please sign in to comment.