summaryrefslogtreecommitdiff
path: root/core/test_mmap2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/test_mmap2.cpp')
-rw-r--r--core/test_mmap2.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/core/test_mmap2.cpp b/core/test_mmap2.cpp
new file mode 100644
index 0000000..29312a7
--- /dev/null
+++ b/core/test_mmap2.cpp
@@ -0,0 +1,26 @@
+#include <malloc.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <iostream>
+
+#include "mempool.hpp"
+
+int main() {
+ MemPool ram(4096);
+ MemPool file(4096, "myfunnymmapfile");
+ MemPool file2(4096, "myfunnymmapfile2");
+
+ ram.sync();
+ file.sync();
+
+ char *s = (char*) "Ei der Daus!";
+ memcpy(ram(), s, strlen(s));
+ memcpy(file(), ram(), 4096);
+}
contact: Jan Huwald // Impressum