|
| 1 | +//go:build netbsd |
| 2 | +// +build netbsd |
| 3 | + |
| 4 | +package host |
| 5 | + |
| 6 | +import ( |
| 7 | + "context" |
| 8 | + "strings" |
| 9 | + |
| 10 | + "github.com/shirou/gopsutil/v3/internal/common" |
| 11 | + "golang.org/x/sys/unix" |
| 12 | +) |
| 13 | + |
| 14 | +func HostIDWithContext(ctx context.Context) (string, error) { |
| 15 | + return "", common.ErrNotImplementedError |
| 16 | +} |
| 17 | + |
| 18 | +func numProcs(ctx context.Context) (uint64, error) { |
| 19 | + return 0, common.ErrNotImplementedError |
| 20 | +} |
| 21 | + |
| 22 | +func PlatformInformationWithContext(ctx context.Context) (string, string, string, error) { |
| 23 | + platform := "" |
| 24 | + family := "" |
| 25 | + version := "" |
| 26 | + |
| 27 | + p, err := unix.Sysctl("kern.ostype") |
| 28 | + if err == nil { |
| 29 | + platform = strings.ToLower(p) |
| 30 | + } |
| 31 | + v, err := unix.Sysctl("kern.osrelease") |
| 32 | + if err == nil { |
| 33 | + version = strings.ToLower(v) |
| 34 | + } |
| 35 | + |
| 36 | + return platform, family, version, nil |
| 37 | +} |
| 38 | + |
| 39 | +func VirtualizationWithContext(ctx context.Context) (string, string, error) { |
| 40 | + return "", "", common.ErrNotImplementedError |
| 41 | +} |
| 42 | + |
| 43 | +func UsersWithContext(ctx context.Context) ([]UserStat, error) { |
| 44 | + var ret []UserStat |
| 45 | + return ret, common.ErrNotImplementedError |
| 46 | +} |
| 47 | + |
| 48 | +func SensorsTemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { |
| 49 | + return []TemperatureStat{}, common.ErrNotImplementedError |
| 50 | +} |
| 51 | + |
| 52 | +func KernelVersionWithContext(ctx context.Context) (string, error) { |
| 53 | + _, _, version, err := PlatformInformationWithContext(ctx) |
| 54 | + return version, err |
| 55 | +} |
0 commit comments