diff options
Diffstat (limited to 'kpersonalizer')
-rw-r--r-- | kpersonalizer/CMakeLists.txt | 2 | ||||
-rw-r--r-- | kpersonalizer/ksysinfo.cpp | 30 |
2 files changed, 30 insertions, 2 deletions
diff --git a/kpersonalizer/CMakeLists.txt b/kpersonalizer/CMakeLists.txt index 19c3a6698..6fe020c82 100644 --- a/kpersonalizer/CMakeLists.txt +++ b/kpersonalizer/CMakeLists.txt @@ -40,6 +40,6 @@ tde_add_executable( kpersonalizer AUTOMOC kpersonalizer.cpp main.cpp kfindlanguage.cpp kcountrypagedlg.ui kospagedlg.ui keyecandypagedlg.ui tdestylepagedlg.ui krefinepagedlg.ui ksysinfo.cpp - LINK tdeio-shared + LINK tdeio-shared ${KSTAT_LIBRARIES} DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/kpersonalizer/ksysinfo.cpp b/kpersonalizer/ksysinfo.cpp index 20a089b8f..551dad3f8 100644 --- a/kpersonalizer/ksysinfo.cpp +++ b/kpersonalizer/ksysinfo.cpp @@ -235,8 +235,36 @@ TQFont KSysInfo::getFixedWidthFont(){ /////////////////// /////////////////// -//#elif defined(__svr4__) && defined(sun) +#elif defined(Q_OS_SOLARIS) /////////////////// +#include <kstat.h> + + void KSysInfo::initHWInfo() { + kstat_ctl_t *kctl; + kstat_t *ksp; + kstat_named_t *kdata; + + m_cpu_speed = 0; + /* cpu_info:0:cpu_info0:current_clock_Hz */ + + kctl = kstat_open(); + if (kctl == NULL) + return; + if (kstat_chain_update(kctl) != 0) + goto out; + ksp = kstat_lookup(kctl, "cpu_info", 0, "cpu_info0"); + if (ksp == NULL) + goto out; + if (kstat_read(kctl, ksp, NULL) == -1 ) + goto out; + + kdata = (kstat_named_t *)kstat_data_lookup(ksp, + "clock_Hz"); + if (kdata != NULL) + m_cpu_speed = kdata->value.ui64; + out: + kstat_close(kctl); + } /////////////////// //#elif __svr4__ |