mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-31 14:26:40 -04:00
cpu: don't panic on error reading /proc/self/auxv
On Android /proc/self/auxv is not readable, leading to a panic in init. Instead of panic'ing in this case, introduce the Initialized global bool to report whether the CPU features were initialized i.e. /proc/self/auxv was successfullly read. Fixes golang/go#30413 Change-Id: Ib520f202990614a76bceb0bf9d19a88eadd13e10 Reviewed-on: https://go-review.googlesource.com/c/164057 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
775f8194d0
commit
92a0ff1e1e
@@ -9,6 +9,8 @@ package cpu
|
||||
const cacheLineSize = 64
|
||||
|
||||
func init() {
|
||||
Initialized = true
|
||||
|
||||
maxID, _, _, _ := cpuid(0, 0)
|
||||
|
||||
if maxID < 1 {
|
||||
|
||||
Reference in New Issue
Block a user