From 5f2b4f26aa3ae79e6cfd3bd397d586d5a3ed9fec Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 7 Jun 2018 12:17:40 +0200 Subject: [PATCH] runtime: remove unused darwinVersion and getDarwinVersion They are unused since CL 114799. Also remove consts _CTL_KERN and _KERN_OSRELEASE previously used by getDarwinVersion. Change-Id: I51b701e8effbe4dd4301b0e6d52e8885469032f4 Reviewed-on: https://go-review.googlesource.com/116955 Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/runtime/os_darwin.go | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go index 52153055f0..55f938cd80 100644 --- a/src/runtime/os_darwin.go +++ b/src/runtime/os_darwin.go @@ -11,8 +11,6 @@ type mOS struct { waitsema uint32 // semaphore for parking on locks } -var darwinVersion int - //go:noescape func mach_msg_trap(h unsafe.Pointer, op int32, send_size, rcv_size, rcv_name, timeout, notify uint32) int32 @@ -50,34 +48,14 @@ func osinit() { ncpu = getncpu() physPageSize = getPageSize() - darwinVersion = getDarwinVersion() } const ( - _CTL_KERN = 1 - _CTL_HW = 6 - _KERN_OSRELEASE = 2 - _HW_NCPU = 3 - _HW_PAGESIZE = 7 + _CTL_HW = 6 + _HW_NCPU = 3 + _HW_PAGESIZE = 7 ) -func getDarwinVersion() int { - // Use sysctl to fetch kern.osrelease - mib := [2]uint32{_CTL_KERN, _KERN_OSRELEASE} - var out [32]byte - nout := unsafe.Sizeof(out) - ret := sysctl(&mib[0], 2, (*byte)(unsafe.Pointer(&out)), &nout, nil, 0) - if ret >= 0 { - ver := 0 - for i := 0; i < int(nout) && out[i] >= '0' && out[i] <= '9'; i++ { - ver *= 10 - ver += int(out[i] - '0') - } - return ver - } - return 17 // should not happen: default to a newish version -} - func getncpu() int32 { // Use sysctl to fetch hw.ncpu. mib := [2]uint32{_CTL_HW, _HW_NCPU} -- 2.50.0