1 | /* As default architectures with sizeof (off_t) < sizeof (off64_t) the mmap is |
2 | implemented with __SYS_mmap2 syscall and the offset is represented in |
3 | multiples of page size. For offset larger than |
4 | '1 << (page_shift + 8 * sizeof (off_t))' (that is, 1<<44 on system with |
5 | page size of 4096 bytes) the system call silently truncates the offset. |
6 | For this case, glibc mmap implementation returns EINVAL. */ |
7 | |
8 | /* Return the maximum value expected as offset argument in mmap64 call. */ |
9 | static inline uint64_t |
10 | mmap64_maximum_offset (long int page_shift) |
11 | { |
12 | if (sizeof (off_t) < sizeof (off64_t)) |
13 | return (UINT64_C(1) << (page_shift + (8 * sizeof (off_t)))) - 1; |
14 | else |
15 | return UINT64_MAX; |
16 | } |
17 | |