ubuntu-buildroot/output/build/glibc-2.36-81-g4f4d7a13edfd.../sysdeps/generic/mmap_info.h

17 lines
705 B
C
Raw Permalink Normal View History

2024-04-01 15:19:46 +00:00
/* 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;
}