Ver Fonte

unix: export FdSet bits field on freebsd

After CL 136816 the bits member of the FdSet struct is no longer
exported. Make sure to retain it in mkpost.go and rename it to Bits
as on all other systems.

Change-Id: I860b307a80c7e29b4a75d9d916d879ee0a31c014
Reviewed-on: https://go-review.googlesource.com/c/149897
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Tobias Klauser há 7 anos atrás
pai
commit
5ac8a444bd

+ 4 - 0
unix/mkpost.go

@@ -46,6 +46,10 @@ func main() {
 	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}"))
 
+	// Intentionally export __fds_bits field in FdSet
+	fdSetRegex := regexp.MustCompile(`type (FdSet) struct {(\s+)X__fds_bits(\s+\S+\s+)}`)
+	b = fdSetRegex.ReplaceAll(b, []byte("type $1 struct {${2}Bits$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*})`)

+ 1 - 1
unix/ztypes_freebsd_386.go

@@ -339,7 +339,7 @@ type Kevent_t struct {
 }
 
 type FdSet struct {
-	_ [32]uint32
+	Bits [32]uint32
 }
 
 const (

+ 1 - 1
unix/ztypes_freebsd_amd64.go

@@ -337,7 +337,7 @@ type Kevent_t struct {
 }
 
 type FdSet struct {
-	_ [16]uint64
+	Bits [16]uint64
 }
 
 const (

+ 1 - 1
unix/ztypes_freebsd_arm.go

@@ -337,7 +337,7 @@ type Kevent_t struct {
 }
 
 type FdSet struct {
-	_ [32]uint32
+	Bits [32]uint32
 }
 
 const (