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 ac11fe4
Showing 1 changed file with 27 additions and 0 deletions.
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;
}

0 comments on commit ac11fe4

Please sign in to comment.