Changeset View
Changeset View
Standalone View
Standalone View
Modules/about-distro/src/Module.cpp
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||
51 | 51 | | |||
52 | static qlonglong calculateTotalRam() | 52 | static qlonglong calculateTotalRam() | ||
53 | { | 53 | { | ||
54 | qlonglong ret = -1; | 54 | qlonglong ret = -1; | ||
55 | #ifdef Q_OS_LINUX | 55 | #ifdef Q_OS_LINUX | ||
56 | struct sysinfo info; | 56 | struct sysinfo info; | ||
57 | if (sysinfo(&info) == 0) | 57 | if (sysinfo(&info) == 0) | ||
58 | // manpage "sizes are given as multiples of mem_unit bytes" | 58 | // manpage "sizes are given as multiples of mem_unit bytes" | ||
59 | ret = info.totalram * info.mem_unit; | 59 | ret = qlonglong(info.totalram) * info.mem_unit; | ||
60 | #elif defined(Q_OS_FREEBSD) | 60 | #elif defined(Q_OS_FREEBSD) | ||
61 | /* Stuff for sysctl */ | 61 | /* Stuff for sysctl */ | ||
62 | size_t len; | 62 | size_t len; | ||
63 | 63 | | |||
64 | unsigned long memory; | 64 | unsigned long memory; | ||
65 | len = sizeof(memory); | 65 | len = sizeof(memory); | ||
66 | sysctlbyname("hw.physmem", &memory, &len, NULL, 0); | 66 | sysctlbyname("hw.physmem", &memory, &len, NULL, 0); | ||
67 | 67 | | |||
▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines |