#include "perfetto/ext/base/scoped_mmap.h"
#include <utility>
#include "perfetto/ext/base/file_utils.h"
#include "perfetto/ext/base/scoped_file.h"
#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)
#include <sys/mman.h>
#include <unistd.h>
#elif PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
#include <Windows.h>
#endif
namespace perfetto::base {
namespace {
ScopedPlatformHandle OpenFileForMmap(const char* fname) { … }
}
ScopedMmap::ScopedMmap(ScopedMmap&& other) noexcept { … }
ScopedMmap& ScopedMmap::operator=(ScopedMmap&& other) noexcept { … }
ScopedMmap::~ScopedMmap() { … }
ScopedMmap ScopedMmap::FromHandle(base::ScopedPlatformHandle file,
size_t length) { … }
bool ScopedMmap::reset() noexcept { … }
#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)
ScopedMmap ScopedMmap::InheritMmappedRange(void* data, size_t size) { … }
#endif
ScopedMmap ReadMmapFilePart(const char* fname, size_t length) { … }
ScopedMmap ReadMmapWholeFile(const char* fname) { … }
}