port: mmap offset alignment on Windows
[babeltrace.git] / src / compat / mman.h
index 9f494526617469f5292a7341ee803a5ab26c9cda..4ed889ace50d8f0b604598ee0161841656db859a 100644 (file)
  * mappings to exceed the file's size (even within a page).
  */
 void *bt_mmap(void *addr, size_t length, int prot, int flags, int fd,
-       off_t offset);
+       off_t offset, int log_level);
 
 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,
-       off_t offset)
+       off_t offset, int log_level)
 {
        return (void *) mmap(addr, length, prot, flags, fd, offset);
 }
@@ -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.023811 seconds and 4 git commands to generate.