#include "util/posix/scoped_mmap.h"
#include <unistd.h>
#include <algorithm>
#include "base/check_op.h"
#include "base/logging.h"
#include "base/memory/page_size.h"
#include "base/numerics/safe_conversions.h"
#include "base/numerics/safe_math.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#include "third_party/lss/lss.h"
#endif
namespace {
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
void* CallMmap(void* addr,
size_t len,
int prot,
int flags,
int fd,
off_t offset) { … }
int CallMunmap(void* addr, size_t len) { … }
int CallMprotect(void* addr, size_t len, int prot) { … }
#else
void* CallMmap(void* addr,
size_t len,
int prot,
int flags,
int fd,
off_t offset) {
return mmap(addr, len, prot, flags, fd, offset);
}
int CallMunmap(void* addr, size_t len) {
return munmap(addr, len);
}
int CallMprotect(void* addr, size_t len, int prot) {
return mprotect(addr, len, prot);
}
#endif
bool LoggingMunmap(uintptr_t addr, size_t len, bool can_log) { … }
size_t RoundPage(size_t size) { … }
}
namespace crashpad {
ScopedMmap::ScopedMmap(bool can_log) : … { … }
ScopedMmap::~ScopedMmap() { … }
bool ScopedMmap::Reset() { … }
bool ScopedMmap::ResetAddrLen(void* addr, size_t len) { … }
bool ScopedMmap::ResetMmap(void* addr,
size_t len,
int prot,
int flags,
int fd,
off_t offset) { … }
bool ScopedMmap::Mprotect(int prot) { … }
void* ScopedMmap::release() { … }
}