X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcompat%2Fmman.h;h=4ed889ace50d8f0b604598ee0161841656db859a;hb=c8ebf034d0bcdfe9a716d1697b02b307e4ee4514;hp=9f494526617469f5292a7341ee803a5ab26c9cda;hpb=57952005b6a6a0aeb1e4ecb0d7ac0c6786d23dba;p=babeltrace.git diff --git a/src/compat/mman.h b/src/compat/mman.h index 9f494526..4ed889ac 100644 --- a/src/compat/mman.h +++ b/src/compat/mman.h @@ -46,17 +46,24 @@ * 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 +#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