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

syscall: Statfs_t on OpenBSD with f_ #47958

Closed
miraculli opened this issue Aug 25, 2021 · 1 comment
Closed

syscall: Statfs_t on OpenBSD with f_ #47958

miraculli opened this issue Aug 25, 2021 · 1 comment

Comments

@miraculli
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.16.2 openbsd/amd64

Does this issue reproduce with the latest release?

Go 1.17 is not yet available on OpenBSD

What operating system and processor architecture are you using (go env)?

openbsd/amd64

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/.../.cache/go-build"
GOENV="/home/.../.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="openbsd"
GOINSECURE=""
GOMODCACHE="/home/.../go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="openbsd"
GOPATH="/home/.../go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/openbsd_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="cc"
CXX="c++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build521513831=/tmp/go-build -gno-record-gcc-switches"

What did you do?

This is related to nats-io/nats-server#2445
I want to build nats-server on openbsd but it fails due to undefined fields in syscall.Statfs_t on OpenBSD.

I tracked it somewhat down and can tell that this syscalls to Statfs work fine when calling with an "F_" prefix:

var fs syscall.Statfs_t
if err := syscall.Statfs(path, &fs); err == nil {
    fmt.Println(fs.F_bavail)
    fmt.Println(fs.F_bsize)
}

The field definition on OpenBSD can be found here: http://man.openbsd.org/statfs
But they look the same (with that 'f_' prefix) on Linux and Darwin where nats-server builds fine.

What did you expect to see?

This should compile on OpenBSD

var fs syscall.Statfs_t
if err := syscall.Statfs(path, &fs); err == nil {
    fmt.Println(fs.Bavail)
    fmt.Println(fs.Bsize)
}

What did you see instead?

This compiles and runs on OpenBSD fine but is different from other OSes

var fs syscall.Statfs_t
if err := syscall.Statfs(path, &fs); err == nil {
	fmt.Println(fs.F_bavail)
	fmt.Println(fs.F_bsize)
}

@toothrot toothrot changed the title syscall.Statfs_t on OpenBSD with f_ syscall: Statfs_t on OpenBSD with f_ Aug 25, 2021
@seankhliao
Copy link
Member

@golang golang locked and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants