From 4d58a4ea8daf1a3cb91b7d8c6e574dd6f5bdb685 Mon Sep 17 00:00:00 2001 From: Denis Kozadaev Date: Thu, 18 May 2023 21:41:25 +0300 Subject: SunOS specific patches Signed-off-by: Denis Kozadaev --- kpersonalizer/CMakeLists.txt | 2 +- kpersonalizer/ksysinfo.cpp | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) (limited to 'kpersonalizer') 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 + + 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__ -- cgit v1.2.1