#include "base/system/sys_info.h"
#include <errno.h>
#include <sched.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <sys/param.h>
#include <sys/resource.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <algorithm>
#include "base/check.h"
#include "base/files/file_util.h"
#include "base/lazy_instance.h"
#include "base/notimplemented.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info_internal.h"
#include "base/threading/scoped_blocking_call.h"
#include "build/build_config.h"
#if BUILDFLAG(IS_ANDROID)
#include <sys/vfs.h>
#define statvfs …
#else
#include <sys/statvfs.h>
#endif
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#include <linux/magic.h>
#include <sys/vfs.h>
#endif
#if BUILDFLAG(IS_MAC)
#include <optional>
#endif
namespace {
uint64_t AmountOfVirtualMemory() { … }
base::LazyInstance<
base::internal::LazySysInfoValue<uint64_t, AmountOfVirtualMemory>>::Leaky
g_lazy_virtual_memory = …;
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
bool IsStatsZeroIfUnlimited(const base::FilePath& path) { … }
#endif
bool GetDiskSpaceInfo(const base::FilePath& path,
int64_t* available_bytes,
int64_t* total_bytes) { … }
}
namespace base {
#if !BUILDFLAG(IS_OPENBSD)
int SysInfo::NumberOfProcessors() { … }
#endif
uint64_t SysInfo::AmountOfVirtualMemory() { … }
int64_t SysInfo::AmountOfFreeDiskSpace(const FilePath& path) { … }
int64_t SysInfo::AmountOfTotalDiskSpace(const FilePath& path) { … }
#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID)
std::string SysInfo::OperatingSystemName() { … }
#endif
#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS)
std::string SysInfo::OperatingSystemVersion() { … }
#endif
#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS)
void SysInfo::OperatingSystemVersionNumbers(int32_t* major_version,
int32_t* minor_version,
int32_t* bugfix_version) { … }
#endif
#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_IOS)
std::string SysInfo::OperatingSystemArchitecture() { … }
#endif
size_t SysInfo::VMAllocationGranularity() { … }
#if !BUILDFLAG(IS_APPLE)
int SysInfo::NumberOfEfficientProcessorsImpl() { … }
#endif
}