Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compilation on ARM32 #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

chbmuc
Copy link

@chbmuc chbmuc commented Feb 20, 2022

BPF_FS_MAGIC is too big for statfs.Type on 32bit architectures. Converting to uint64 seems to fix this.

BPF_FS_MAGIC is too big for statfs.Type on 32bit architectures. Converting
to uint64 seems to fix this.
@lmb
Copy link
Contributor

lmb commented Feb 22, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants