From 05aa5d4ee32165add31ddef9d5d3946713e5dc5e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 24 Sep 2020 16:08:54 +0200 Subject: [PATCH] internal/socket, route: drop support for pre-1.12 direct syscalls on darwin Go 1.12 and newer are using libSystem for syscalls on darwin. Go 1.11 is the last release to use direct syscalls. It hasn't been supported since the release of Go 1.13 in September 2019, so drop support for direct syscalls on darwin from golang.org/x/net. Change-Id: Ib53d64e8a6d12ad702951f8efc123ce92c01c4d9 Reviewed-on: https://go-review.googlesource.com/c/net/+/257057 Trust: Tobias Klauser Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor --- internal/socket/sys_go1_11_darwin.go | 33 ---------------------------- route/syscall_go1_11_darwin.go | 28 ----------------------- 2 files changed, 61 deletions(-) delete mode 100644 internal/socket/sys_go1_11_darwin.go delete mode 100644 route/syscall_go1_11_darwin.go diff --git a/internal/socket/sys_go1_11_darwin.go b/internal/socket/sys_go1_11_darwin.go deleted file mode 100644 index 02d2b3cc..00000000 --- a/internal/socket/sys_go1_11_darwin.go +++ /dev/null @@ -1,33 +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 !go1.12 - -package socket - -import ( - "syscall" - "unsafe" -) - -func getsockopt(s uintptr, level, name int, b []byte) (int, error) { - l := uint32(len(b)) - _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) - return int(l), errnoErr(errno) -} - -func setsockopt(s uintptr, level, name int, b []byte) error { - _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) - return errnoErr(errno) -} - -func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { - n, _, errno := syscall.Syscall(syscall.SYS_RECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) - return int(n), errnoErr(errno) -} - -func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { - n, _, errno := syscall.Syscall(syscall.SYS_SENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) - return int(n), errnoErr(errno) -} diff --git a/route/syscall_go1_11_darwin.go b/route/syscall_go1_11_darwin.go deleted file mode 100644 index 7228e443..00000000 --- a/route/syscall_go1_11_darwin.go +++ /dev/null @@ -1,28 +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 !go1.12 - -package route - -import ( - "syscall" - "unsafe" -) - -var zero uintptr - -func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error { - var p unsafe.Pointer - if len(mib) > 0 { - p = unsafe.Pointer(&mib[0]) - } else { - p = unsafe.Pointer(&zero) - } - _, _, errno := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(p), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), newlen) - if errno != 0 { - return error(errno) - } - return nil -}