chiark / gitweb /
initial code
[map-unshare.git] / simple-test.c
diff --git a/simple-test.c b/simple-test.c
new file mode 100644 (file)
index 0000000..8e67bbd
--- /dev/null
@@ -0,0 +1,20 @@
+#include "map-unshare.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+static void dumpmaps(void) {
+  FILE *maps = fopen("/proc/self/maps","r");
+  int c;
+  while ((c=getc(maps)) != EOF) putchar(c);
+  assert(!ferror(maps) && !fclose(maps));
+  assert(!fflush(stdout) && !ferror(stdout));
+}
+
+int main(void) {
+  dumpmaps();
+  map_unshare();
+  dumpmaps();
+  exit(0);
+}