diff --git a/go-pathrs/internal/libpathrs/libpathrs_linux.go b/go-pathrs/internal/libpathrs/libpathrs_linux.go index d610a3be..cceb20c0 100644 --- a/go-pathrs/internal/libpathrs/libpathrs_linux.go +++ b/go-pathrs/internal/libpathrs/libpathrs_linux.go @@ -217,7 +217,15 @@ func InRootHardlink(oldRootFd uintptr, oldPath string, newRootFd uintptr, newPat } // ProcBase is pathrs_proc_base_t (uint64_t). -type ProcBase C.pathrs_proc_base_t +// +// Spelled out rather than taken from C.pathrs_proc_base_t, because cbindgen +// since v0.29.3 emits the C23 fixed-type enum syntax for pathrs_proc_base_t, +// and in C23 mode that makes the typedef name the enum rather than uint64_t. +// CGo maps a C enum to a *signed* Go type, so none of the constants below fit +// in it and the package stops compiling. Every compiler defaulting to C23 +// (gcc >= 15) is affected. The values are converted back at each call site +// anyway, so nothing else has to know which spelling the header uses. +type ProcBase uint64 // FIXME: We need to open-code the constants because CGo unfortunately will // implicitly convert any non-literal constants (i.e. those resolved using gcc)