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
//! Partial port of `SolarisMachine.c` — the Solaris/illumos per-host
//! `Machine`.
//!
//! Ported here (operate on the base [`Machine`], so no unported substrate
//! is needed):
//! - `Machine_getCPUPhysicalCoreID` (`SolarisMachine.c:333`)
//! - `Machine_getCPUThreadIndex` (`SolarisMachine.c:339`)
//!
//! Still `todo!()` and blocked on unported substrate:
//! - `Machine_isCPUonline` reads `SolarisMachine.cpus[id + 1].online`, so it
//! needs the `SolarisMachine` struct modeled.
//! - the `SolarisMachine` struct plus `SolarisMachine_updateCPUcount` /
//! `_scanCPUTime` / `_scanMemoryInfo` / `_scanZfsArcstats` need `libkstat`
//! (`kstat_*`) FFI and the ZFS ARC kstats modeled.
//! - `Machine_scan` / `Machine_new` / `Machine_delete` additionally need
//! `Machine_init` / `Machine_done` (still stubs in `machine.rs`) and
//! `kstat_open`/`kstat_close` FFI.
use crateMachine;
/// TODO: port of `static void SolarisMachine_updateCPUcount(SolarisMachine*
/// this)` from `SolarisMachine.c:29`. Blocked: needs the `SolarisMachine`
/// struct and `sysconf(_SC_NPROCESSORS_*)`.
/// TODO: port of `static void SolarisMachine_scanCPUTime(Machine* super)` from
/// `SolarisMachine.c:71`. Blocked: needs the `SolarisMachine` struct and the
/// `libkstat` per-CPU `cpu_stat` scan.
/// TODO: port of `static void SolarisMachine_scanMemoryInfo(Machine* super)`
/// from `SolarisMachine.c:165`. Blocked: needs the `SolarisMachine` struct and
/// the `libkstat` `unix:0:system_pages` scan.
/// TODO: port of `static void SolarisMachine_scanZfsArcstats(Machine* super)`
/// from `SolarisMachine.c:234`. Blocked: needs the `SolarisMachine` struct and
/// the `libkstat` `zfs:0:arcstats` scan.
/// TODO: port of `void Machine_scan(Machine* super)` from
/// `SolarisMachine.c:283`. Blocked: needs the `SolarisMachine` scan helpers
/// above.
/// TODO: port of `Machine* Machine_new(UsersTable* usersTable, uid_t userId)`
/// from `SolarisMachine.c:292`. Blocked: needs `Machine_init` (stub in
/// `machine.rs`), the `SolarisMachine` struct and `kstat_open` FFI.
/// TODO: port of `void Machine_delete(Machine* super)` from
/// `SolarisMachine.c:313`. Blocked: needs `Machine_done` (stub in
/// `machine.rs`), the `SolarisMachine` struct and `kstat_close` FFI.
/// TODO: port of `bool Machine_isCPUonline(const Machine* super, unsigned int
/// id)` from `SolarisMachine.c:325`. Blocked: reads
/// `SolarisMachine.cpus[id + 1].online`, so it needs the `SolarisMachine`
/// struct modeled.
/// Port of `int Machine_getCPUPhysicalCoreID(const Machine* host, unsigned int
/// id)` (`SolarisMachine.c:333`).
/// Port of `int Machine_getCPUThreadIndex(const Machine* host, unsigned int
/// id)` (`SolarisMachine.c:339`).