1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//! Partial port of `NetBSDMachine.c` — the NetBSD per-host `Machine`.
//!
//! Ported here (operate on the base [`Machine`], so no unported substrate
//! is needed):
//! - `Machine_isCPUonline` (`NetBSDMachine.c:287`)
//! - `Machine_getCPUPhysicalCoreID` (`NetBSDMachine.c:295`)
//! - `Machine_getCPUThreadIndex` (`NetBSDMachine.c:301`)
//!
//! Still `todo!()` and blocked on unported substrate:
//! - the `NetBSDMachine` struct plus `NetBSDMachine_updateCPUcount` /
//! `_scanMemoryInfo` / `_scanCPUTime` / `_scanCPUFrequency` /
//! `getKernelCPUTimes` / `kernelCPUTimesToHtop` need the per-CPU
//! `kern.cp_time` sysctl scan and `uvmexp` modeled.
//! - `Machine_scan` / `Machine_new` / `Machine_delete` additionally need
//! `Machine_init` / `Machine_done` (still stubs in `machine.rs`) and
//! `kvm_openfiles`/`kvm_close` FFI.
use crateMachine;
/// TODO: port of `static void NetBSDMachine_updateCPUcount(NetBSDMachine*
/// this)` from `NetBSDMachine.c:51`. Blocked: needs the `NetBSDMachine` struct
/// and the `hw.ncpu`/`hw.ncpuonline` sysctls.
/// TODO: port of `Machine* Machine_new(UsersTable* usersTable, uid_t userId)`
/// from `NetBSDMachine.c:105`. Blocked: needs `Machine_init` (stub in
/// `machine.rs`), the `NetBSDMachine` struct and `kvm_openfiles` FFI.
/// TODO: port of `void Machine_delete(Machine* super)` from
/// `NetBSDMachine.c:135`. Blocked: needs `Machine_done` (stub in
/// `machine.rs`), the `NetBSDMachine` struct and `kvm_close` FFI.
/// TODO: port of `static void NetBSDMachine_scanMemoryInfo(Machine* super)`
/// from `NetBSDMachine.c:147`. Blocked: needs the `NetBSDMachine` struct and
/// the `uvmexp`/`VM_UVMEXP2` sysctl scan.
/// TODO: port of `static void getKernelCPUTimes(int cpuId, uint64_t* times)`
/// from `NetBSDMachine.c:172`. Blocked: needs the per-CPU `kern.cp_time`
/// sysctl scan.
/// TODO: port of `static void kernelCPUTimesToHtop(const uint64_t* times,
/// CPUData* cpu)` from `NetBSDMachine.c:180`. Blocked: needs the
/// `NetBSDMachine` `CPUData` struct.
/// TODO: port of `static void NetBSDMachine_scanCPUTime(NetBSDMachine* this)`
/// from `NetBSDMachine.c:205`. Blocked: needs the `NetBSDMachine` scan helpers
/// above.
/// TODO: port of `static void NetBSDMachine_scanCPUFrequency(NetBSDMachine*
/// this)` from `NetBSDMachine.c:230`. Blocked: needs the `NetBSDMachine`
/// struct and the `machdep.*.frequency.current` sysctl.
/// TODO: port of `void Machine_scan(Machine* super)` from
/// `NetBSDMachine.c:276`. Blocked: needs the `NetBSDMachine` scan helpers
/// above.
/// Port of `bool Machine_isCPUonline(const Machine* host, unsigned int id)`
/// (`NetBSDMachine.c:287`). NetBSD detection of online/offline CPUs is not yet
/// supported, so every existing CPU reports online.
/// Port of `int Machine_getCPUPhysicalCoreID(const Machine* host, unsigned int
/// id)` (`NetBSDMachine.c:295`).
/// Port of `int Machine_getCPUThreadIndex(const Machine* host, unsigned int
/// id)` (`NetBSDMachine.c:301`).