Skip to content

Commit

Permalink
Fix FreeBSD build with latest x/sys/unix
Browse files Browse the repository at this point in the history
There was a breaking change in upstream golang.org/x/sys/unix which
changed the type of some Statvfs members, see shirou#853. As it looks like
this change won't be reverted, adjust gopsutil to work with it and allow
to build against the latest version of x/sys/unix.
  • Loading branch information
tklauser committed Jun 22, 2020
1 parent b806400 commit d5eecd6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
version = "1.2.2"

[[constraint]]
branch = "master"
name = "golang.org/x/sys"
revision = "a7d97aace0b03bedead413ec782269d62e032341"

[prune]
go-tests = true
Expand Down
8 changes: 4 additions & 4 deletions disk/disk_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
}

d := PartitionStat{
Device: common.IntToString(stat.Mntfromname[:]),
Mountpoint: common.IntToString(stat.Mntonname[:]),
Fstype: common.IntToString(stat.Fstypename[:]),
Device: common.ByteToString(stat.Mntfromname[:]),
Mountpoint: common.ByteToString(stat.Mntonname[:]),
Fstype: common.ByteToString(stat.Fstypename[:]),
Opts: opts,
}
if all == false {
Expand Down Expand Up @@ -170,5 +170,5 @@ func parseDevstat(buf []byte) (Devstat, error) {
}

func getFsType(stat unix.Statfs_t) string {
return common.IntToString(stat.Fstypename[:])
return common.ByteToString(stat.Fstypename[:])
}

0 comments on commit d5eecd6

Please sign in to comment.