chromium/third_party/crashpad/crashpad/util/posix/scoped_mmap.cc

// Copyright 2017 The Crashpad Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#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"

// TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is
// complete.
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#include "third_party/lss/lss.h"
#endif

namespace {

// TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is
// complete.
#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

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() {}

}  // namespace crashpad