summaryrefslogtreecommitdiffstats
path: root/libraries/systeminfo/src/sys_unix.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2018-07-15 14:51:05 +0200
committerPetr Mrázek <peterix@gmail.com>2018-07-15 14:51:05 +0200
commitbbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9 (patch)
treee6497e304b7b9368367565fbc7c06efab1124b1c /libraries/systeminfo/src/sys_unix.cpp
parent03280cc62e75f8073f8d3d9e9e3952acf21fa77d (diff)
downloadMultiMC-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.tar
MultiMC-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.tar.gz
MultiMC-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.tar.lz
MultiMC-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.tar.xz
MultiMC-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.zip
NOISSUE tabs -> spaces
Diffstat (limited to 'libraries/systeminfo/src/sys_unix.cpp')
-rw-r--r--libraries/systeminfo/src/sys_unix.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/libraries/systeminfo/src/sys_unix.cpp b/libraries/systeminfo/src/sys_unix.cpp
index 313908f3..ab3f302e 100644
--- a/libraries/systeminfo/src/sys_unix.cpp
+++ b/libraries/systeminfo/src/sys_unix.cpp
@@ -7,69 +7,69 @@
Sys::KernelInfo Sys::getKernelInfo()
{
- Sys::KernelInfo out;
- struct utsname buf;
- uname(&buf);
- out.kernelName = buf.sysname;
- out.kernelVersion = buf.release;
- return out;
+ Sys::KernelInfo out;
+ struct utsname buf;
+ uname(&buf);
+ out.kernelName = buf.sysname;
+ out.kernelVersion = buf.release;
+ return out;
}
uint64_t Sys::getSystemRam()
{
- std::string token;
- std::ifstream file("/proc/meminfo");
- while(file >> token)
- {
- if(token == "MemTotal:")
- {
- uint64_t mem;
- if(file >> mem)
- {
- return mem * 1024ull;
- }
- else
- {
- return 0;
- }
- }
- // ignore rest of the line
- file.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
- }
- return 0; // nothing found
+ std::string token;
+ std::ifstream file("/proc/meminfo");
+ while(file >> token)
+ {
+ if(token == "MemTotal:")
+ {
+ uint64_t mem;
+ if(file >> mem)
+ {
+ return mem * 1024ull;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ // ignore rest of the line
+ file.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+ }
+ return 0; // nothing found
}
bool Sys::isCPU64bit()
{
- return isSystem64bit();
+ return isSystem64bit();
}
bool Sys::isSystem64bit()
{
- // kernel build arch on linux
- return QSysInfo::currentCpuArchitecture() == "x86_64";
+ // kernel build arch on linux
+ return QSysInfo::currentCpuArchitecture() == "x86_64";
}
Sys::DistributionInfo Sys::getDistributionInfo()
{
- DistributionInfo systemd_info = read_os_release();
- DistributionInfo lsb_info = read_lsb_release();
- DistributionInfo legacy_info = read_legacy_release();
- DistributionInfo result = systemd_info + lsb_info + legacy_info;
- if(result.distributionName.isNull())
- {
- result.distributionName = "unknown";
- }
- if(result.distributionVersion.isNull())
- {
- if(result.distributionName == "arch")
- {
- result.distributionVersion = "rolling";
- }
- else
- {
- result.distributionVersion = "unknown";
- }
- }
- return result;
+ DistributionInfo systemd_info = read_os_release();
+ DistributionInfo lsb_info = read_lsb_release();
+ DistributionInfo legacy_info = read_legacy_release();
+ DistributionInfo result = systemd_info + lsb_info + legacy_info;
+ if(result.distributionName.isNull())
+ {
+ result.distributionName = "unknown";
+ }
+ if(result.distributionVersion.isNull())
+ {
+ if(result.distributionName == "arch")
+ {
+ result.distributionVersion = "rolling";
+ }
+ else
+ {
+ result.distributionVersion = "unknown";
+ }
+ }
+ return result;
}