#include "snapshot/linux/system_snapshot_linux.h"
#include <stddef.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <algorithm>
#include <string_view>
#include "base/check_op.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "snapshot/cpu_context.h"
#include "snapshot/posix/timezone.h"
#include "util/file/file_io.h"
#include "util/numeric/in_range_cast.h"
#include "util/string/split_string.h"
#if BUILDFLAG(IS_ANDROID)
#include <sys/system_properties.h>
#endif
namespace crashpad {
namespace internal {
namespace {
bool ReadCPUsOnline(uint32_t* first_cpu, uint8_t* cpu_count) { … }
bool ReadFreqFile(const std::string& filename, uint64_t* hz) { … }
#if BUILDFLAG(IS_ANDROID)
bool ReadProperty(const char* property, std::string* value) {
char value_buffer[PROP_VALUE_MAX];
int length = __system_property_get(property, value_buffer);
if (length <= 0) {
LOG(ERROR) << "Couldn't read property " << property;
return false;
}
*value = value_buffer;
return true;
}
#endif
}
SystemSnapshotLinux::SystemSnapshotLinux()
: … { … }
SystemSnapshotLinux::~SystemSnapshotLinux() { … }
void SystemSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
const timeval* snapshot_time) { … }
CPUArchitecture SystemSnapshotLinux::GetCPUArchitecture() const { … }
uint32_t SystemSnapshotLinux::CPURevision() const { … }
uint8_t SystemSnapshotLinux::CPUCount() const { … }
std::string SystemSnapshotLinux::CPUVendor() const { … }
void SystemSnapshotLinux::CPUFrequency(uint64_t* current_hz,
uint64_t* max_hz) const { … }
uint32_t SystemSnapshotLinux::CPUX86Signature() const { … }
uint64_t SystemSnapshotLinux::CPUX86Features() const { … }
uint64_t SystemSnapshotLinux::CPUX86ExtendedFeatures() const { … }
uint32_t SystemSnapshotLinux::CPUX86Leaf7Features() const { … }
bool SystemSnapshotLinux::CPUX86SupportsDAZ() const { … }
SystemSnapshot::OperatingSystem SystemSnapshotLinux::GetOperatingSystem()
const { … }
bool SystemSnapshotLinux::OSServer() const { … }
void SystemSnapshotLinux::OSVersion(int* major,
int* minor,
int* bugfix,
std::string* build) const { … }
std::string SystemSnapshotLinux::OSVersionFull() const { … }
std::string SystemSnapshotLinux::MachineDescription() const { … }
bool SystemSnapshotLinux::NXEnabled() const { … }
void SystemSnapshotLinux::TimeZone(DaylightSavingTimeStatus* dst_status,
int* standard_offset_seconds,
int* daylight_offset_seconds,
std::string* standard_name,
std::string* daylight_name) const { … }
void SystemSnapshotLinux::ReadKernelVersion(const std::string& version_string) { … }
}
}