|
@@ -1,11 +1,12 @@
|
|
|
-//go:build darwin
|
|
|
|
|
|
|
+//go:build darwin || freebsd
|
|
|
|
|
|
|
|
package docker
|
|
package docker
|
|
|
|
|
|
|
|
import "syscall"
|
|
import "syscall"
|
|
|
|
|
|
|
|
// hostStorageUsage reports used/total bytes of the filesystem holding the
|
|
// hostStorageUsage reports used/total bytes of the filesystem holding the
|
|
|
-// current working directory.
|
|
|
|
|
|
|
+// current working directory. syscall.Statfs is available on both macOS and
|
|
|
|
|
+// FreeBSD with the same Statfs_t block-count fields.
|
|
|
func hostStorageUsage() (int64, int64, bool) {
|
|
func hostStorageUsage() (int64, int64, bool) {
|
|
|
var st syscall.Statfs_t
|
|
var st syscall.Statfs_t
|
|
|
if err := syscall.Statfs(".", &st); err != nil {
|
|
if err := syscall.Statfs(".", &st); err != nil {
|
|
@@ -20,8 +21,8 @@ func hostStorageUsage() (int64, int64, bool) {
|
|
|
return total - avail, total, true
|
|
return total - avail, total, true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// hostLoadAvg is not wired up on macOS (getloadavg needs cgo); report
|
|
|
|
|
-// unavailable so the UI hides the value.
|
|
|
|
|
|
|
+// hostLoadAvg is not wired up on macOS (getloadavg needs cgo) or FreeBSD (no
|
|
|
|
|
+// /proc/loadavg); report unavailable so the UI hides the value.
|
|
|
func hostLoadAvg() (float64, float64, float64, bool) {
|
|
func hostLoadAvg() (float64, float64, float64, bool) {
|
|
|
return 0, 0, 0, false
|
|
return 0, 0, 0, false
|
|
|
}
|
|
}
|