summaryrefslogtreecommitdiffstats
path: root/src/platform/platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/platform.h')
-rw-r--r--src/platform/platform.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/platform/platform.h b/src/platform/platform.h
new file mode 100644
index 0000000..aaa6138
--- /dev/null
+++ b/src/platform/platform.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <stddef.h>
+#include <sys/types.h>
+
+#ifdef CC4GROUP_PLATFORM_WINDOWS
+ #define PROT_READ 0x1
+ #define PROT_WRITE 0x2
+ /* This flag is only available in WinXP+ */
+ #ifdef FILE_MAP_EXECUTE
+ #define PROT_EXEC 0x4
+ #else
+ #define PROT_EXEC 0x0
+ #define FILE_MAP_EXECUTE 0
+ #endif
+
+ #define MAP_SHARED 0x01
+ #define MAP_PRIVATE 0x02
+ #define MAP_ANONYMOUS 0x20
+ #define MAP_ANON MAP_ANONYMOUS
+ #define MAP_FAILED ((void *) -1)
+
+ #define cc4group_mkdir(path, mode) mkdir((path))
+#else
+ #include <sys/mman.h>
+
+ #define cc4group_mkdir(path, mode) mkdir((path), (mode))
+ #define O_BINARY 0
+#endif
+
+void *cc4group_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset, void** extra);
+int cc4group_munmap(void *addr, size_t length, void* extra); \ No newline at end of file