unix: don't export any padding/alignment fields on all platforms
On linux/s390x these fields are already hidden. Don't export them on any
other platform either.
Preparatory CL for https://golang.org/cl/106656
Change-Id: I421a0ba41ff46081e2576be212e246a4dd982a67
Reviewed-on: https://go-review.googlesource.com/106838
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/unix/mkpost.go b/unix/mkpost.go
index 23590bd..7938fe7 100644
--- a/unix/mkpost.go
+++ b/unix/mkpost.go
@@ -69,12 +69,9 @@
removePaddingFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`)
b = removePaddingFieldsRegex.ReplaceAll(b, []byte("_"))
- // We refuse to export private fields on s390x
- if goarch == "s390x" && goos == "linux" {
- // Remove padding, hidden, or unused fields
- removeFieldsRegex = regexp.MustCompile(`\bX_\S+`)
- b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
- }
+ // Remove padding, hidden, or unused fields
+ removeFieldsRegex = regexp.MustCompile(`\bX_\S+`)
+ b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
// Remove the first line of warning from cgo
b = b[bytes.IndexByte(b, '\n')+1:]
diff --git a/unix/ztypes_linux_386.go b/unix/ztypes_linux_386.go
index 8a20574..113f48b 100644
--- a/unix/ztypes_linux_386.go
+++ b/unix/ztypes_linux_386.go
@@ -96,24 +96,24 @@
type _Gid_t uint32
type Stat_t struct {
- Dev uint64
- X__pad1 uint16
- _ [2]byte
- X__st_ino uint32
- Mode uint32
- Nlink uint32
- Uid uint32
- Gid uint32
- Rdev uint64
- X__pad2 uint16
- _ [2]byte
- Size int64
- Blksize int32
- Blocks int64
- Atim Timespec
- Mtim Timespec
- Ctim Timespec
- Ino uint64
+ Dev uint64
+ _ uint16
+ _ [2]byte
+ _ uint32
+ Mode uint32
+ Nlink uint32
+ Uid uint32
+ Gid uint32
+ Rdev uint64
+ _ uint16
+ _ [2]byte
+ Size int64
+ Blksize int32
+ Blocks int64
+ Atim Timespec
+ Mtim Timespec
+ Ctim Timespec
+ Ino uint64
}
type Statfs_t struct {
@@ -132,9 +132,9 @@
}
type StatxTimestamp struct {
- Sec int64
- Nsec uint32
- X__reserved int32
+ Sec int64
+ Nsec uint32
+ _ int32
}
type Statx_t struct {
@@ -171,7 +171,7 @@
}
type Fsid struct {
- X__val [2]int32
+ _ [2]int32
}
type Flock_t struct {
@@ -583,12 +583,12 @@
}
type IfInfomsg struct {
- Family uint8
- X__ifi_pad uint8
- Type uint16
- Index int32
- Flags uint32
- Change uint32
+ Family uint8
+ _ uint8
+ Type uint16
+ Index int32
+ Flags uint32
+ Change uint32
}
type IfAddrmsg struct {
@@ -683,7 +683,7 @@
Totalhigh uint32
Freehigh uint32
Unit uint32
- X_f [8]int8
+ _ [8]int8
}
type Utsname struct {
@@ -739,7 +739,7 @@
)
type Sigset_t struct {
- X__val [32]uint32
+ _ [32]uint32
}
const RNDGETENTCNT = 0x80045200
diff --git a/unix/ztypes_linux_amd64.go b/unix/ztypes_linux_amd64.go
index ccf8137..fa0ad6c 100644
--- a/unix/ztypes_linux_amd64.go
+++ b/unix/ztypes_linux_amd64.go
@@ -105,7 +105,7 @@
Mode uint32
Uid uint32
Gid uint32
- X__pad0 int32
+ _ int32
Rdev uint64
Size int64
Blksize int64
@@ -132,9 +132,9 @@
}
type StatxTimestamp struct {
- Sec int64
- Nsec uint32
- X__reserved int32
+ Sec int64
+ Nsec uint32
+ _ int32
}
type Statx_t struct {
@@ -171,7 +171,7 @@
}
type Fsid struct {
- X__val [2]int32
+ _ [2]int32
}
type Flock_t struct {
@@ -587,12 +587,12 @@
}
type IfInfomsg struct {
- Family uint8
- X__ifi_pad uint8
- Type uint16
- Index int32
- Flags uint32
- Change uint32
+ Family uint8
+ _ uint8
+ Type uint16
+ Index int32
+ Flags uint32
+ Change uint32
}
type IfAddrmsg struct {
@@ -698,7 +698,7 @@
Totalhigh uint64
Freehigh uint64
Unit uint32
- X_f [0]int8
+ _ [0]int8
_ [4]byte
}
@@ -757,7 +757,7 @@
)
type Sigset_t struct {
- X__val [16]uint64
+ _ [16]uint64
}
const RNDGETENTCNT = 0x80045200
diff --git a/unix/ztypes_linux_arm.go b/unix/ztypes_linux_arm.go
index d7b05e5..9b7b32e 100644
--- a/unix/ztypes_linux_arm.go
+++ b/unix/ztypes_linux_arm.go
@@ -96,25 +96,25 @@
type _Gid_t uint32
type Stat_t struct {
- Dev uint64
- X__pad1 uint16
- _ [2]byte
- X__st_ino uint32
- Mode uint32
- Nlink uint32
- Uid uint32
- Gid uint32
- Rdev uint64
- X__pad2 uint16
- _ [6]byte
- Size int64
- Blksize int32
- _ [4]byte
- Blocks int64
- Atim Timespec
- Mtim Timespec
- Ctim Timespec
- Ino uint64
+ Dev uint64
+ _ uint16
+ _ [2]byte
+ _ uint32
+ Mode uint32
+ Nlink uint32
+ Uid uint32
+ Gid uint32
+ Rdev uint64
+ _ uint16
+ _ [6]byte
+ Size int64
+ Blksize int32
+ _ [4]byte
+ Blocks int64
+ Atim Timespec
+ Mtim Timespec
+ Ctim Timespec
+ Ino uint64
}
type Statfs_t struct {
@@ -134,9 +134,9 @@
}
type StatxTimestamp struct {
- Sec int64
- Nsec uint32
- X__reserved int32
+ Sec int64
+ Nsec uint32
+ _ int32
}
type Statx_t struct {
@@ -173,7 +173,7 @@
}
type Fsid struct {
- X__val [2]int32
+ _ [2]int32
}
type Flock_t struct {
@@ -587,12 +587,12 @@
}
type IfInfomsg struct {
- Family uint8
- X__ifi_pad uint8
- Type uint16
- Index int32
- Flags uint32
- Change uint32
+ Family uint8
+ _ uint8
+ Type uint16
+ Index int32
+ Flags uint32
+ Change uint32
}
type IfAddrmsg struct {
@@ -671,7 +671,7 @@
Totalhigh uint32
Freehigh uint32
Unit uint32
- X_f [8]uint8
+ _ [8]uint8
}
type Utsname struct {
@@ -728,7 +728,7 @@
)
type Sigset_t struct {
- X__val [32]uint32
+ _ [32]uint32
}
const RNDGETENTCNT = 0x80045200
diff --git a/unix/ztypes_linux_arm64.go b/unix/ztypes_linux_arm64.go
index 27d8b40..52f8b3f 100644
--- a/unix/ztypes_linux_arm64.go
+++ b/unix/ztypes_linux_arm64.go
@@ -106,10 +106,10 @@
Uid uint32
Gid uint32
Rdev uint64
- X__pad1 uint64
+ _ uint64
Size int64
Blksize int32
- X__pad2 int32
+ _ int32
Blocks int64
Atim Timespec
Mtim Timespec
@@ -133,9 +133,9 @@
}
type StatxTimestamp struct {
- Sec int64
- Nsec uint32
- X__reserved int32
+ Sec int64
+ Nsec uint32
+ _ int32
}
type Statx_t struct {
@@ -172,7 +172,7 @@
}
type Fsid struct {
- X__val [2]int32
+ _ [2]int32
}
type Flock_t struct {
@@ -588,12 +588,12 @@
}
type IfInfomsg struct {
- Family uint8
- X__ifi_pad uint8
- Type uint16
- Index int32
- Flags uint32
- Change uint32
+ Family uint8
+ _ uint8
+ Type uint16
+ Index int32
+ Flags uint32
+ Change uint32
}
type IfAddrmsg struct {
@@ -676,7 +676,7 @@
Totalhigh uint64
Freehigh uint64
Unit uint32
- X_f [0]int8
+ _ [0]int8
_ [4]byte
}
@@ -736,7 +736,7 @@
)
type Sigset_t struct {
- X__val [16]uint64
+ _ [16]uint64
}
const RNDGETENTCNT = 0x80045200
diff --git a/unix/ztypes_linux_mips.go b/unix/ztypes_linux_mips.go
index 7d451aa..3af42dd 100644
--- a/unix/ztypes_linux_mips.go
+++ b/unix/ztypes_linux_mips.go
@@ -133,9 +133,9 @@
}
type StatxTimestamp struct {
- Sec int64
- Nsec uint32
- X__reserved int32
+ Sec int64
+ Nsec uint32
+ _ int32
}
type Statx_t struct {
@@ -172,7 +172,7 @@
}
type Fsid struct {
- X__val [2]int32
+ _ [2]int32
}
type Flock_t struct {
@@ -586,12 +586,12 @@
}
type IfInfomsg struct {
- Family uint8
- X__ifi_pad uint8
- Type uint16
- Index int32
- Flags uint32
- Change uint32
+ Family uint8
+ _ uint8
+ Type uint16
+ Index int32
+ Flags uint32
+ Change uint32
}
type IfAddrmsg struct {
@@ -676,7 +676,7 @@
Totalhigh uint32
Freehigh uint32
Unit uint32
- X_f [8]int8
+ _ [8]int8
}
type Utsname struct {
@@ -733,7 +733,7 @@
)
type Sigset_t struct {
- X__val [32]uint32
+ _ [32]uint32
}
const RNDGETENTCNT = 0x40045200
diff --git a/unix/ztypes_linux_mips64.go b/unix/ztypes_linux_mips64.go
index cbe9230..6779a90 100644
--- a/unix/ztypes_linux_mips64.go
+++ b/unix/ztypes_linux_mips64.go
@@ -133,9 +133,9 @@
}
type StatxTimestamp struct {
- Sec int64
- Nsec uint32
- X__reserved int32
+ Sec int64
+ Nsec uint32
+ _ int32
}
type Statx_t struct {
@@ -172,7 +172,7 @@
}
type Fsid struct {
- X__val [2]int32
+ _ [2]int32
}
type Flock_t struct {
@@ -588,12 +588,12 @@
}
type IfInfomsg struct {
- Family uint8
- X__ifi_pad uint8
- Type uint16
- Index int32
- Flags uint32
- Change uint32
+ Family uint8
+ _ uint8
+ Type uint16
+ Index int32
+ Flags uint32
+ Change uint32
}
type IfAddrmsg struct {
@@ -679,7 +679,7 @@
Totalhigh uint64
Freehigh uint64
Unit uint32
- X_f [0]int8
+ _ [0]int8
_ [4]byte
}
@@ -738,7 +738,7 @@
)
type Sigset_t struct {
- X__val [16]uint64
+ _ [16]uint64
}
const RNDGETENTCNT = 0x40045200
diff --git a/unix/ztypes_linux_mips64le.go b/unix/ztypes_linux_mips64le.go
index 990468f..6c070ce 100644
--- a/unix/ztypes_linux_mips64le.go
+++ b/unix/ztypes_linux_mips64le.go
@@ -133,9 +133,9 @@
}
type StatxTimestamp struct {
- Sec int64
- Nsec uint32
- X__reserved int32
+ Sec int64
+ Nsec uint32
+ _ int32
}
type Statx_t struct {
@@ -172,7 +172,7 @@
}
type Fsid struct {
- X__val [2]int32
+ _ [2]int32
}
type Flock_t struct {
@@ -588,12 +588,12 @@
}
type IfInfomsg struct {
- Family uint8
- X__ifi_pad uint8
- Type uint16
- Index int32
- Flags uint32
- Change uint32
+ Family uint8
+ _ uint8
+ Type uint16
+ Index int32
+ Flags uint32
+ Change uint32
}
type IfAddrmsg struct {
@@ -679,7 +679,7 @@
Totalhigh uint64
Freehigh uint64
Unit uint32
- X_f [0]int8
+ _ [0]int8
_ [4]byte
}
@@ -738,7 +738,7 @@
)
type Sigset_t struct {
- X__val [16]uint64
+ _ [16]uint64
}
const RNDGETENTCNT = 0x40045200
diff --git a/unix/ztypes_linux_mipsle.go b/unix/ztypes_linux_mipsle.go
index 3433a8f6..57e35d1 100644
--- a/unix/ztypes_linux_mipsle.go
+++ b/unix/ztypes_linux_mipsle.go
@@ -133,9 +133,9 @@
}
type StatxTimestamp struct {
- Sec int64
- Nsec uint32
- X__reserved int32
+ Sec int64
+ Nsec uint32
+ _ int32
}
type Statx_t struct {
@@ -172,7 +172,7 @@
}
type Fsid struct {
- X__val [2]int32
+ _ [2]int32
}
type Flock_t struct {
@@ -586,12 +586,12 @@
}
type IfInfomsg struct {
- Family uint8
- X__ifi_pad uint8
- Type uint16
- Index int32
- Flags uint32
- Change uint32
+ Family uint8
+ _ uint8
+ Type uint16
+ Index int32
+ Flags uint32
+ Change uint32
}
type IfAddrmsg struct {
@@ -676,7 +676,7 @@
Totalhigh uint32
Freehigh uint32
Unit uint32
- X_f [8]int8
+ _ [8]int8
}
type Utsname struct {
@@ -733,7 +733,7 @@
)
type Sigset_t struct {
- X__val [32]uint32
+ _ [32]uint32
}
const RNDGETENTCNT = 0x40045200
diff --git a/unix/ztypes_linux_ppc64.go b/unix/ztypes_linux_ppc64.go
index 5748d80..afe5de7 100644
--- a/unix/ztypes_linux_ppc64.go
+++ b/unix/ztypes_linux_ppc64.go
@@ -105,7 +105,7 @@
Mode uint32
Uid uint32
Gid uint32
- X__pad2 int32
+ _ int32
Rdev uint64
Size int64
Blksize int64
@@ -134,9 +134,9 @@
}
type StatxTimestamp struct {
- Sec int64
- Nsec uint32
- X__reserved int32
+ Sec int64
+ Nsec uint32
+ _ int32
}
type Statx_t struct {
@@ -173,7 +173,7 @@
}
type Fsid struct {
- X__val [2]int32
+ _ [2]int32
}
type Flock_t struct {
@@ -589,12 +589,12 @@
}
type IfInfomsg struct {
- Family uint8
- X__ifi_pad uint8
- Type uint16
- Index int32
- Flags uint32
- Change uint32
+ Family uint8
+ _ uint8
+ Type uint16
+ Index int32
+ Flags uint32
+ Change uint32
}
type IfAddrmsg struct {
@@ -686,7 +686,7 @@
Totalhigh uint64
Freehigh uint64
Unit uint32
- X_f [0]uint8
+ _ [0]uint8
_ [4]byte
}
@@ -709,10 +709,10 @@
}
type EpollEvent struct {
- Events uint32
- X_padFd int32
- Fd int32
- Pad int32
+ Events uint32
+ _ int32
+ Fd int32
+ Pad int32
}
const (
@@ -746,7 +746,7 @@
)
type Sigset_t struct {
- X__val [16]uint64
+ _ [16]uint64
}
const RNDGETENTCNT = 0x40045200
diff --git a/unix/ztypes_linux_ppc64le.go b/unix/ztypes_linux_ppc64le.go
index ca54d44..c069289 100644
--- a/unix/ztypes_linux_ppc64le.go
+++ b/unix/ztypes_linux_ppc64le.go
@@ -105,7 +105,7 @@
Mode uint32
Uid uint32
Gid uint32
- X__pad2 int32
+ _ int32
Rdev uint64
Size int64
Blksize int64
@@ -134,9 +134,9 @@
}
type StatxTimestamp struct {
- Sec int64
- Nsec uint32
- X__reserved int32
+ Sec int64
+ Nsec uint32
+ _ int32
}
type Statx_t struct {
@@ -173,7 +173,7 @@
}
type Fsid struct {
- X__val [2]int32
+ _ [2]int32
}
type Flock_t struct {
@@ -589,12 +589,12 @@
}
type IfInfomsg struct {
- Family uint8
- X__ifi_pad uint8
- Type uint16
- Index int32
- Flags uint32
- Change uint32
+ Family uint8
+ _ uint8
+ Type uint16
+ Index int32
+ Flags uint32
+ Change uint32
}
type IfAddrmsg struct {
@@ -686,7 +686,7 @@
Totalhigh uint64
Freehigh uint64
Unit uint32
- X_f [0]uint8
+ _ [0]uint8
_ [4]byte
}
@@ -709,10 +709,10 @@
}
type EpollEvent struct {
- Events uint32
- X_padFd int32
- Fd int32
- Pad int32
+ Events uint32
+ _ int32
+ Fd int32
+ Pad int32
}
const (
@@ -746,7 +746,7 @@
)
type Sigset_t struct {
- X__val [16]uint64
+ _ [16]uint64
}
const RNDGETENTCNT = 0x40045200