1
2
3
4
5 package oshi.driver.linux.proc;
6
7 import java.nio.ByteBuffer;
8 import java.util.HashMap;
9 import java.util.Map;
10
11 import oshi.annotation.concurrent.ThreadSafe;
12 import oshi.util.FileUtil;
13 import oshi.util.platform.linux.ProcPath;
14
15
16
17
18 @ThreadSafe
19 public final class Auxv {
20
21 private Auxv() {
22 }
23
24 public static final int AT_PAGESZ = 6;
25 public static final int AT_HWCAP = 16;
26 public static final int AT_CLKTCK = 17;
27
28
29
30
31
32
33
34 public static Map<Integer, Long> queryAuxv() {
35 ByteBuffer buff = FileUtil.readAllBytesAsBuffer(ProcPath.AUXV);
36 Map<Integer, Long> auxvMap = new HashMap<>();
37 int key;
38 do {
39 key = FileUtil.readNativeLongFromBuffer(buff).intValue();
40 if (key > 0) {
41 auxvMap.put(key, FileUtil.readNativeLongFromBuffer(buff).longValue());
42 }
43 } while (key > 0);
44 return auxvMap;
45
46 }
47 }