Skip to content

os, syscall, x/sys/unix: add support for FreeBSD 12 #22448

@mikioh

Description

@mikioh

As described in https://svnweb.freebsd.org/base?view=revision&revision=318736, FreeBSD 12 changes the ABI related to file status and directory file format like the following:

--- a/unix/ztypes_freebsd_${goarch}.go
+++ b/unix/ztypes_freebsd_$(goarch}.go
type Stat_t struct {
-       Dev           uint32
-       Ino           uint32
+       Dev           uint64
+       Ino           uint64
        Mode          uint16
-       Nlink         uint16
+       Pad_cgo_0     [6]byte
+       Nlink         uint64
        Uid           uint32
        Gid           uint32
-       Rdev          uint32
+       Rdev          uint64
        Atimespec     Timespec
        Mtimespec     Timespec
        Ctimespec     Timespec

type Statfs_t struct {
        Fsid        Fsid
        Charspare   [80]int8
        Fstypename  [16]int8
-       Mntfromname [88]int8
-       Mntonname   [88]int8
+       Mntfromname [1024]int8
+       Mntonname   [1024]int8
 }
 
 type Dirent struct {
-       Fileno uint32
+       Fileno uint64
+       Off    int64
        Reclen uint16
        Type   uint8
-       Namlen uint8
+       Pad0   uint8
+       Namlen uint16
+       Pad1   uint16
        Name   [256]int8
 }

We need to find out some good way to fill the ABI gap between FreeBSD 11 or below and FreeBSD 12 or above. Plus a few test cases. The existing test cases don't detect the ABI breakage and APIs in os, syscall and x/sys/unix packages return corrupted information to API users.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions