diff --git a/disk/disk_netbsd.go b/disk/disk_netbsd.go index c3459e15b..8973ec516 100644 --- a/disk/disk_netbsd.go +++ b/disk/disk_netbsd.go @@ -26,13 +26,12 @@ const ( func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { var ret []PartitionStat - trap := 483 // SYS___getvfsstat90 syscall flag := uint64(1) // ST_WAIT/MNT_WAIT, see sys/fstypes.h // get required buffer size emptyBufSize := 0 r, _, err := unix.Syscall( - uintptr(unsafe.Pointer(&trap)), + 483, // SYS___getvfsstat90 syscall uintptr(unsafe.Pointer(nil)), uintptr(unsafe.Pointer(&emptyBufSize)), uintptr(unsafe.Pointer(&flag)), @@ -44,11 +43,11 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro // calculate the buffer size bufSize := sizeOfStatvfs * mountedFsCount - buf := make([]Statvfs, bufSize) + buf := make([]Statvfs, mountedFsCount) // request agian to get desired mount data _, _, err = unix.Syscall( - uintptr(unsafe.Pointer(&flag)), + 483, // SYS___getvfsstat90 syscall uintptr(unsafe.Pointer(&buf[0])), uintptr(unsafe.Pointer(&bufSize)), uintptr(unsafe.Pointer(&flag)), @@ -104,12 +103,16 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { stat := Statvfs{} - trap := 485 // SYS___fstatvfs190, see sys/syscall.h flag := uint64(1) // ST_WAIT/MNT_WAIT, see sys/fstypes.h + _path, e := unix.BytePtrFromString(path) + if e != nil { + return nil, e + } + _, _, err := unix.Syscall( - uintptr(unsafe.Pointer(&trap)), - uintptr(unsafe.Pointer(&path)), + 484, // SYS___fstatvfs190, see sys/syscall.h + uintptr(unsafe.Pointer(_path)), uintptr(unsafe.Pointer(&stat)), uintptr(unsafe.Pointer(&flag)), ) diff --git a/disk/disk_netbsd_arm64.go b/disk/disk_netbsd_arm64.go index c98be60e3..a2e806226 100644 --- a/disk/disk_netbsd_arm64.go +++ b/disk/disk_netbsd_arm64.go @@ -41,5 +41,5 @@ type ( ) type _Ctype_struct___0 struct { - FsidVal [32]int32 + FsidVal [2]int32 }