Changeset View
Changeset View
Standalone View
Standalone View
Modules/about-distro/src/Module.cpp
Show All 35 Lines | |||||
36 | #include <KLocalizedString> | 36 | #include <KLocalizedString> | ||
37 | #include <KSharedConfig> | 37 | #include <KSharedConfig> | ||
38 | 38 | | |||
39 | #include <solid/device.h> | 39 | #include <solid/device.h> | ||
40 | #include <solid/processor.h> | 40 | #include <solid/processor.h> | ||
41 | 41 | | |||
42 | #ifdef Q_OS_LINUX | 42 | #ifdef Q_OS_LINUX | ||
43 | #include <sys/sysinfo.h> | 43 | #include <sys/sysinfo.h> | ||
44 | #elif defined(Q_OS_FREEBSD) | ||||
45 | #include <sys/types.h> | ||||
46 | #include <sys/sysctl.h> | ||||
44 | #endif | 47 | #endif | ||
45 | #include <sys/utsname.h> | 48 | #include <sys/utsname.h> | ||
46 | 49 | | |||
47 | #include "OSRelease.h" | 50 | #include "OSRelease.h" | ||
48 | #include "Version.h" | 51 | #include "Version.h" | ||
49 | 52 | | |||
50 | static qlonglong calculateTotalRam() | 53 | static qlonglong calculateTotalRam() | ||
51 | { | 54 | { | ||
52 | qlonglong ret = -1; | 55 | qlonglong ret = -1; | ||
53 | #ifdef Q_OS_LINUX | 56 | #ifdef Q_OS_LINUX | ||
54 | struct sysinfo info; | 57 | struct sysinfo info; | ||
55 | if (sysinfo(&info) == 0) | 58 | if (sysinfo(&info) == 0) | ||
56 | // manpage "sizes are given as multiples of mem_unit bytes" | 59 | // manpage "sizes are given as multiples of mem_unit bytes" | ||
57 | ret = info.totalram * info.mem_unit; | 60 | ret = info.totalram * info.mem_unit; | ||
61 | #elif defined(Q_OS_FREEBSD) | ||||
62 | /* Stuff for sysctl */ | ||||
63 | size_t len; | ||||
64 | | ||||
65 | unsigned long memory; | ||||
66 | len = sizeof(memory); | ||||
67 | sysctlbyname("hw.physmem", &memory, &len, NULL, 0); | ||||
68 | | ||||
69 | ret = memory; | ||||
58 | #endif | 70 | #endif | ||
59 | return ret; | 71 | return ret; | ||
60 | } | 72 | } | ||
61 | 73 | | |||
62 | Module::Module(QWidget *parent, const QVariantList &args) : | 74 | Module::Module(QWidget *parent, const QVariantList &args) : | ||
63 | KCModule(parent, args), | 75 | KCModule(parent, args), | ||
64 | ui(new Ui::Module) | 76 | ui(new Ui::Module) | ||
65 | { | 77 | { | ||
▲ Show 20 Lines • Show All 152 Lines • Show Last 20 Lines |