Skip to content

x/sys/unix: missing types #74811

@andersthomson

Description

@andersthomson

Go version

go version go1.24.0 linux/arm64

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/anders/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/anders/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -pthread -fmessage-length=0 -ffile-prefix-map=/tmp/go-build720377036=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/home/anders/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/anders/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/anders/go-1.24.0'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/anders/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/anders/go-1.24.0/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.24.0'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

sys/unix is missing a number of types for fanotify.

$ grep ^struct /usr/include/linux/fanotify.h
struct fanotify_event_metadata {
struct fanotify_event_info_header {
struct fanotify_event_info_fid {
struct fanotify_event_info_pidfd {
struct fanotify_event_info_error {
struct fanotify_response {
struct fanotify_response_info_header {
struct fanotify_response_info_audit_rule {

The only two types defined are
$ grep -i 'type Fanotify' src/cmd/vendor/golang.org/x/sys/unix/*
src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go:type FanotifyEventMetadata struct {
src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go:type FanotifyResponse struct {

To usefully use fanotify, all c structs need to have go counterparts.

What did you see happen?

Trying to use https://github.com/s3rj1k/go-fanotify only to discover that it (as is) only uses/exposes a limited part of fanotify, and when trying to change it (notably to not require root privs), I needed to parse the additional, unsupported, structs.

What did you expect to see?

Full coverage of fanotify structs as go types.

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.FeatureRequestIssues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions