Browse Source
Android on ChromeOS uses a restrictive seccomp filter that blocks sched_getaffinity. Simply assume 1 CPU on any error.android-5
Michael Marineau
8 years ago
committed by
Fredrik Fornwall
2 changed files with 15 additions and 0 deletions
@ -0,0 +1,14 @@ |
|||
diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go
|
|||
index 542f214..9151aff 100644
|
|||
--- a/src/runtime/os_linux.go
|
|||
+++ b/src/runtime/os_linux.go
|
|||
@@ -91,6 +91,9 @@ func getproccount() int32 {
|
|||
const maxCPUs = 64 * 1024 |
|||
var buf [maxCPUs / (sys.PtrSize * 8)]uintptr |
|||
r := sched_getaffinity(0, unsafe.Sizeof(buf), &buf[0]) |
|||
+ if r <= 0 {
|
|||
+ return 1
|
|||
+ }
|
|||
n := int32(0) |
|||
for _, v := range buf[:r/sys.PtrSize] { |
|||
for v != 0 { |
Loading…
Reference in new issue