From efc864927f57fa1a4aa8d1f22e4071343f0b8cbb Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 10 Sep 2019 20:41:04 +0000 Subject: libgo: Solaris and x/sys/cpu compatibility fixes Restore Solaris compatibility fixes lost when internal/x/net/lif moved to golang.org/x/net/lif. Also fix the Makefile for x/net/lif and x/net/route. Change x/sys/cpu to get the cache line size from goarch.sh as the gofrontend version of internal/cpu does. Partially based on work by Rainer Orth. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194438 From-SVN: r275611 --- libgo/go/golang.org/x/net/lif/syscall.go | 14 +-- libgo/go/golang.org/x/net/lif/zsys_solaris.go | 101 ++++++++++++++++++++ .../go/golang.org/x/net/lif/zsys_solaris_amd64.go | 103 --------------------- libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go | 2 - libgo/go/golang.org/x/sys/cpu/cpu_arm.go | 9 -- libgo/go/golang.org/x/sys/cpu/cpu_linux_arm64.go | 2 - libgo/go/golang.org/x/sys/cpu/cpu_linux_ppc64x.go | 2 - libgo/go/golang.org/x/sys/cpu/cpu_linux_s390x.go | 2 - libgo/go/golang.org/x/sys/cpu/cpu_mips64x.go | 11 --- libgo/go/golang.org/x/sys/cpu/cpu_mipsx.go | 11 --- libgo/go/golang.org/x/sys/cpu/cpu_other_arm64.go | 11 --- libgo/go/golang.org/x/sys/cpu/cpu_wasm.go | 15 --- libgo/go/golang.org/x/sys/cpu/cpu_x86.go | 2 - libgo/go/runtime/os_solaris.go | 10 +- 14 files changed, 110 insertions(+), 185 deletions(-) create mode 100644 libgo/go/golang.org/x/net/lif/zsys_solaris.go delete mode 100644 libgo/go/golang.org/x/net/lif/zsys_solaris_amd64.go delete mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_arm.go delete mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_mips64x.go delete mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_mipsx.go delete mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_other_arm64.go delete mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_wasm.go (limited to 'libgo/go') diff --git a/libgo/go/golang.org/x/net/lif/syscall.go b/libgo/go/golang.org/x/net/lif/syscall.go index aadab2e..ea75414 100644 --- a/libgo/go/golang.org/x/net/lif/syscall.go +++ b/libgo/go/golang.org/x/net/lif/syscall.go @@ -11,18 +11,12 @@ import ( "unsafe" ) -//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" - -//go:linkname procIoctl libc_ioctl - -var procIoctl uintptr - -func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, uintptr, syscall.Errno) +//extern __go_ioctl_ptr +func libc_ioctl(int32, int32, unsafe.Pointer) int32 func ioctl(s, ioc uintptr, arg unsafe.Pointer) error { - _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procIoctl)), 3, s, ioc, uintptr(arg), 0, 0, 0) - if errno != 0 { - return error(errno) + if libc_ioctl(int32(s), int32(ioc), arg) < 0 { + return syscall.GetErrno() } return nil } diff --git a/libgo/go/golang.org/x/net/lif/zsys_solaris.go b/libgo/go/golang.org/x/net/lif/zsys_solaris.go new file mode 100644 index 0000000..0d9ed2f --- /dev/null +++ b/libgo/go/golang.org/x/net/lif/zsys_solaris.go @@ -0,0 +1,101 @@ +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs defs_solaris.go + +package lif + +import "unsafe" + +const ( + sysAF_UNSPEC = 0x0 + sysAF_INET = 0x2 + sysAF_INET6 = 0x1a + + sysSOCK_DGRAM = 0x1 +) + +type sockaddrStorage struct { + Family uint16 + X_ss_pad1 [6]int8 + X_ss_align float64 + X_ss_pad2 [240]int8 +} + +const ( + sysLIFC_NOXMIT = 0x1 + sysLIFC_EXTERNAL_SOURCE = 0x2 + sysLIFC_TEMPORARY = 0x4 + sysLIFC_ALLZONES = 0x8 + sysLIFC_UNDER_IPMP = 0x10 + sysLIFC_ENABLED = 0x20 + + sysSIOCGLIFADDR = -0x3f87968f + sysSIOCGLIFDSTADDR = -0x3f87968d + sysSIOCGLIFFLAGS = -0x3f87968b + sysSIOCGLIFMTU = -0x3f879686 + sysSIOCGLIFNETMASK = -0x3f879683 + sysSIOCGLIFMETRIC = -0x3f879681 + sysSIOCGLIFNUM = -0x3ff3967e + sysSIOCGLIFINDEX = -0x3f87967b + sysSIOCGLIFSUBNET = -0x3f879676 + sysSIOCGLIFLNKINFO = -0x3f879674 + sysSIOCGLIFCONF = -0x3fef965b + sysSIOCGLIFHWADDR = -0x3f879640 +) + +const ( + sysIFF_UP = 0x1 + sysIFF_BROADCAST = 0x2 + sysIFF_DEBUG = 0x4 + sysIFF_LOOPBACK = 0x8 + sysIFF_POINTOPOINT = 0x10 + sysIFF_NOTRAILERS = 0x20 + sysIFF_RUNNING = 0x40 + sysIFF_NOARP = 0x80 + sysIFF_PROMISC = 0x100 + sysIFF_ALLMULTI = 0x200 + sysIFF_INTELLIGENT = 0x400 + sysIFF_MULTICAST = 0x800 + sysIFF_MULTI_BCAST = 0x1000 + sysIFF_UNNUMBERED = 0x2000 + sysIFF_PRIVATE = 0x8000 +) + +const ( + sizeofLifnum = 0xc + sizeofLifreq = 0x178 + sizeofLifconf = 0x18 + sizeofLifIfinfoReq = 0x10 +) + +type lifnum struct { + Family uint16 + Flags int32 + Count int32 +} + +type lifreq struct { + Name [32]int8 + Lifru1 [4]byte + Type uint32 + Lifru [336]byte +} + +type lifconf struct { + Family uint16 + Flags int32 + Len int32 + Lifcu [unsafe.Sizeof(unsafe.Pointer(nil))]byte +} + +type lifIfinfoReq struct { + Maxhops uint8 + Reachtime uint32 + Reachretrans uint32 + Maxmtu uint32 +} + +const ( + sysIFT_IPV4 = 0xc8 + sysIFT_IPV6 = 0xc9 + sysIFT_6TO4 = 0xca +) diff --git a/libgo/go/golang.org/x/net/lif/zsys_solaris_amd64.go b/libgo/go/golang.org/x/net/lif/zsys_solaris_amd64.go deleted file mode 100644 index b5e999b..0000000 --- a/libgo/go/golang.org/x/net/lif/zsys_solaris_amd64.go +++ /dev/null @@ -1,103 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs defs_solaris.go - -package lif - -const ( - sysAF_UNSPEC = 0x0 - sysAF_INET = 0x2 - sysAF_INET6 = 0x1a - - sysSOCK_DGRAM = 0x1 -) - -type sockaddrStorage struct { - Family uint16 - X_ss_pad1 [6]int8 - X_ss_align float64 - X_ss_pad2 [240]int8 -} - -const ( - sysLIFC_NOXMIT = 0x1 - sysLIFC_EXTERNAL_SOURCE = 0x2 - sysLIFC_TEMPORARY = 0x4 - sysLIFC_ALLZONES = 0x8 - sysLIFC_UNDER_IPMP = 0x10 - sysLIFC_ENABLED = 0x20 - - sysSIOCGLIFADDR = -0x3f87968f - sysSIOCGLIFDSTADDR = -0x3f87968d - sysSIOCGLIFFLAGS = -0x3f87968b - sysSIOCGLIFMTU = -0x3f879686 - sysSIOCGLIFNETMASK = -0x3f879683 - sysSIOCGLIFMETRIC = -0x3f879681 - sysSIOCGLIFNUM = -0x3ff3967e - sysSIOCGLIFINDEX = -0x3f87967b - sysSIOCGLIFSUBNET = -0x3f879676 - sysSIOCGLIFLNKINFO = -0x3f879674 - sysSIOCGLIFCONF = -0x3fef965b - sysSIOCGLIFHWADDR = -0x3f879640 -) - -const ( - sysIFF_UP = 0x1 - sysIFF_BROADCAST = 0x2 - sysIFF_DEBUG = 0x4 - sysIFF_LOOPBACK = 0x8 - sysIFF_POINTOPOINT = 0x10 - sysIFF_NOTRAILERS = 0x20 - sysIFF_RUNNING = 0x40 - sysIFF_NOARP = 0x80 - sysIFF_PROMISC = 0x100 - sysIFF_ALLMULTI = 0x200 - sysIFF_INTELLIGENT = 0x400 - sysIFF_MULTICAST = 0x800 - sysIFF_MULTI_BCAST = 0x1000 - sysIFF_UNNUMBERED = 0x2000 - sysIFF_PRIVATE = 0x8000 -) - -const ( - sizeofLifnum = 0xc - sizeofLifreq = 0x178 - sizeofLifconf = 0x18 - sizeofLifIfinfoReq = 0x10 -) - -type lifnum struct { - Family uint16 - Pad_cgo_0 [2]byte - Flags int32 - Count int32 -} - -type lifreq struct { - Name [32]int8 - Lifru1 [4]byte - Type uint32 - Lifru [336]byte -} - -type lifconf struct { - Family uint16 - Pad_cgo_0 [2]byte - Flags int32 - Len int32 - Pad_cgo_1 [4]byte - Lifcu [8]byte -} - -type lifIfinfoReq struct { - Maxhops uint8 - Pad_cgo_0 [3]byte - Reachtime uint32 - Reachretrans uint32 - Maxmtu uint32 -} - -const ( - sysIFT_IPV4 = 0xc8 - sysIFT_IPV6 = 0xc9 - sysIFT_6TO4 = 0xca -) diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go b/libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go index be60272..b0ede11 100644 --- a/libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go +++ b/libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go @@ -6,8 +6,6 @@ package cpu -const cacheLineSize = 128 - const ( // getsystemcfg constants _SC_IMPL = 2 diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_arm.go b/libgo/go/golang.org/x/sys/cpu/cpu_arm.go deleted file mode 100644 index 7f2348b..0000000 --- a/libgo/go/golang.org/x/sys/cpu/cpu_arm.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2018 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 cpu - -const cacheLineSize = 32 - -func doinit() {} diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_linux_arm64.go b/libgo/go/golang.org/x/sys/cpu/cpu_linux_arm64.go index fa7fb1b..15a9b4a 100644 --- a/libgo/go/golang.org/x/sys/cpu/cpu_linux_arm64.go +++ b/libgo/go/golang.org/x/sys/cpu/cpu_linux_arm64.go @@ -4,8 +4,6 @@ package cpu -const cacheLineSize = 64 - // HWCAP/HWCAP2 bits. These are exposed by Linux. const ( hwcap_FP = 1 << 0 diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_linux_ppc64x.go b/libgo/go/golang.org/x/sys/cpu/cpu_linux_ppc64x.go index 6c8d975..99f8a63 100644 --- a/libgo/go/golang.org/x/sys/cpu/cpu_linux_ppc64x.go +++ b/libgo/go/golang.org/x/sys/cpu/cpu_linux_ppc64x.go @@ -7,8 +7,6 @@ package cpu -const cacheLineSize = 128 - // HWCAP/HWCAP2 bits. These are exposed by the kernel. const ( // ISA Level diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_linux_s390x.go b/libgo/go/golang.org/x/sys/cpu/cpu_linux_s390x.go index d579eae..b88d6b8 100644 --- a/libgo/go/golang.org/x/sys/cpu/cpu_linux_s390x.go +++ b/libgo/go/golang.org/x/sys/cpu/cpu_linux_s390x.go @@ -4,8 +4,6 @@ package cpu -const cacheLineSize = 256 - const ( // bit mask values from /usr/include/bits/hwcap.h hwcap_ZARCH = 2 diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_mips64x.go b/libgo/go/golang.org/x/sys/cpu/cpu_mips64x.go deleted file mode 100644 index f55e0c8..0000000 --- a/libgo/go/golang.org/x/sys/cpu/cpu_mips64x.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2018 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. - -// +build mips64 mips64le - -package cpu - -const cacheLineSize = 32 - -func doinit() {} diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_mipsx.go b/libgo/go/golang.org/x/sys/cpu/cpu_mipsx.go deleted file mode 100644 index cda87b1..0000000 --- a/libgo/go/golang.org/x/sys/cpu/cpu_mipsx.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2018 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. - -// +build mips mipsle - -package cpu - -const cacheLineSize = 32 - -func doinit() {} diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_other_arm64.go b/libgo/go/golang.org/x/sys/cpu/cpu_other_arm64.go deleted file mode 100644 index dd1e76d..0000000 --- a/libgo/go/golang.org/x/sys/cpu/cpu_other_arm64.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2019 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. - -// +build !linux,arm64 - -package cpu - -const cacheLineSize = 64 - -func doinit() {} diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_wasm.go b/libgo/go/golang.org/x/sys/cpu/cpu_wasm.go deleted file mode 100644 index bd9bbda..0000000 --- a/libgo/go/golang.org/x/sys/cpu/cpu_wasm.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2019 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. - -// +build wasm - -package cpu - -// We're compiling the cpu package for an unknown (software-abstracted) CPU. -// Make CacheLinePad an empty struct and hope that the usual struct alignment -// rules are good enough. - -const cacheLineSize = 0 - -func doinit() {} diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_x86.go b/libgo/go/golang.org/x/sys/cpu/cpu_x86.go index d70d317..6009379c7 100644 --- a/libgo/go/golang.org/x/sys/cpu/cpu_x86.go +++ b/libgo/go/golang.org/x/sys/cpu/cpu_x86.go @@ -6,8 +6,6 @@ package cpu -const cacheLineSize = 64 - func init() { Initialized = true diff --git a/libgo/go/runtime/os_solaris.go b/libgo/go/runtime/os_solaris.go index ea72393..63b5cd7 100644 --- a/libgo/go/runtime/os_solaris.go +++ b/libgo/go/runtime/os_solaris.go @@ -31,7 +31,7 @@ func sem_reltimedwait_np(sem *semt, timeout *timespec) int32 //go:nosplit func semacreate(mp *m) { - if mp.mos.waitsema != 0 { + if mp.waitsema != 0 { return } @@ -44,7 +44,7 @@ func semacreate(mp *m) { if sem_init(sem, 0, 0) != 0 { throw("sem_init") } - mp.mos.waitsema = uintptr(unsafe.Pointer(sem)) + mp.waitsema = uintptr(unsafe.Pointer(sem)) } //go:nosplit @@ -54,7 +54,7 @@ func semasleep(ns int64) int32 { var ts timespec ts.setNsec(ns) - if sem_reltimedwait_np((*semt)(unsafe.Pointer(_m_.mos.waitsema)), &ts) != 0 { + if sem_reltimedwait_np((*semt)(unsafe.Pointer(_m_.waitsema)), &ts) != 0 { err := errno() if err == _ETIMEDOUT || err == _EAGAIN || err == _EINTR { return -1 @@ -64,7 +64,7 @@ func semasleep(ns int64) int32 { return 0 } for { - r1 := sem_wait((*semt)(unsafe.Pointer(_m_.mos.waitsema))) + r1 := sem_wait((*semt)(unsafe.Pointer(_m_.waitsema))) if r1 == 0 { break } @@ -78,7 +78,7 @@ func semasleep(ns int64) int32 { //go:nosplit func semawakeup(mp *m) { - if sem_post((*semt)(unsafe.Pointer(mp.mos.waitsema))) != 0 { + if sem_post((*semt)(unsafe.Pointer(mp.waitsema))) != 0 { throw("sem_post") } } -- cgit v1.1