]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: Fix getting CPU frequency on Apple Silicon
authorAndrea Bolognani <abologna@redhat.com>
Thu, 10 Feb 2022 08:42:01 +0000 (09:42 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 14 Feb 2022 10:31:53 +0000 (11:31 +0100)
commit85064aae646fec218c11b8da5ef81199080c87b3
tree1beb32ed9041f990ee8d7ca9233862335a411904
parent2a273072b63cb84b06e8d6f43cbabdb79cb77e4b
util: Fix getting CPU frequency on Apple Silicon

The hw.cpufrequency sysctl, which we use to obtain the CPU
frequency on macOS, is not available when running on Apple
Silicon, and as a consequence we currently report an error
whenever such information is requested.

The virNodeInfo.mhz field, where the CPU frequency gets stored,
is documented as being zero when the information could not be
obtained, and we already do that for Linux on aarch64. Extend
this behavior to macOS on Apple Silicon.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virhostcpu.c