[PATCH] FreeBSD: set cpu_freq to zero if cannot read value

Tiago Espinha Gasiba posted 1 patch 1 week, 1 day ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20260727195505.75229-1-tiago.gasiba@gmail.com
src/util/virhostcpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] FreeBSD: set cpu_freq to zero if cannot read value
Posted by Tiago Espinha Gasiba 1 week, 1 day ago
From: Tiago Gasiba <tiago.gasiba@gmail.com>

From: Tiago Gasiba <tiga@FreeBSD.org>

Signed-off-by: Tiago Espinha Gasiba <tiago.gasiba@gmail.com>
---
 src/util/virhostcpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index f2b25e940b..b602592fb7 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -993,8 +993,8 @@ virHostCPUGetInfo(virArch hostarch G_GNUC_UNUSED,
 
     if (sysctlbyname("dev.cpu.0.freq", &cpu_freq, &cpu_freq_len, NULL, 0) < 0) {
         if (sysctlbyname("hw.clockrate", &cpu_freq, &cpu_freq_len, NULL, 0) < 0) {
-            virReportSystemError(errno, "%s", _("cannot obtain CPU freq"));
-            return -1;
+            VIR_WARN("cannot obtain CPU freq, setting to 0");
+            cpu_freq = 0;
         }
     }
 
-- 
2.50.1 (Apple Git-155)