Commit 2281fa97 authored by Tobias Klauser's avatar Tobias Klauser Committed by Tobias Klauser

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: 's avatarMatt Layher <mdlayher@gmail.com>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent f6f35297
...@@ -69,12 +69,9 @@ func main() { ...@@ -69,12 +69,9 @@ func main() {
removePaddingFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`) removePaddingFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`)
b = removePaddingFieldsRegex.ReplaceAll(b, []byte("_")) b = removePaddingFieldsRegex.ReplaceAll(b, []byte("_"))
// We refuse to export private fields on s390x // Remove padding, hidden, or unused fields
if goarch == "s390x" && goos == "linux" { removeFieldsRegex = regexp.MustCompile(`\bX_\S+`)
// Remove padding, hidden, or unused fields b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
removeFieldsRegex = regexp.MustCompile(`\bX_\S+`)
b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
}
// Remove the first line of warning from cgo // Remove the first line of warning from cgo
b = b[bytes.IndexByte(b, '\n')+1:] b = b[bytes.IndexByte(b, '\n')+1:]
......
...@@ -96,24 +96,24 @@ type Rlimit struct { ...@@ -96,24 +96,24 @@ type Rlimit struct {
type _Gid_t uint32 type _Gid_t uint32
type Stat_t struct { type Stat_t struct {
Dev uint64 Dev uint64
X__pad1 uint16 _ uint16
_ [2]byte _ [2]byte
X__st_ino uint32 _ uint32
Mode uint32 Mode uint32
Nlink uint32 Nlink uint32
Uid uint32 Uid uint32
Gid uint32 Gid uint32
Rdev uint64 Rdev uint64
X__pad2 uint16 _ uint16
_ [2]byte _ [2]byte
Size int64 Size int64
Blksize int32 Blksize int32
Blocks int64 Blocks int64
Atim Timespec Atim Timespec
Mtim Timespec Mtim Timespec
Ctim Timespec Ctim Timespec
Ino uint64 Ino uint64
} }
type Statfs_t struct { type Statfs_t struct {
...@@ -132,9 +132,9 @@ type Statfs_t struct { ...@@ -132,9 +132,9 @@ type Statfs_t struct {
} }
type StatxTimestamp struct { type StatxTimestamp struct {
Sec int64 Sec int64
Nsec uint32 Nsec uint32
X__reserved int32 _ int32
} }
type Statx_t struct { type Statx_t struct {
...@@ -171,7 +171,7 @@ type Dirent struct { ...@@ -171,7 +171,7 @@ type Dirent struct {
} }
type Fsid struct { type Fsid struct {
X__val [2]int32 _ [2]int32
} }
type Flock_t struct { type Flock_t struct {
...@@ -583,12 +583,12 @@ type RtAttr struct { ...@@ -583,12 +583,12 @@ type RtAttr struct {
} }
type IfInfomsg struct { type IfInfomsg struct {
Family uint8 Family uint8
X__ifi_pad uint8 _ uint8
Type uint16 Type uint16
Index int32 Index int32
Flags uint32 Flags uint32
Change uint32 Change uint32
} }
type IfAddrmsg struct { type IfAddrmsg struct {
...@@ -683,7 +683,7 @@ type Sysinfo_t struct { ...@@ -683,7 +683,7 @@ type Sysinfo_t struct {
Totalhigh uint32 Totalhigh uint32
Freehigh uint32 Freehigh uint32
Unit uint32 Unit uint32
X_f [8]int8 _ [8]int8
} }
type Utsname struct { type Utsname struct {
...@@ -739,7 +739,7 @@ const ( ...@@ -739,7 +739,7 @@ const (
) )
type Sigset_t struct { type Sigset_t struct {
X__val [32]uint32 _ [32]uint32
} }
const RNDGETENTCNT = 0x80045200 const RNDGETENTCNT = 0x80045200
......
...@@ -105,7 +105,7 @@ type Stat_t struct { ...@@ -105,7 +105,7 @@ type Stat_t struct {
Mode uint32 Mode uint32
Uid uint32 Uid uint32
Gid uint32 Gid uint32
X__pad0 int32 _ int32
Rdev uint64 Rdev uint64
Size int64 Size int64
Blksize int64 Blksize int64
...@@ -132,9 +132,9 @@ type Statfs_t struct { ...@@ -132,9 +132,9 @@ type Statfs_t struct {
} }
type StatxTimestamp struct { type StatxTimestamp struct {
Sec int64 Sec int64
Nsec uint32 Nsec uint32
X__reserved int32 _ int32
} }
type Statx_t struct { type Statx_t struct {
...@@ -171,7 +171,7 @@ type Dirent struct { ...@@ -171,7 +171,7 @@ type Dirent struct {
} }
type Fsid struct { type Fsid struct {
X__val [2]int32 _ [2]int32
} }
type Flock_t struct { type Flock_t struct {
...@@ -587,12 +587,12 @@ type RtAttr struct { ...@@ -587,12 +587,12 @@ type RtAttr struct {
} }
type IfInfomsg struct { type IfInfomsg struct {
Family uint8 Family uint8
X__ifi_pad uint8 _ uint8
Type uint16 Type uint16
Index int32 Index int32
Flags uint32 Flags uint32
Change uint32 Change uint32
} }
type IfAddrmsg struct { type IfAddrmsg struct {
...@@ -698,7 +698,7 @@ type Sysinfo_t struct { ...@@ -698,7 +698,7 @@ type Sysinfo_t struct {
Totalhigh uint64 Totalhigh uint64
Freehigh uint64 Freehigh uint64
Unit uint32 Unit uint32
X_f [0]int8 _ [0]int8
_ [4]byte _ [4]byte
} }
...@@ -757,7 +757,7 @@ const ( ...@@ -757,7 +757,7 @@ const (
) )
type Sigset_t struct { type Sigset_t struct {
X__val [16]uint64 _ [16]uint64
} }
const RNDGETENTCNT = 0x80045200 const RNDGETENTCNT = 0x80045200
......
...@@ -96,25 +96,25 @@ type Rlimit struct { ...@@ -96,25 +96,25 @@ type Rlimit struct {
type _Gid_t uint32 type _Gid_t uint32
type Stat_t struct { type Stat_t struct {
Dev uint64 Dev uint64
X__pad1 uint16 _ uint16
_ [2]byte _ [2]byte
X__st_ino uint32 _ uint32
Mode uint32 Mode uint32
Nlink uint32 Nlink uint32
Uid uint32 Uid uint32
Gid uint32 Gid uint32
Rdev uint64 Rdev uint64
X__pad2 uint16 _ uint16
_ [6]byte _ [6]byte
Size int64 Size int64
Blksize int32 Blksize int32
_ [4]byte _ [4]byte
Blocks int64 Blocks int64
Atim Timespec Atim Timespec
Mtim Timespec Mtim Timespec
Ctim Timespec Ctim Timespec
Ino uint64 Ino uint64
} }
type Statfs_t struct { type Statfs_t struct {
...@@ -134,9 +134,9 @@ type Statfs_t struct { ...@@ -134,9 +134,9 @@ type Statfs_t struct {
} }
type StatxTimestamp struct { type StatxTimestamp struct {
Sec int64 Sec int64
Nsec uint32 Nsec uint32
X__reserved int32 _ int32
} }
type Statx_t struct { type Statx_t struct {
...@@ -173,7 +173,7 @@ type Dirent struct { ...@@ -173,7 +173,7 @@ type Dirent struct {
} }
type Fsid struct { type Fsid struct {
X__val [2]int32 _ [2]int32
} }
type Flock_t struct { type Flock_t struct {
...@@ -587,12 +587,12 @@ type RtAttr struct { ...@@ -587,12 +587,12 @@ type RtAttr struct {
} }
type IfInfomsg struct { type IfInfomsg struct {
Family uint8 Family uint8
X__ifi_pad uint8 _ uint8
Type uint16 Type uint16
Index int32 Index int32
Flags uint32 Flags uint32
Change uint32 Change uint32
} }
type IfAddrmsg struct { type IfAddrmsg struct {
...@@ -671,7 +671,7 @@ type Sysinfo_t struct { ...@@ -671,7 +671,7 @@ type Sysinfo_t struct {
Totalhigh uint32 Totalhigh uint32
Freehigh uint32 Freehigh uint32
Unit uint32 Unit uint32
X_f [8]uint8 _ [8]uint8
} }
type Utsname struct { type Utsname struct {
...@@ -728,7 +728,7 @@ const ( ...@@ -728,7 +728,7 @@ const (
) )
type Sigset_t struct { type Sigset_t struct {
X__val [32]uint32 _ [32]uint32
} }
const RNDGETENTCNT = 0x80045200 const RNDGETENTCNT = 0x80045200
......
...@@ -106,10 +106,10 @@ type Stat_t struct { ...@@ -106,10 +106,10 @@ type Stat_t struct {
Uid uint32 Uid uint32
Gid uint32 Gid uint32
Rdev uint64 Rdev uint64
X__pad1 uint64 _ uint64
Size int64 Size int64
Blksize int32 Blksize int32
X__pad2 int32 _ int32
Blocks int64 Blocks int64
Atim Timespec Atim Timespec
Mtim Timespec Mtim Timespec
...@@ -133,9 +133,9 @@ type Statfs_t struct { ...@@ -133,9 +133,9 @@ type Statfs_t struct {
} }
type StatxTimestamp struct { type StatxTimestamp struct {
Sec int64 Sec int64
Nsec uint32 Nsec uint32
X__reserved int32 _ int32
} }
type Statx_t struct { type Statx_t struct {
...@@ -172,7 +172,7 @@ type Dirent struct { ...@@ -172,7 +172,7 @@ type Dirent struct {
} }
type Fsid struct { type Fsid struct {
X__val [2]int32 _ [2]int32
} }
type Flock_t struct { type Flock_t struct {
...@@ -588,12 +588,12 @@ type RtAttr struct { ...@@ -588,12 +588,12 @@ type RtAttr struct {
} }
type IfInfomsg struct { type IfInfomsg struct {
Family uint8 Family uint8
X__ifi_pad uint8 _ uint8
Type uint16 Type uint16
Index int32 Index int32
Flags uint32 Flags uint32
Change uint32 Change uint32
} }
type IfAddrmsg struct { type IfAddrmsg struct {
...@@ -676,7 +676,7 @@ type Sysinfo_t struct { ...@@ -676,7 +676,7 @@ type Sysinfo_t struct {
Totalhigh uint64 Totalhigh uint64
Freehigh uint64 Freehigh uint64
Unit uint32 Unit uint32
X_f [0]int8 _ [0]int8
_ [4]byte _ [4]byte
} }
...@@ -736,7 +736,7 @@ const ( ...@@ -736,7 +736,7 @@ const (
) )
type Sigset_t struct { type Sigset_t struct {
X__val [16]uint64 _ [16]uint64
} }
const RNDGETENTCNT = 0x80045200 const RNDGETENTCNT = 0x80045200
......
...@@ -133,9 +133,9 @@ type Statfs_t struct { ...@@ -133,9 +133,9 @@ type Statfs_t struct {
} }
type StatxTimestamp struct { type StatxTimestamp struct {
Sec int64 Sec int64
Nsec uint32 Nsec uint32
X__reserved int32 _ int32
} }
type Statx_t struct { type Statx_t struct {
...@@ -172,7 +172,7 @@ type Dirent struct { ...@@ -172,7 +172,7 @@ type Dirent struct {
} }
type Fsid struct { type Fsid struct {
X__val [2]int32 _ [2]int32
} }
type Flock_t struct { type Flock_t struct {
...@@ -586,12 +586,12 @@ type RtAttr struct { ...@@ -586,12 +586,12 @@ type RtAttr struct {
} }
type IfInfomsg struct { type IfInfomsg struct {
Family uint8 Family uint8
X__ifi_pad uint8 _ uint8
Type uint16 Type uint16
Index int32 Index int32
Flags uint32 Flags uint32
Change uint32 Change uint32
} }
type IfAddrmsg struct { type IfAddrmsg struct {
...@@ -676,7 +676,7 @@ type Sysinfo_t struct { ...@@ -676,7 +676,7 @@ type Sysinfo_t struct {
Totalhigh uint32 Totalhigh uint32
Freehigh uint32 Freehigh uint32
Unit uint32 Unit uint32
X_f [8]int8 _ [8]int8
} }
type Utsname struct { type Utsname struct {
...@@ -733,7 +733,7 @@ const ( ...@@ -733,7 +733,7 @@ const (
) )
type Sigset_t struct { type Sigset_t struct {
X__val [32]uint32 _ [32]uint32
} }
const RNDGETENTCNT = 0x40045200 const RNDGETENTCNT = 0x40045200
......
...@@ -133,9 +133,9 @@ type Statfs_t struct { ...@@ -133,9 +133,9 @@ type Statfs_t struct {
} }
type StatxTimestamp struct { type StatxTimestamp struct {
Sec int64 Sec int64
Nsec uint32 Nsec uint32
X__reserved int32 _ int32
} }
type Statx_t struct { type Statx_t struct {
...@@ -172,7 +172,7 @@ type Dirent struct { ...@@ -172,7 +172,7 @@ type Dirent struct {
} }
type Fsid struct { type Fsid struct {
X__val [2]int32 _ [2]int32
} }
type Flock_t struct { type Flock_t struct {
...@@ -588,12 +588,12 @@ type RtAttr struct { ...@@ -588,12 +588,12 @@ type RtAttr struct {
} }
type IfInfomsg struct { type IfInfomsg struct {
Family uint8 Family uint8
X__ifi_pad uint8 _ uint8
Type uint16 Type uint16
Index int32 Index int32
Flags uint32 Flags uint32
Change uint32 Change uint32
} }
type IfAddrmsg struct { type IfAddrmsg struct {
...@@ -679,7 +679,7 @@ type Sysinfo_t struct { ...@@ -679,7 +679,7 @@ type Sysinfo_t struct {
Totalhigh uint64 Totalhigh uint64
Freehigh uint64 Freehigh uint64
Unit uint32 Unit uint32
X_f [0]int8 _ [0]int8
_ [4]byte _ [4]byte
} }
...@@ -738,7 +738,7 @@ const ( ...@@ -738,7 +738,7 @@ const (
) )
type Sigset_t struct { type Sigset_t struct {
X__val [16]uint64 _ [16]uint64
} }
const RNDGETENTCNT = 0x40045200 const RNDGETENTCNT = 0x40045200
......
...@@ -133,9 +133,9 @@ type Statfs_t struct { ...@@ -133,9 +133,9 @@ type Statfs_t struct {
} }
type StatxTimestamp struct { type StatxTimestamp struct {
Sec int64 Sec int64
Nsec uint32 Nsec uint32
X__reserved int32 _ int32
} }
type Statx_t struct { type Statx_t struct {
...@@ -172,7 +172,7 @@ type Dirent struct { ...@@ -172,7 +172,7 @@ type Dirent struct {
} }
type Fsid struct { type Fsid struct {
X__val [2]int32 _ [2]int32
} }
type Flock_t struct { type Flock_t struct {
...@@ -588,12 +588,12 @@ type RtAttr struct { ...@@ -588,12 +588,12 @@ type RtAttr struct {
} }
type IfInfomsg struct { type IfInfomsg struct {
Family uint8 Family uint8
X__ifi_pad uint8 _ uint8
Type uint16 Type uint16
Index int32 Index int32
Flags uint32 Flags uint32
Change uint32 Change uint32
} }
type IfAddrmsg struct { type IfAddrmsg struct {
...@@ -679,7 +679,7 @@ type Sysinfo_t struct { ...@@ -679,7 +679,7 @@ type Sysinfo_t struct {
Totalhigh uint64 Totalhigh uint64
Freehigh uint64 Freehigh uint64
Unit uint32 Unit uint32
X_f [0]int8 _ [0]int8
_ [4]byte _ [4]byte
} }
...@@ -738,7 +738,7 @@ const ( ...@@ -738,7 +738,7 @@ const (
) )
type Sigset_t struct { type Sigset_t struct {
X__val [16]uint64 _ [16]uint64
} }
const RNDGETENTCNT = 0x40045200 const RNDGETENTCNT = 0x40045200
......
...@@ -133,9 +133,9 @@ type Statfs_t struct { ...@@ -133,9 +133,9 @@ type Statfs_t struct {
} }
type StatxTimestamp struct { type StatxTimestamp struct {
Sec int64 Sec int64
Nsec uint32 Nsec uint32
X__reserved int32 _ int32
} }
type Statx_t struct { type Statx_t struct {
...@@ -172,7 +172,7 @@ type Dirent struct { ...@@ -172,7 +172,7 @@ type Dirent struct {
} }
type Fsid struct { type Fsid struct {
X__val [2]int32 _ [2]int32
} }
type Flock_t struct { type Flock_t struct {
...@@ -586,12 +586,12 @@ type RtAttr struct { ...@@ -586,12 +586,12 @@ type RtAttr struct {
} }
type IfInfomsg struct { type IfInfomsg struct {
Family uint8 Family uint8
X__ifi_pad uint8 _ uint8
Type uint16 Type uint16
Index int32 Index int32
Flags uint32 Flags uint32
Change uint32 Change uint32
} }
type IfAddrmsg struct { type IfAddrmsg struct {
...@@ -676,7 +676,7 @@ type Sysinfo_t struct { ...@@ -676,7 +676,7 @@ type Sysinfo_t struct {
Totalhigh uint32 Totalhigh uint32
Freehigh uint32 Freehigh uint32
Unit uint32 Unit uint32
X_f [8]int8 _ [8]int8
} }
type Utsname struct { type Utsname struct {
...@@ -733,7 +733,7 @@ const ( ...@@ -733,7 +733,7 @@ const (
) )
type Sigset_t struct { type Sigset_t struct {
X__val [32]uint32 _ [32]uint32
} }
const RNDGETENTCNT = 0x40045200 const RNDGETENTCNT = 0x40045200
......
...@@ -105,7 +105,7 @@ type Stat_t struct { ...@@ -105,7 +105,7 @@ type Stat_t struct {
Mode uint32 Mode uint32
Uid uint32 Uid uint32
Gid uint32 Gid uint32
X__pad2 int32 _ int32
Rdev uint64 Rdev uint64
Size int64 Size int64
Blksize int64 Blksize int64
...@@ -134,9 +134,9 @@ type Statfs_t struct { ...@@ -134,9 +134,9 @@ type Statfs_t struct {
} }
type StatxTimestamp struct { type StatxTimestamp struct {
Sec int64 Sec int64
Nsec uint32 Nsec uint32
X__reserved int32 _ int32
} }
type Statx_t struct { type Statx_t struct {
...@@ -173,7 +173,7 @@ type Dirent struct { ...@@ -173,7 +173,7 @@ type Dirent struct {
} }
type Fsid struct { type Fsid struct {
X__val [2]int32 _ [2]int32
} }
type Flock_t struct { type Flock_t struct {
...@@ -589,12 +589,12 @@ type RtAttr struct { ...@@ -589,12 +589,12 @@ type RtAttr struct {
} }
type IfInfomsg struct { type IfInfomsg struct {
Family uint8 Family uint8
X__ifi_pad uint8 _ uint8
Type uint16 Type uint16
Index int32 Index int32
Flags uint32 Flags uint32
Change uint32 Change uint32
} }
type IfAddrmsg struct { type IfAddrmsg struct {
...@@ -686,7 +686,7 @@ type Sysinfo_t struct { ...@@ -686,7 +686,7 @@ type Sysinfo_t struct {
Totalhigh uint64 Totalhigh uint64
Freehigh uint64 Freehigh uint64
Unit uint32 Unit uint32
X_f [0]uint8 _ [0]uint8
_ [4]byte _ [4]byte
} }
...@@ -709,10 +709,10 @@ type Ustat_t struct { ...@@ -709,10 +709,10 @@ type Ustat_t struct {
} }
type EpollEvent struct { type EpollEvent struct {
Events uint32 Events uint32
X_padFd int32 _ int32
Fd int32 Fd int32
Pad int32 Pad int32
} }
const ( const (
...@@ -746,7 +746,7 @@ const ( ...@@ -746,7 +746,7 @@ const (
) )
type Sigset_t struct { type Sigset_t struct {
X__val [16]uint64 _ [16]uint64
} }
const RNDGETENTCNT = 0x40045200 const RNDGETENTCNT = 0x40045200
......
...@@ -105,7 +105,7 @@ type Stat_t struct { ...@@ -105,7 +105,7 @@ type Stat_t struct {
Mode uint32 Mode uint32
Uid uint32 Uid uint32
Gid uint32 Gid uint32
X__pad2 int32 _ int32
Rdev uint64 Rdev uint64
Size int64 Size int64
Blksize int64 Blksize int64
...@@ -134,9 +134,9 @@ type Statfs_t struct { ...@@ -134,9 +134,9 @@ type Statfs_t struct {
} }
type StatxTimestamp struct { type StatxTimestamp struct {
Sec int64 Sec int64
Nsec uint32 Nsec uint32
X__reserved int32 _ int32
} }
type Statx_t struct { type Statx_t struct {
...@@ -173,7 +173,7 @@ type Dirent struct { ...@@ -173,7 +173,7 @@ type Dirent struct {
} }
type Fsid struct { type Fsid struct {
X__val [2]int32 _ [2]int32
} }
type Flock_t struct { type Flock_t struct {
...@@ -589,12 +589,12 @@ type RtAttr struct { ...@@ -589,12 +589,12 @@ type RtAttr struct {
} }
type IfInfomsg struct { type IfInfomsg struct {
Family uint8 Family uint8
X__ifi_pad uint8 _ uint8
Type uint16 Type uint16
Index int32 Index int32
Flags uint32 Flags uint32
Change uint32 Change uint32
} }
type IfAddrmsg struct { type IfAddrmsg struct {
...@@ -686,7 +686,7 @@ type Sysinfo_t struct { ...@@ -686,7 +686,7 @@ type Sysinfo_t struct {
Totalhigh uint64 Totalhigh uint64
Freehigh uint64 Freehigh uint64
Unit uint32 Unit uint32
X_f [0]uint8 _ [0]uint8
_ [4]byte _ [4]byte
} }
...@@ -709,10 +709,10 @@ type Ustat_t struct { ...@@ -709,10 +709,10 @@ type Ustat_t struct {
} }
type EpollEvent struct { type EpollEvent struct {
Events uint32 Events uint32
X_padFd int32 _ int32
Fd int32 Fd int32
Pad int32 Pad int32
} }
const ( const (
...@@ -746,7 +746,7 @@ const ( ...@@ -746,7 +746,7 @@ const (
) )
type Sigset_t struct { type Sigset_t struct {
X__val [16]uint64 _ [16]uint64
} }
const RNDGETENTCNT = 0x40045200 const RNDGETENTCNT = 0x40045200
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment