File: mmap_info.h

package info (click to toggle)
glibc 2.29-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 271,436 kB
  • sloc: ansic: 1,013,441; asm: 261,303; makefile: 11,428; sh: 10,300; python: 8,944; cpp: 5,062; awk: 1,956; perl: 514; yacc: 290; pascal: 182; sed: 73
file content (16 lines) | stat: -rw-r--r-- 705 bytes parent folder | download | duplicates (7)
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;
}