mirror of https://github.com/golang/go.git
Merge 9a9c35b386 into 49cdf0c42e
This commit is contained in:
commit
2ac9b2d3b0
|
|
@ -5,6 +5,7 @@
|
||||||
package routebsd
|
package routebsd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"internal/stringslite"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
@ -25,27 +26,10 @@ func probeRoutingStack() (int, map[int]*wireFormat) {
|
||||||
// to know the underlying kernel's architecture because the
|
// to know the underlying kernel's architecture because the
|
||||||
// alignment for routing facilities are set at the build time
|
// alignment for routing facilities are set at the build time
|
||||||
// of the kernel.
|
// of the kernel.
|
||||||
conf, _ := syscall.Sysctl("kern.conftxt")
|
arches, _ := syscall.Sysctl("hw.supported_archs")
|
||||||
for i, j := 0, 0; j < len(conf); j++ {
|
if stringslite.Index(arches, "amd64") >= 0 {
|
||||||
if conf[j] != '\n' {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
s := conf[i:j]
|
|
||||||
i = j + 1
|
|
||||||
if len(s) > len("machine") && s[:len("machine")] == "machine" {
|
|
||||||
s = s[len("machine"):]
|
|
||||||
for k := 0; k < len(s); k++ {
|
|
||||||
if s[k] == ' ' || s[k] == '\t' {
|
|
||||||
s = s[1:]
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if s == "amd64" {
|
|
||||||
align = 8
|
align = 8
|
||||||
}
|
}
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ifm := &wireFormat{extOff: 16, bodyOff: sizeofIfMsghdr}
|
ifm := &wireFormat{extOff: 16, bodyOff: sizeofIfMsghdr}
|
||||||
ifm.parse = ifm.parseInterfaceMessage
|
ifm.parse = ifm.parseInterfaceMessage
|
||||||
ifam := &wireFormat{extOff: syscall.SizeofIfaMsghdr, bodyOff: syscall.SizeofIfaMsghdr}
|
ifam := &wireFormat{extOff: syscall.SizeofIfaMsghdr, bodyOff: syscall.SizeofIfaMsghdr}
|
||||||
|
|
|
||||||
|
|
@ -4,28 +4,21 @@
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
import "unsafe"
|
import (
|
||||||
|
"internal/stringslite"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
conf, _ := Sysctl("kern.conftxt")
|
machine, _ := Sysctl("hw.machine")
|
||||||
for i, j := 0, 0; j < len(conf); j++ {
|
if machine == "i386" {
|
||||||
if conf[j] != '\n' {
|
arches, _ := Sysctl("hw.supported_archs")
|
||||||
continue
|
amd64 := "amd64"
|
||||||
}
|
if stringslite.Index(arches, amd64) >= 0 {
|
||||||
s := conf[i:j]
|
machine = amd64
|
||||||
i = j + 1
|
|
||||||
if len(s) > len("machine") && s[:len("machine")] == "machine" {
|
|
||||||
s = s[len("machine"):]
|
|
||||||
for k := 0; k < len(s); k++ {
|
|
||||||
if s[k] == ' ' || s[k] == '\t' {
|
|
||||||
s = s[1:]
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
freebsdConfArch = s
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
freebsdConfArch = machine
|
||||||
}
|
}
|
||||||
|
|
||||||
func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage {
|
func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue