| 6 |
| 7 | #include <zircon/syscalls.h> |
| 8 |
| 9 | #include "base/fuchsia/fuchsia_logging.h" |
| 10 | #include "base/logging.h" |
| 11 | #include "base/threading/scoped_blocking_call.h" |
| 12 | #include "build/build_config.h" |
| 13 |
| 14 | namespace base { |
| 15 |
| 16 | // static |
| 17 | int64_t SysInfo::AmountOfPhysicalMemoryImpl() { |
| 18 | return zx_system_get_physmem(); |
| 19 | } |
| 20 |
| 21 | // static |
| 22 | int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { |
| 23 | // TODO(https://crbug.com/986608): Implement this. |
| 24 | NOTIMPLEMENTED_LOG_ONCE(); |
| 25 | return 0; |
| 26 | } |
| 27 |
| 28 | // static |
| 29 | int SysInfo::NumberOfProcessors() { |
| 30 | return zx_system_get_num_cpus(); |
| 31 | } |
| 32 |
| 33 | // static |
| 34 | int64_t SysInfo::AmountOfVirtualMemory() { |
| 35 | return 0; |
| 36 | } |
| 37 |
| 38 | // static |
| 39 | std::string SysInfo::OperatingSystemName() { |
| 40 | return "Fuchsia"; |
| 41 | } |
| 42 |
| 43 | // static |
| 44 | int64_t SysInfo::AmountOfFreeDiskSpace(const FilePath& path) { |
| 45 | base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, |
| 46 | base::BlockingType::MAY_BLOCK); |
| 47 | NOTIMPLEMENTED_LOG_ONCE(); |
| 48 | return -1; |
| 49 | } |
| 50 |
| 51 | // static |
| 52 | int64_t SysInfo::AmountOfTotalDiskSpace(const FilePath& path) { |
| 53 | base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, |
| 54 | base::BlockingType::MAY_BLOCK); |
| 55 | NOTIMPLEMENTED_LOG_ONCE(); |
| 56 | return -1; |
| 57 | } |
| 58 |
| 59 | // static |
| 60 | std::string SysInfo::OperatingSystemVersion() { |
| 61 | return zx_system_get_version_string(); |
| 62 | } |
| 63 |
| 64 | // static |
| 65 | void SysInfo::OperatingSystemVersionNumbers(int32_t* major_version, |
| 66 | int32_t* minor_version, |
| 67 | int32_t* bugfix_version) { |
| 68 | // Fuchsia doesn't have OS version numbers. |
| 69 | *major_version = 0; |
| 70 | *minor_version = 0; |
| 71 | *bugfix_version = 0; |
| 72 | } |
| 73 |
| 74 | // static |
| 75 | std::string SysInfo::OperatingSystemArchitecture() { |
| 76 | #if defined(ARCH_CPU_X86_64) |
| 77 | return "x86_64"; |
| 78 | #elif defined(ARCH_CPU_ARM64) |
| 79 | return "aarch64"; |
| 80 | #else |
| 81 | #error Unsupported architecture. |
| 82 | #endif |
| 83 | } |
| 84 |
| 85 | // static |
| 86 | size_t SysInfo::VMAllocationGranularity() { |
| 87 | return getpagesize(); |
| 88 | } |
| 89 |
| 90 | } // namespace base |
| 91 |