Back to index

glibc  2.9
Functions
mmap64.c File Reference
#include <errno.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sysdep.h>
#include <sys/syscall.h>
#include <bp-checks.h>
#include <kernel-features.h>

Go to the source code of this file.

Functions

void * __mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset)

Function Documentation

void* __mmap64 ( void *  addr,
size_t  len,
int  prot,
int  flags,
int  fd,
off64_t  offset 
)

Definition at line 44 of file mmap64.c.

{
#ifdef __NR_mmap2
  if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
    {
      __set_errno (EINVAL);
      return MAP_FAILED;
    }
# ifndef __ASSUME_MMAP2_SYSCALL
  if (! have_no_mmap2)
# endif
    {
# ifndef __ASSUME_MMAP2_SYSCALL
      int saved_errno = errno;
# endif
      void *result;
      __ptrvalue (result) = (void *__unbounded)
       INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr),
                     len, prot, flags, fd,
                     (off_t) (offset >> MMAP2_PAGE_SHIFT));
# if __BOUNDED_POINTERS__
      __ptrlow (result) = __ptrvalue (result);
      __ptrhigh (result) = __ptrvalue (result) + len;
# endif
# ifndef __ASSUME_MMAP2_SYSCALL
      if (result != MAP_FAILED || errno != ENOSYS)
# endif
       return result;

# ifndef __ASSUME_MMAP2_SYSCALL
      __set_errno (saved_errno);
      have_no_mmap2 = 1;
# endif
    }
#endif
#ifndef __ASSUME_MMAP2_SYSCALL
  if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len))
    {
      __set_errno (EINVAL);
      return MAP_FAILED;
    }

  return __mmap (addr, len, prot, flags, fd, (off_t) offset);
#endif
}

Here is the call graph for this function: