From 6251cc7b6ca81fda05a516175d3864b4cb394732 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Thu, 11 May 2023 10:39:51 +0200 Subject: [PATCH] Do not hand define struct clockinfo here. Instead use the version from (#2663) x/sys/unix. The clockinfo struct was altered beginning of 2021 and this code was not adjusted. Signed-off-by: Claudio Jeker --- collector/cpu_openbsd.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/collector/cpu_openbsd.go b/collector/cpu_openbsd.go index 13ee99ac..8715ff98 100644 --- a/collector/cpu_openbsd.go +++ b/collector/cpu_openbsd.go @@ -25,14 +25,6 @@ import ( "golang.org/x/sys/unix" ) -type clockinfo struct { - hz int32 - tick int32 - tickadj int32 - stathz int32 - profhz int32 -} - const ( CP_USER = iota CP_NICE @@ -72,8 +64,8 @@ func (c *cpuCollector) Update(ch chan<- prometheus.Metric) (err error) { if err != nil { return err } - clock := *(*clockinfo)(unsafe.Pointer(&clockb[0])) - hz := float64(clock.stathz) + clock := *(*unix.Clockinfo)(unsafe.Pointer(&clockb[0])) + hz := float64(clock.Stathz) ncpus, err := unix.SysctlUint32("hw.ncpu") if err != nil {