port: mmap offset alignment on Windows
[babeltrace.git] / src / compat / mman.h
index bdab9d1903fbab5e08227f4d498cef8de69050c3..4ed889ace50d8f0b604598ee0161841656db859a 100644 (file)
@@ -50,9 +50,16 @@ void *bt_mmap(void *addr, size_t length, int prot, int flags, int fd,
 
 int bt_munmap(void *addr, size_t length);
 
+/*
+ * On Windows the memory mapping offset must be aligned to the memory
+ * allocator allocation granularity and not the page size.
+ */
+size_t bt_mmap_get_offset_align_size(int log_level);
+
 #else /* __MINGW32__ */
 
 #include <sys/mman.h>
+#include "common/common.h"
 
 static inline
 void *bt_mmap(void *addr, size_t length, int prot, int flags, int fd,
@@ -66,6 +73,16 @@ int bt_munmap(void *addr, size_t length)
 {
        return munmap(addr, length);
 }
+
+/*
+ * On other platforms the memory mapping offset must be aligned to the
+ * page size.
+ */
+static inline
+size_t bt_mmap_get_offset_align_size(int log_level)
+{
+       return bt_common_get_page_size(log_level);
+}
 #endif /* __MINGW32__ */
 
 #ifndef MAP_ANONYMOUS
This page took 0.023454 seconds and 4 git commands to generate.