2 * SPDX-License-Identifier: MIT
4 * Copyright (C) 2015-2016 Michael Jeanson <mjeanson@efficios.com>
7 #ifndef _BABELTRACE_COMPAT_MMAN_H
8 #define _BABELTRACE_COMPAT_MMAN_H
12 #include <sys/types.h>
16 #define PROT_WRITE 0x2
23 #define MAP_FIXED 0x10
24 #define MAP_ANONYMOUS 0x20
25 #define MAP_ANON MAP_ANONYMOUS
26 #define MAP_FAILED ((void *) -1)
29 * Note that some platforms (e.g. Windows) do not allow read-only
30 * mappings to exceed the file's size (even within a page).
32 void *bt_mmap(void *addr
, size_t length
, int prot
, int flags
, int fd
,
33 off_t offset
, int log_level
);
35 int bt_munmap(void *addr
, size_t length
);
38 * On Windows the memory mapping offset must be aligned to the memory
39 * allocator allocation granularity and not the page size.
41 size_t bt_mmap_get_offset_align_size(int log_level
);
43 #else /* __MINGW32__ */
46 #include "common/common.h"
49 void *bt_mmap(void *addr
, size_t length
, int prot
, int flags
, int fd
,
50 off_t offset
, int log_level
)
52 return (void *) mmap(addr
, length
, prot
, flags
, fd
, offset
);
56 int bt_munmap(void *addr
, size_t length
)
58 return munmap(addr
, length
);
62 * On other platforms the memory mapping offset must be aligned to the
66 size_t bt_mmap_get_offset_align_size(int log_level
)
68 return bt_common_get_page_size(log_level
);
70 #endif /* __MINGW32__ */
74 # define MAP_ANONYMOUS MAP_ANON
78 #endif /* _BABELTRACE_COMPAT_MMAN_H */
This page took 0.031024 seconds and 4 git commands to generate.