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

fs: Statfs_t{} doesn't have a Type field on NetBSD, OpenBSD, or Solaris #523

Merged
merged 1 commit into from May 20, 2023

Conversation

dcbw
Copy link
Contributor

@dcbw dcbw commented May 17, 2023

Other projects that import procfs, like node_exporter, apparently build for OSs that don't have Statfs_t.Type.

Leads to errors like (for node_exporter):

/go/bin/promu --config .promu.yml build --prefix .build/openbsd-amd64 
 >   node_exporter
# github.com/prometheus/procfs
/go/pkg/mod/github.com/prometheus/procfs@v0.9.1-0.20230517120836-7acd99d0499a/fs.go:63:14: stat.Type undefined (type syscall.Statfs_t has no field or method Type)
!! command failed: build -o .build/openbsd-amd64/node_exporter -ldflags -X github.com/prometheus/common/version.Version=1.5.0 -X github.com/prometheus/common/version.Revision=849b6076b81bf64249b4f75e0c3134d25a1da9a3 -X github.com/prometheus/common/version.Branch=pull/2669 -X github.com/prometheus/common/version.BuildUser=root@d9577d73a62f -X github.com/prometheus/common/version.BuildDate=20230517-20:49:53  -extldflags '-static' -a -tags 'netgo osusergo static_build' github.com/prometheus/node_exporter: exit status 1

Other projects that import procfs, like node_exporter, apparently build
for OSs that don't have Statfs_t.Type.

Signed-off-by: Dan Williams <dcbw@redhat.com>
@dcbw
Copy link
Contributor Author

dcbw commented May 17, 2023

Copy link
Member

@discordianfish discordianfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The convention for naming these files would be fs_linux.go and fs_others.go, see how the naming and tags are done for cpuinfo*.go.

Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, this is fine.

@SuperQ SuperQ merged commit 58149ca into prometheus:master May 20, 2023
8 checks passed
@dcbw
Copy link
Contributor Author

dcbw commented May 22, 2023

@SuperQ I thought about that, but given that FreeBSD/Darwin also have Type, and at least FreeBSD can emulate Linux procfs with the same magic as Linux, didn't seem quite right to make it _linux.go.

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.

None yet

3 participants