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>
This commit is contained in:
Tobias Klauser
2018-04-14 09:28:25 +00:00
committed by Tobias Klauser
parent f6f352972f
commit 2281fa97ef
11 changed files with 173 additions and 176 deletions
-3
View File
@@ -69,12 +69,9 @@ func main() {
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 the first line of warning from cgo
b = b[bytes.IndexByte(b, '\n')+1:]
+8 -8
View File
@@ -97,15 +97,15 @@ type _Gid_t uint32
type Stat_t struct {
Dev uint64
X__pad1 uint16
_ uint16
_ [2]byte
X__st_ino uint32
_ uint32
Mode uint32
Nlink uint32
Uid uint32
Gid uint32
Rdev uint64
X__pad2 uint16
_ uint16
_ [2]byte
Size int64
Blksize int32
@@ -134,7 +134,7 @@ type Statfs_t struct {
type StatxTimestamp struct {
Sec int64
Nsec uint32
X__reserved int32
_ int32
}
type Statx_t struct {
@@ -171,7 +171,7 @@ type Dirent struct {
}
type Fsid struct {
X__val [2]int32
_ [2]int32
}
type Flock_t struct {
@@ -584,7 +584,7 @@ type RtAttr struct {
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
_ uint8
Type uint16
Index int32
Flags uint32
@@ -683,7 +683,7 @@ type Sysinfo_t struct {
Totalhigh uint32
Freehigh uint32
Unit uint32
X_f [8]int8
_ [8]int8
}
type Utsname struct {
@@ -739,7 +739,7 @@ const (
)
type Sigset_t struct {
X__val [32]uint32
_ [32]uint32
}
const RNDGETENTCNT = 0x80045200
+6 -6
View File
@@ -105,7 +105,7 @@ type Stat_t struct {
Mode uint32
Uid uint32
Gid uint32
X__pad0 int32
_ int32
Rdev uint64
Size int64
Blksize int64
@@ -134,7 +134,7 @@ type Statfs_t struct {
type StatxTimestamp struct {
Sec int64
Nsec uint32
X__reserved int32
_ int32
}
type Statx_t struct {
@@ -171,7 +171,7 @@ type Dirent struct {
}
type Fsid struct {
X__val [2]int32
_ [2]int32
}
type Flock_t struct {
@@ -588,7 +588,7 @@ type RtAttr struct {
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
_ uint8
Type uint16
Index int32
Flags uint32
@@ -698,7 +698,7 @@ type Sysinfo_t struct {
Totalhigh uint64
Freehigh uint64
Unit uint32
X_f [0]int8
_ [0]int8
_ [4]byte
}
@@ -757,7 +757,7 @@ const (
)
type Sigset_t struct {
X__val [16]uint64
_ [16]uint64
}
const RNDGETENTCNT = 0x80045200
+8 -8
View File
@@ -97,15 +97,15 @@ type _Gid_t uint32
type Stat_t struct {
Dev uint64
X__pad1 uint16
_ uint16
_ [2]byte
X__st_ino uint32
_ uint32
Mode uint32
Nlink uint32
Uid uint32
Gid uint32
Rdev uint64
X__pad2 uint16
_ uint16
_ [6]byte
Size int64
Blksize int32
@@ -136,7 +136,7 @@ type Statfs_t struct {
type StatxTimestamp struct {
Sec int64
Nsec uint32
X__reserved int32
_ int32
}
type Statx_t struct {
@@ -173,7 +173,7 @@ type Dirent struct {
}
type Fsid struct {
X__val [2]int32
_ [2]int32
}
type Flock_t struct {
@@ -588,7 +588,7 @@ type RtAttr struct {
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
_ uint8
Type uint16
Index int32
Flags uint32
@@ -671,7 +671,7 @@ type Sysinfo_t struct {
Totalhigh uint32
Freehigh uint32
Unit uint32
X_f [8]uint8
_ [8]uint8
}
type Utsname struct {
@@ -728,7 +728,7 @@ const (
)
type Sigset_t struct {
X__val [32]uint32
_ [32]uint32
}
const RNDGETENTCNT = 0x80045200
+7 -7
View File
@@ -106,10 +106,10 @@ type Stat_t struct {
Uid uint32
Gid uint32
Rdev uint64
X__pad1 uint64
_ uint64
Size int64
Blksize int32
X__pad2 int32
_ int32
Blocks int64
Atim Timespec
Mtim Timespec
@@ -135,7 +135,7 @@ type Statfs_t struct {
type StatxTimestamp struct {
Sec int64
Nsec uint32
X__reserved int32
_ int32
}
type Statx_t struct {
@@ -172,7 +172,7 @@ type Dirent struct {
}
type Fsid struct {
X__val [2]int32
_ [2]int32
}
type Flock_t struct {
@@ -589,7 +589,7 @@ type RtAttr struct {
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
_ uint8
Type uint16
Index int32
Flags uint32
@@ -676,7 +676,7 @@ type Sysinfo_t struct {
Totalhigh uint64
Freehigh uint64
Unit uint32
X_f [0]int8
_ [0]int8
_ [4]byte
}
@@ -736,7 +736,7 @@ const (
)
type Sigset_t struct {
X__val [16]uint64
_ [16]uint64
}
const RNDGETENTCNT = 0x80045200
+5 -5
View File
@@ -135,7 +135,7 @@ type Statfs_t struct {
type StatxTimestamp struct {
Sec int64
Nsec uint32
X__reserved int32
_ int32
}
type Statx_t struct {
@@ -172,7 +172,7 @@ type Dirent struct {
}
type Fsid struct {
X__val [2]int32
_ [2]int32
}
type Flock_t struct {
@@ -587,7 +587,7 @@ type RtAttr struct {
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
_ uint8
Type uint16
Index int32
Flags uint32
@@ -676,7 +676,7 @@ type Sysinfo_t struct {
Totalhigh uint32
Freehigh uint32
Unit uint32
X_f [8]int8
_ [8]int8
}
type Utsname struct {
@@ -733,7 +733,7 @@ const (
)
type Sigset_t struct {
X__val [32]uint32
_ [32]uint32
}
const RNDGETENTCNT = 0x40045200
+5 -5
View File
@@ -135,7 +135,7 @@ type Statfs_t struct {
type StatxTimestamp struct {
Sec int64
Nsec uint32
X__reserved int32
_ int32
}
type Statx_t struct {
@@ -172,7 +172,7 @@ type Dirent struct {
}
type Fsid struct {
X__val [2]int32
_ [2]int32
}
type Flock_t struct {
@@ -589,7 +589,7 @@ type RtAttr struct {
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
_ uint8
Type uint16
Index int32
Flags uint32
@@ -679,7 +679,7 @@ type Sysinfo_t struct {
Totalhigh uint64
Freehigh uint64
Unit uint32
X_f [0]int8
_ [0]int8
_ [4]byte
}
@@ -738,7 +738,7 @@ const (
)
type Sigset_t struct {
X__val [16]uint64
_ [16]uint64
}
const RNDGETENTCNT = 0x40045200
+5 -5
View File
@@ -135,7 +135,7 @@ type Statfs_t struct {
type StatxTimestamp struct {
Sec int64
Nsec uint32
X__reserved int32
_ int32
}
type Statx_t struct {
@@ -172,7 +172,7 @@ type Dirent struct {
}
type Fsid struct {
X__val [2]int32
_ [2]int32
}
type Flock_t struct {
@@ -589,7 +589,7 @@ type RtAttr struct {
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
_ uint8
Type uint16
Index int32
Flags uint32
@@ -679,7 +679,7 @@ type Sysinfo_t struct {
Totalhigh uint64
Freehigh uint64
Unit uint32
X_f [0]int8
_ [0]int8
_ [4]byte
}
@@ -738,7 +738,7 @@ const (
)
type Sigset_t struct {
X__val [16]uint64
_ [16]uint64
}
const RNDGETENTCNT = 0x40045200
+5 -5
View File
@@ -135,7 +135,7 @@ type Statfs_t struct {
type StatxTimestamp struct {
Sec int64
Nsec uint32
X__reserved int32
_ int32
}
type Statx_t struct {
@@ -172,7 +172,7 @@ type Dirent struct {
}
type Fsid struct {
X__val [2]int32
_ [2]int32
}
type Flock_t struct {
@@ -587,7 +587,7 @@ type RtAttr struct {
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
_ uint8
Type uint16
Index int32
Flags uint32
@@ -676,7 +676,7 @@ type Sysinfo_t struct {
Totalhigh uint32
Freehigh uint32
Unit uint32
X_f [8]int8
_ [8]int8
}
type Utsname struct {
@@ -733,7 +733,7 @@ const (
)
type Sigset_t struct {
X__val [32]uint32
_ [32]uint32
}
const RNDGETENTCNT = 0x40045200
+7 -7
View File
@@ -105,7 +105,7 @@ type Stat_t struct {
Mode uint32
Uid uint32
Gid uint32
X__pad2 int32
_ int32
Rdev uint64
Size int64
Blksize int64
@@ -136,7 +136,7 @@ type Statfs_t struct {
type StatxTimestamp struct {
Sec int64
Nsec uint32
X__reserved int32
_ int32
}
type Statx_t struct {
@@ -173,7 +173,7 @@ type Dirent struct {
}
type Fsid struct {
X__val [2]int32
_ [2]int32
}
type Flock_t struct {
@@ -590,7 +590,7 @@ type RtAttr struct {
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
_ uint8
Type uint16
Index int32
Flags uint32
@@ -686,7 +686,7 @@ type Sysinfo_t struct {
Totalhigh uint64
Freehigh uint64
Unit uint32
X_f [0]uint8
_ [0]uint8
_ [4]byte
}
@@ -710,7 +710,7 @@ type Ustat_t struct {
type EpollEvent struct {
Events uint32
X_padFd int32
_ int32
Fd int32
Pad int32
}
@@ -746,7 +746,7 @@ const (
)
type Sigset_t struct {
X__val [16]uint64
_ [16]uint64
}
const RNDGETENTCNT = 0x40045200
+7 -7
View File
@@ -105,7 +105,7 @@ type Stat_t struct {
Mode uint32
Uid uint32
Gid uint32
X__pad2 int32
_ int32
Rdev uint64
Size int64
Blksize int64
@@ -136,7 +136,7 @@ type Statfs_t struct {
type StatxTimestamp struct {
Sec int64
Nsec uint32
X__reserved int32
_ int32
}
type Statx_t struct {
@@ -173,7 +173,7 @@ type Dirent struct {
}
type Fsid struct {
X__val [2]int32
_ [2]int32
}
type Flock_t struct {
@@ -590,7 +590,7 @@ type RtAttr struct {
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
_ uint8
Type uint16
Index int32
Flags uint32
@@ -686,7 +686,7 @@ type Sysinfo_t struct {
Totalhigh uint64
Freehigh uint64
Unit uint32
X_f [0]uint8
_ [0]uint8
_ [4]byte
}
@@ -710,7 +710,7 @@ type Ustat_t struct {
type EpollEvent struct {
Events uint32
X_padFd int32
_ int32
Fd int32
Pad int32
}
@@ -746,7 +746,7 @@ const (
)
type Sigset_t struct {
X__val [16]uint64
_ [16]uint64
}
const RNDGETENTCNT = 0x40045200