mirror of
https://github.com/golang/sys.git
synced 2026-02-08 11:46:04 +03:00
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:
committed by
Tobias Klauser
parent
f6f352972f
commit
2281fa97ef
@@ -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 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:]
|
||||
|
||||
@@ -96,24 +96,24 @@ type Rlimit struct {
|
||||
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 Statfs_t struct {
|
||||
}
|
||||
|
||||
type StatxTimestamp struct {
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
X__reserved int32
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
_ 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 {
|
||||
@@ -583,12 +583,12 @@ type RtAttr struct {
|
||||
}
|
||||
|
||||
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 @@ 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
|
||||
|
||||
@@ -105,7 +105,7 @@ type Stat_t struct {
|
||||
Mode uint32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
X__pad0 int32
|
||||
_ int32
|
||||
Rdev uint64
|
||||
Size int64
|
||||
Blksize int64
|
||||
@@ -132,9 +132,9 @@ type Statfs_t struct {
|
||||
}
|
||||
|
||||
type StatxTimestamp struct {
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
X__reserved int32
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
_ 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 {
|
||||
@@ -587,12 +587,12 @@ type RtAttr struct {
|
||||
}
|
||||
|
||||
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 @@ 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
|
||||
|
||||
@@ -96,25 +96,25 @@ type Rlimit struct {
|
||||
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 Statfs_t struct {
|
||||
}
|
||||
|
||||
type StatxTimestamp struct {
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
X__reserved int32
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
_ 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 {
|
||||
@@ -587,12 +587,12 @@ type RtAttr struct {
|
||||
}
|
||||
|
||||
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 @@ 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
|
||||
|
||||
@@ -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
|
||||
@@ -133,9 +133,9 @@ type Statfs_t struct {
|
||||
}
|
||||
|
||||
type StatxTimestamp struct {
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
X__reserved int32
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
_ 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 {
|
||||
@@ -588,12 +588,12 @@ type RtAttr struct {
|
||||
}
|
||||
|
||||
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 @@ 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
|
||||
|
||||
@@ -133,9 +133,9 @@ type Statfs_t struct {
|
||||
}
|
||||
|
||||
type StatxTimestamp struct {
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
X__reserved int32
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
_ 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 {
|
||||
@@ -586,12 +586,12 @@ type RtAttr struct {
|
||||
}
|
||||
|
||||
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 @@ 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
|
||||
|
||||
@@ -133,9 +133,9 @@ type Statfs_t struct {
|
||||
}
|
||||
|
||||
type StatxTimestamp struct {
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
X__reserved int32
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
_ 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 {
|
||||
@@ -588,12 +588,12 @@ type RtAttr struct {
|
||||
}
|
||||
|
||||
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 @@ 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
|
||||
|
||||
@@ -133,9 +133,9 @@ type Statfs_t struct {
|
||||
}
|
||||
|
||||
type StatxTimestamp struct {
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
X__reserved int32
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
_ 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 {
|
||||
@@ -588,12 +588,12 @@ type RtAttr struct {
|
||||
}
|
||||
|
||||
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 @@ 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
|
||||
|
||||
@@ -133,9 +133,9 @@ type Statfs_t struct {
|
||||
}
|
||||
|
||||
type StatxTimestamp struct {
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
X__reserved int32
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
_ 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 {
|
||||
@@ -586,12 +586,12 @@ type RtAttr struct {
|
||||
}
|
||||
|
||||
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 @@ 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
|
||||
|
||||
@@ -105,7 +105,7 @@ type Stat_t struct {
|
||||
Mode uint32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
X__pad2 int32
|
||||
_ int32
|
||||
Rdev uint64
|
||||
Size int64
|
||||
Blksize int64
|
||||
@@ -134,9 +134,9 @@ type Statfs_t struct {
|
||||
}
|
||||
|
||||
type StatxTimestamp struct {
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
X__reserved int32
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
_ 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 {
|
||||
@@ -589,12 +589,12 @@ type RtAttr struct {
|
||||
}
|
||||
|
||||
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 @@ type Sysinfo_t struct {
|
||||
Totalhigh uint64
|
||||
Freehigh uint64
|
||||
Unit uint32
|
||||
X_f [0]uint8
|
||||
_ [0]uint8
|
||||
_ [4]byte
|
||||
}
|
||||
|
||||
@@ -709,10 +709,10 @@ type Ustat_t struct {
|
||||
}
|
||||
|
||||
type EpollEvent struct {
|
||||
Events uint32
|
||||
X_padFd int32
|
||||
Fd int32
|
||||
Pad int32
|
||||
Events uint32
|
||||
_ int32
|
||||
Fd int32
|
||||
Pad int32
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -746,7 +746,7 @@ const (
|
||||
)
|
||||
|
||||
type Sigset_t struct {
|
||||
X__val [16]uint64
|
||||
_ [16]uint64
|
||||
}
|
||||
|
||||
const RNDGETENTCNT = 0x40045200
|
||||
|
||||
@@ -105,7 +105,7 @@ type Stat_t struct {
|
||||
Mode uint32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
X__pad2 int32
|
||||
_ int32
|
||||
Rdev uint64
|
||||
Size int64
|
||||
Blksize int64
|
||||
@@ -134,9 +134,9 @@ type Statfs_t struct {
|
||||
}
|
||||
|
||||
type StatxTimestamp struct {
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
X__reserved int32
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
_ 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 {
|
||||
@@ -589,12 +589,12 @@ type RtAttr struct {
|
||||
}
|
||||
|
||||
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 @@ type Sysinfo_t struct {
|
||||
Totalhigh uint64
|
||||
Freehigh uint64
|
||||
Unit uint32
|
||||
X_f [0]uint8
|
||||
_ [0]uint8
|
||||
_ [4]byte
|
||||
}
|
||||
|
||||
@@ -709,10 +709,10 @@ type Ustat_t struct {
|
||||
}
|
||||
|
||||
type EpollEvent struct {
|
||||
Events uint32
|
||||
X_padFd int32
|
||||
Fd int32
|
||||
Pad int32
|
||||
Events uint32
|
||||
_ int32
|
||||
Fd int32
|
||||
Pad int32
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -746,7 +746,7 @@ const (
|
||||
)
|
||||
|
||||
type Sigset_t struct {
|
||||
X__val [16]uint64
|
||||
_ [16]uint64
|
||||
}
|
||||
|
||||
const RNDGETENTCNT = 0x40045200
|
||||
|
||||
Reference in New Issue
Block a user