internal/socket: fix 386 emulation on amd64 for FreeBSD
Unlike routing messages, there's no need to tweak the alignment for
socket control messages on freebsd/386 emulation.
Change-Id: Iab4a2b05080868721f7e42cebd661d445f8c1030
Reviewed-on: https://go-review.googlesource.com/44391
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/internal/socket/sys_bsdvar.go b/internal/socket/sys_bsdvar.go
index eb89a60..f723fa3 100644
--- a/internal/socket/sys_bsdvar.go
+++ b/internal/socket/sys_bsdvar.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build netbsd openbsd
+// +build freebsd netbsd openbsd
package socket
diff --git a/internal/socket/sys_freebsd.go b/internal/socket/sys_freebsd.go
deleted file mode 100644
index 0f8a5b6..0000000
--- a/internal/socket/sys_freebsd.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package socket
-
-import (
- "syscall"
- "unsafe"
-)
-
-func probeProtocolStack() int {
- var p uintptr
- align := int(unsafe.Sizeof(p))
- // In the case of kern.supported_archs="amd64 i386", we need
- // to know the underlying kernel's architecture because the
- // alignment for socket facilities are set at the build time
- // of the kernel.
- conf, _ := syscall.Sysctl("kern.conftxt")
- for i, j := 0, 0; j < len(conf); j++ {
- 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
- }
- break
- }
- }
- return align
-}