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