Просмотр исходного кода

unix: re-export Fsid and Sigset_t Val member on Linux

As spotted by Brad Fitzpatrick, CL 106838 unexported the value field of
Fsid and Sigset_t, but these types would be useless without any exported
fields. Re-export them via an exception in mkpost.go

Change-Id: I30d3c3b81c8c1b6377f8aa55cad816e3486a4395
Reviewed-on: https://go-review.googlesource.com/107415
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Tobias Klauser 7 лет назад
Родитель
Сommit
b126b21c05

+ 4 - 0
unix/mkpost.go

@@ -42,6 +42,10 @@ func main() {
 		log.Fatal(err)
 	}
 
+	// Intentionally export __val fields in Fsid and Sigset_t
+	valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__val(\s+\S+\s+)}`)
+	b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$3}"))
+
 	// If we have empty Ptrace structs, we should delete them. Only s390x emits
 	// nonempty Ptrace structs.
 	ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`)

+ 2 - 2
unix/ztypes_linux_386.go

@@ -171,7 +171,7 @@ type Dirent struct {
 }
 
 type Fsid struct {
-	_ [2]int32
+	Val [2]int32
 }
 
 type Flock_t struct {
@@ -739,7 +739,7 @@ const (
 )
 
 type Sigset_t struct {
-	_ [32]uint32
+	Val [32]uint32
 }
 
 const RNDGETENTCNT = 0x80045200

+ 2 - 2
unix/ztypes_linux_amd64.go

@@ -171,7 +171,7 @@ type Dirent struct {
 }
 
 type Fsid struct {
-	_ [2]int32
+	Val [2]int32
 }
 
 type Flock_t struct {
@@ -757,7 +757,7 @@ const (
 )
 
 type Sigset_t struct {
-	_ [16]uint64
+	Val [16]uint64
 }
 
 const RNDGETENTCNT = 0x80045200

+ 2 - 2
unix/ztypes_linux_arm.go

@@ -173,7 +173,7 @@ type Dirent struct {
 }
 
 type Fsid struct {
-	_ [2]int32
+	Val [2]int32
 }
 
 type Flock_t struct {
@@ -728,7 +728,7 @@ const (
 )
 
 type Sigset_t struct {
-	_ [32]uint32
+	Val [32]uint32
 }
 
 const RNDGETENTCNT = 0x80045200

+ 2 - 2
unix/ztypes_linux_arm64.go

@@ -172,7 +172,7 @@ type Dirent struct {
 }
 
 type Fsid struct {
-	_ [2]int32
+	Val [2]int32
 }
 
 type Flock_t struct {
@@ -736,7 +736,7 @@ const (
 )
 
 type Sigset_t struct {
-	_ [16]uint64
+	Val [16]uint64
 }
 
 const RNDGETENTCNT = 0x80045200

+ 2 - 2
unix/ztypes_linux_mips.go

@@ -172,7 +172,7 @@ type Dirent struct {
 }
 
 type Fsid struct {
-	_ [2]int32
+	Val [2]int32
 }
 
 type Flock_t struct {
@@ -733,7 +733,7 @@ const (
 )
 
 type Sigset_t struct {
-	_ [32]uint32
+	Val [32]uint32
 }
 
 const RNDGETENTCNT = 0x40045200

+ 2 - 2
unix/ztypes_linux_mips64.go

@@ -172,7 +172,7 @@ type Dirent struct {
 }
 
 type Fsid struct {
-	_ [2]int32
+	Val [2]int32
 }
 
 type Flock_t struct {
@@ -738,7 +738,7 @@ const (
 )
 
 type Sigset_t struct {
-	_ [16]uint64
+	Val [16]uint64
 }
 
 const RNDGETENTCNT = 0x40045200

+ 2 - 2
unix/ztypes_linux_mips64le.go

@@ -172,7 +172,7 @@ type Dirent struct {
 }
 
 type Fsid struct {
-	_ [2]int32
+	Val [2]int32
 }
 
 type Flock_t struct {
@@ -738,7 +738,7 @@ const (
 )
 
 type Sigset_t struct {
-	_ [16]uint64
+	Val [16]uint64
 }
 
 const RNDGETENTCNT = 0x40045200

+ 2 - 2
unix/ztypes_linux_mipsle.go

@@ -172,7 +172,7 @@ type Dirent struct {
 }
 
 type Fsid struct {
-	_ [2]int32
+	Val [2]int32
 }
 
 type Flock_t struct {
@@ -733,7 +733,7 @@ const (
 )
 
 type Sigset_t struct {
-	_ [32]uint32
+	Val [32]uint32
 }
 
 const RNDGETENTCNT = 0x40045200

+ 2 - 2
unix/ztypes_linux_ppc64.go

@@ -173,7 +173,7 @@ type Dirent struct {
 }
 
 type Fsid struct {
-	_ [2]int32
+	Val [2]int32
 }
 
 type Flock_t struct {
@@ -746,7 +746,7 @@ const (
 )
 
 type Sigset_t struct {
-	_ [16]uint64
+	Val [16]uint64
 }
 
 const RNDGETENTCNT = 0x40045200

+ 2 - 2
unix/ztypes_linux_ppc64le.go

@@ -173,7 +173,7 @@ type Dirent struct {
 }
 
 type Fsid struct {
-	_ [2]int32
+	Val [2]int32
 }
 
 type Flock_t struct {
@@ -746,7 +746,7 @@ const (
 )
 
 type Sigset_t struct {
-	_ [16]uint64
+	Val [16]uint64
 }
 
 const RNDGETENTCNT = 0x40045200

+ 2 - 2
unix/ztypes_linux_s390x.go

@@ -172,7 +172,7 @@ type Dirent struct {
 }
 
 type Fsid struct {
-	_ [2]int32
+	Val [2]int32
 }
 
 type Flock_t struct {
@@ -763,7 +763,7 @@ const (
 )
 
 type Sigset_t struct {
-	_ [16]uint64
+	Val [16]uint64
 }
 
 const RNDGETENTCNT = 0x80045200