pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/sysutils/node_exporter



Module Name:    pkgsrc
Committed By:   tnn
Date:           Sun Aug  4 12:27:41 UTC 2024

Modified Files:
        pkgsrc/sysutils/node_exporter: Makefile distinfo
Added Files:
        pkgsrc/sysutils/node_exporter/patches: patch-collector_cpu__netbsd.go

Log Message:
node_exporter: cpu_netbsd: fix 32-bit host support and plug memory leak


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 pkgsrc/sysutils/node_exporter/Makefile
cvs rdiff -u -r1.13 -r1.14 pkgsrc/sysutils/node_exporter/distinfo
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/sysutils/node_exporter/patches/patch-collector_cpu__netbsd.go

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/sysutils/node_exporter/Makefile
diff -u pkgsrc/sysutils/node_exporter/Makefile:1.69 pkgsrc/sysutils/node_exporter/Makefile:1.70
--- pkgsrc/sysutils/node_exporter/Makefile:1.69 Sun Aug  4 00:08:21 2024
+++ pkgsrc/sysutils/node_exporter/Makefile      Sun Aug  4 12:27:41 2024
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.69 2024/08/04 00:08:21 tnn Exp $
+# $NetBSD: Makefile,v 1.70 2024/08/04 12:27:41 tnn Exp $
 
 DISTNAME=      node_exporter-1.8.2
-PKGREVISION=   2
+PKGREVISION=   3
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=prometheus/}
 CATEGORIES=    sysutils
 GITHUB_TAG=    v${PKGVERSION_NOREV}

Index: pkgsrc/sysutils/node_exporter/distinfo
diff -u pkgsrc/sysutils/node_exporter/distinfo:1.13 pkgsrc/sysutils/node_exporter/distinfo:1.14
--- pkgsrc/sysutils/node_exporter/distinfo:1.13 Sun Aug  4 00:08:21 2024
+++ pkgsrc/sysutils/node_exporter/distinfo      Sun Aug  4 12:27:41 2024
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.13 2024/08/04 00:08:21 tnn Exp $
+$NetBSD: distinfo,v 1.14 2024/08/04 12:27:41 tnn Exp $
 
 BLAKE2s (github.com_alecthomas_kingpin_v2_@v_v2.4.0.mod) = 20c554bf73adc1d4faea9cf1eba7f569d362037f364d643d7176e790eed60759
 SHA512 (github.com_alecthomas_kingpin_v2_@v_v2.4.0.mod) = 27b647208aec705c995e523035f278c6b81102ba59f5a95e6e7adf1e8cba2e166d73f0d1115946acfcb736918b5b0db66d2f2aeba084a3581a7a29d342f511b2
@@ -387,6 +387,7 @@ Size (howett.net_plist_@v_v1.0.1.zip) = 
 BLAKE2s (node_exporter-1.8.2.tar.gz) = 2370bedb44e5469e3f9971b1c7e493adf4995107d748a8853e7549750e53548f
 SHA512 (node_exporter-1.8.2.tar.gz) = 68112a85a9ffde88d75893c30ab992ae3c591d44fbefa10e45cf94d228c8f8c44bb3585707521e355817c4b4276cf77eeaf4ed9d0261de02620135ad12f5e711
 Size (node_exporter-1.8.2.tar.gz) = 335292 bytes
+SHA1 (patch-collector_cpu__netbsd.go) = e40c02ae793a2174e20d383599ad6777e36d62b4
 SHA1 (patch-collector_filesystem__common.go) = 5340a9b36478efa1563c7359469840a7bb652343
 SHA1 (patch-collector_filesystem__netbsd.go) = 446190ceca0c37bada8ed444ce497c2e9b8e05ae
 SHA1 (patch-collector_netdev__common.go) = 83b6615334490e8ccfd8c311b36ee2ec98c0ad15

Added files:

Index: pkgsrc/sysutils/node_exporter/patches/patch-collector_cpu__netbsd.go
diff -u /dev/null pkgsrc/sysutils/node_exporter/patches/patch-collector_cpu__netbsd.go:1.1
--- /dev/null   Sun Aug  4 12:27:41 2024
+++ pkgsrc/sysutils/node_exporter/patches/patch-collector_cpu__netbsd.go        Sun Aug  4 12:27:41 2024
@@ -0,0 +1,86 @@
+$NetBSD: patch-collector_cpu__netbsd.go,v 1.1 2024/08/04 12:27:41 tnn Exp $
+
+collector/cpu_netbsd: fix 32-bit host support and plug memory leak
+https://github.com/prometheus/node_exporter/pull/3083
+
+--- collector/cpu_netbsd.go.orig       2024-07-14 11:52:11.000000000 +0000
++++ collector/cpu_netbsd.go
+@@ -33,6 +33,15 @@ import (
+       "howett.net/plist"
+ )
+ 
++const (
++      _IOC_OUT        = uint(0x40000000)
++      _IOC_IN         = uint(0x80000000)
++      _IOC_INOUT      = (_IOC_IN | _IOC_OUT)
++      _IOCPARM_MASK   = uint(0x1fff)
++      _IOCPARM_SHIFT  = uint(16)
++      _IOCGROUP_SHIFT = uint(8)
++)
++
+ type clockinfo struct {
+       hz     int32 // clock frequency
+       tick   int32 // micro-seconds per hz tick
+@@ -51,7 +60,7 @@ type cputime struct {
+ 
+ type plistref struct {
+       pref_plist unsafe.Pointer
+-      pref_len   uint64
++      pref_len   uint
+ }
+ 
+ type sysmonValues struct {
+@@ -65,25 +74,19 @@ type sysmonProperty []sysmonValues
+ 
+ type sysmonProperties map[string]sysmonProperty
+ 
+-func readBytes(ptr unsafe.Pointer, length uint64) []byte {
+-      buf := make([]byte, length-1)
+-      var i uint64
+-      for ; i < length-1; i++ {
+-              buf[i] = *(*byte)(unsafe.Pointer(uintptr(ptr) + uintptr(i)))
+-      }
+-      return buf
++func _IOC(inout uint, group byte, num uint, len uintptr) uint {
++      return ((inout) | ((uint(len) & _IOCPARM_MASK) << _IOCPARM_SHIFT) | (uint(group) << _IOCGROUP_SHIFT) | (num))
+ }
+ 
+-func ioctl(fd int, nr int64, typ byte, size uintptr, retptr unsafe.Pointer) error {
++func _IOWR(group byte, num uint, len uintptr) uint {
++      return _IOC(_IOC_INOUT, group, num, len)
++}
++
++func ioctl(fd int, nr uint, typ byte, size uintptr, retptr unsafe.Pointer) error {
+       _, _, errno := unix.Syscall(
+               unix.SYS_IOCTL,
+               uintptr(fd),
+-              // Some magicks derived from sys/ioccom.h.
+-              uintptr((0x40000000|0x80000000)|
+-                      ((int64(size)&(1<<13-1))<<16)|
+-                      (int64(typ)<<8)|
+-                      nr,
+-              ),
++              uintptr(_IOWR(typ, nr, unsafe.Sizeof(plistref{}))),
+               uintptr(retptr),
+       )
+       if errno != 0 {
+@@ -93,7 +96,7 @@ func ioctl(fd int, nr int64, typ byte, s
+ }
+ 
+ func readSysmonProperties() (sysmonProperties, error) {
+-      fd, err := unix.Open(rootfsFilePath("/dev/sysmon"), unix.O_RDONLY, 0777)
++      fd, err := unix.Open(rootfsFilePath("/dev/sysmon"), unix.O_RDONLY, 0)
+       if err != nil {
+               return nil, err
+       }
+@@ -104,8 +107,8 @@ func readSysmonProperties() (sysmonPrope
+       if err = ioctl(fd, 0, 'E', unsafe.Sizeof(retptr), unsafe.Pointer(&retptr)); err != nil {
+               return nil, err
+       }
+-
+-      bytes := readBytes(retptr.pref_plist, retptr.pref_len)
++      defer unix.Syscall(unix.SYS_MUNMAP, uintptr(retptr.pref_plist), uintptr(retptr.pref_len), uintptr(0))
++      bytes := unsafe.Slice((*byte)(unsafe.Pointer(retptr.pref_plist)), retptr.pref_len-1)
+ 
+       var props sysmonProperties
+       if _, err = plist.Unmarshal(bytes, &props); err != nil {



Home | Main Index | Thread Index | Old Index