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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//! Port of `unsupported/Platform.c` — htop's portable fallback platform, used
//! when no OS-specific backend matches. Every hook returns a fixed/degenerate
//! value, so the whole file is self-contained (no platform FFI) and compiles
//! on every target.
//!
//! Ported here:
//! - `Platform_init` (`Platform.c:92`)
//! - `Platform_done` (`Platform.c:97`)
//! - `Platform_setBindings` (`Platform.c:101`)
//! - `Platform_getUptime` (`Platform.c:106`)
//! - `Platform_getLoadAverage` (`Platform.c:110`)
//! - `Platform_getMaxPid` (`Platform.c:116`)
//! - `Platform_getProcessEnv` (`Platform.c:144`)
//! - `Platform_getFileDescriptors` (`Platform.c:154`)
//! - `Platform_getDiskIO` (`Platform.c:159`)
//! - `Platform_getNetworkIO` (`Platform.c:164`)
//! - `Platform_getBattery` (`Platform.c:169`)
//! - `Platform_getHostname` (`Platform.c:174`)
//! - `Platform_getRelease` (`Platform.c:178`)
//!
//! Still `todo!()` and blocked on unported substrate:
//! - `Platform_setCPUValues` / `Platform_setMemoryValues` /
//! `Platform_setSwapValues` — write through `Meter::values` / `Meter::curItems`
//! on a meter whose `host` field (`meter.rs`) is typed as the concrete
//! `LinuxMachine`; the generic meter-setter surface is not yet modeled.
//! - `Platform_getProcessLocks` — `FileLocks_ProcessData` is unmodeled
//! (returns `NULL` unconditionally here).
use crateACPresence;
use crateDiskIOData;
use crateNetworkIOData;
use crateString_safeStrncpy;
/// The C file-`static const char Platform_unsupported[] = "unsupported"`
/// (`unsupported/Platform.c:90`).
const Platform_unsupported: &str = "unsupported";
/// Port of `bool Platform_init(void)` (`Platform.c:92`).
/// Port of `void Platform_done(void)` (`Platform.c:97`).
/// Port of `void Platform_setBindings(Htop_Action* keys)` (`Platform.c:101`).
/// Port of `int Platform_getUptime(void)` (`Platform.c:106`).
/// Port of `void Platform_getLoadAverage(double* one, double* five, double*
/// fifteen)` (`Platform.c:110`).
/// Port of `pid_t Platform_getMaxPid(void)` (`Platform.c:116`).
/// TODO: port of `double Platform_setCPUValues(Meter* this, unsigned int cpu)`
/// from `Platform.c:120`. Blocked: `Meter::host` typed as `LinuxMachine`; the
/// generic meter-setter surface is unmodeled.
/// TODO: port of `void Platform_setMemoryValues(Meter* this)` from
/// `Platform.c:132`. Blocked: `Meter::host` typed as `LinuxMachine`.
/// TODO: port of `void Platform_setSwapValues(Meter* this)` from
/// `Platform.c:140`. Blocked: `Meter::host` typed as `LinuxMachine`.
/// Port of `char* Platform_getProcessEnv(pid_t pid)` (`Platform.c:144`).
/// The fallback platform exposes no environment, so this is always `None`.
/// TODO: port of `FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid)`
/// from `Platform.c:149`. Blocked: `FileLocks_ProcessData` is unmodeled
/// (returns `NULL` unconditionally here).
/// Port of `void Platform_getFileDescriptors(double* used, double* max)`
/// (`Platform.c:154`). Fixed placeholder values on the fallback platform.
/// Port of `bool Platform_getDiskIO(DiskIOData* data)` (`Platform.c:159`).
/// Port of `bool Platform_getNetworkIO(NetworkIOData* data)`
/// (`Platform.c:164`).
/// Port of `void Platform_getBattery(double* percent, ACPresence* isOnAC)`
/// (`Platform.c:169`).
/// Port of `void Platform_getHostname(char* buffer, size_t size)`
/// (`Platform.c:174`). Writes the literal "unsupported".
/// Port of `const char* Platform_getRelease(void)` (`Platform.c:178`).