diff options
author | Jan Huwald <jh@sotun.de> | 2012-05-07 20:01:51 (GMT) |
---|---|---|
committer | Jan Huwald <jh@sotun.de> | 2012-05-07 20:01:51 (GMT) |
commit | 420d2ef464d4a741028e132e662d5626806a41f5 (patch) | |
tree | 1aca6eb512e4ed0fb5f3c10c528cb998b6ffd695 /core/test_mmap2.cpp |
Diffstat (limited to 'core/test_mmap2.cpp')
-rw-r--r-- | core/test_mmap2.cpp | 26 |
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); +} |