fix dupblicate cgo import, use double instead of Float64 in C function return (#3391)

Signed-off-by: Ahmed Abdulraziq <ahmed.khaled.abdulraziq@gmail.com>
pull/3393/head
Ahmed Khaled 4 months ago committed by GitHub
parent 434fb7d864
commit 6471fa313e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 17
      collector/filesystem_macos.go
  2. 2
      collector/meminfo_darwin.go

@ -20,8 +20,13 @@ package collector
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Foundation
#import <Foundation/Foundation.h>
Float64 purgeable(char *path) {
Float64 value = -1.0f;
#include <sys/param.h>
#include <sys/ucred.h>
#include <sys/mount.h>
#include <stdio.h>
double purgeable(char *path) {
double value = -1.0f;
@autoreleasepool {
NSError *error = nil;
@ -49,14 +54,6 @@ import (
"unsafe"
)
/*
#include <sys/param.h>
#include <sys/ucred.h>
#include <sys/mount.h>
#include <stdio.h>
*/
import "C"
const (
defMountPointsExcluded = "^/(dev)($|/)"
defFSTypesExcluded = "^devfs$"

@ -52,7 +52,7 @@ func (c *meminfoCollector) getMemInfo() (map[string]float64, error) {
&infoCount,
)
if ret != C.KERN_SUCCESS {
return nil, fmt.Errorf("Couldn't get memory statistics, host_statistics returned %d", ret)
return nil, fmt.Errorf("couldn't get memory statistics, host_statistics returned %d", ret)
}
totalb, err := unix.Sysctl("hw.memsize")
if err != nil {

Loading…
Cancel
Save