aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/defs_freebsd_arm.go
diff options
context:
space:
mode:
authorDavid NewHamlet <david@newhamlet.com>2017-03-11 09:13:20 +1300
committerIan Lance Taylor <iant@golang.org>2017-03-10 22:06:24 +0000
commite19f184b8f61529980c24973d5522dc67e3d8525 (patch)
tree253572abfe37550316bd052889ffca6644705e07 /src/runtime/defs_freebsd_arm.go
parent135ce43c8731506d541329a1dfea2c737c6dd0b1 (diff)
downloadgo-e19f184b8f61529980c24973d5522dc67e3d8525.tar.gz
go-e19f184b8f61529980c24973d5522dc67e3d8525.zip
runtime: use cpuset_getaffinity for runtime.NumCPU() on FreeBSD
In FreeBSD when run Go proc under a given sub-list of processors(e.g. 'cpuset -l 0 ./a.out' in multi-core system), runtime.NumCPU() still return all physical CPUs from sysctl hw.ncpu instead of account from sub-list. Fix by use syscall cpuset_getaffinity to account the number of sub-list. Fixes #15206 Change-Id: If87c4b620e870486efa100685db5debbf1210a5b Reviewed-on: https://go-review.googlesource.com/29341 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/defs_freebsd_arm.go')
-rw-r--r--src/runtime/defs_freebsd_arm.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/runtime/defs_freebsd_arm.go b/src/runtime/defs_freebsd_arm.go
index 8f85f17254..c8a198fb4a 100644
--- a/src/runtime/defs_freebsd_arm.go
+++ b/src/runtime/defs_freebsd_arm.go
@@ -6,6 +6,13 @@ package runtime
import "unsafe"
const (
+ _NBBY = 0x8
+ _CTL_MAXNAME = 0x18
+ _CPU_LEVEL_WHICH = 0x3
+ _CPU_WHICH_PID = 0x2
+)
+
+const (
_EINTR = 0x4
_EFAULT = 0xe