diff options
Diffstat (limited to 'vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go')
-rw-r--r-- | vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go b/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go deleted file mode 100644 index 4cd64c7..0000000 --- a/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | // Copyright 2022 The Go Authors. All rights reserved. | ||
2 | // Use of this source code is governed by a BSD-style | ||
3 | // license that can be found in the LICENSE file. | ||
4 | |||
5 | //go:build linux && arm64 | ||
6 | |||
7 | package cpu | ||
8 | |||
9 | import ( | ||
10 | "errors" | ||
11 | "io" | ||
12 | "os" | ||
13 | "strings" | ||
14 | ) | ||
15 | |||
16 | func readLinuxProcCPUInfo() error { | ||
17 | f, err := os.Open("/proc/cpuinfo") | ||
18 | if err != nil { | ||
19 | return err | ||
20 | } | ||
21 | defer f.Close() | ||
22 | |||
23 | var buf [1 << 10]byte // enough for first CPU | ||
24 | n, err := io.ReadFull(f, buf[:]) | ||
25 | if err != nil && err != io.ErrUnexpectedEOF { | ||
26 | return err | ||
27 | } | ||
28 | in := string(buf[:n]) | ||
29 | const features = "\nFeatures : " | ||
30 | i := strings.Index(in, features) | ||
31 | if i == -1 { | ||
32 | return errors.New("no CPU features found") | ||
33 | } | ||
34 | in = in[i+len(features):] | ||
35 | if i := strings.Index(in, "\n"); i != -1 { | ||
36 | in = in[:i] | ||
37 | } | ||
38 | m := map[string]*bool{} | ||
39 | |||
40 | initOptions() // need it early here; it's harmless to call twice | ||
41 | for _, o := range options { | ||
42 | m[o.Name] = o.Feature | ||
43 | } | ||
44 | // The EVTSTRM field has alias "evstrm" in Go, but Linux calls it "evtstrm". | ||
45 | m["evtstrm"] = &ARM64.HasEVTSTRM | ||
46 | |||
47 | for _, f := range strings.Fields(in) { | ||
48 | if p, ok := m[f]; ok { | ||
49 | *p = true | ||
50 | } | ||
51 | } | ||
52 | return nil | ||
53 | } | ||