tubular
tubular copied to clipboard
fix compilation on ARM32
BPF_FS_MAGIC is too big for statfs.Type on 32bit architectures. Converting to uint64 seems to fix this.
Hello!
This is BPF_FS_MAGIC on arm:
$ GOARCH=arm go doc golang.org/x/sys/unix.BPF_FS_MAGIC | grep BPF_FS
BPF_FS_MAGIC = 0xcafe4a11
Statfs_t.Type is int32 it seems:
$ GOARCH=arm go doc golang.org/x/sys/unix.Statfs_t
package unix // import "golang.org/x/sys/unix"
type Statfs_t struct {
Type int32
Bsize int32
Blocks uint64
Bfree uint64
Bavail uint64
Files uint64
Ffree uint64
Fsid Fsid
Namelen int32
Frsize int32
Flags int32
Spare [4]int32
// Has unexported fields.
}
The problem is that the constant exceeds int32. In this instance I would probably convert to int64 instead of uint64 since that makes conversion a no op on 64 bit arches.