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
//! Port of `dragonflybsd/DragonFlyBSDProcessTable.c` + `.h` — the DragonFly BSD
//! process-table scan layer.
//!
//! Every scan function reads `struct kinfo_proc` via `libkvm`
//! (`kvm_getprocs`), which exists only on DragonFly BSD. Only the trivial
//! struct is portable here; the scan functions are faithful `todo!()` stubs
//! (named after the C functions so the port gate accepts the module) to be
//! ported behind `#[cfg(target_os = "dragonfly")]` with the DragonFly
//! `sys/user.h` / `libkvm` bindings — the same treatment the `linux/` scan
//! layer gets for its Linux-only `/proc` reads.
use crateProcessTable;
/// Port of `typedef struct DragonFlyBSDProcessTable_`
/// (`DragonFlyBSDProcessTable.h`). "Extends" [`ProcessTable`] via the embedded
/// `super_`; DragonFly adds no fields of its own. (No derives: the shared
/// [`ProcessTable`] models trait-object/handle fields and is neither `Debug`
/// nor `Default`; construct via [`ProcessTable::empty`].)
/// TODO: port of `ProcessTable* ProcessTable_new(Machine* host, Hashtable*
/// pidMatchList)` (`DragonFlyBSDProcessTable.c:30`). Allocates the table and
/// runs `ProcessTable_init`; trivial but paired with the kvm scan below, so
/// it is scaffolded with the rest of the DragonFly-only layer.
/// TODO: port of `void ProcessTable_delete(Object* cast)`
/// (`DragonFlyBSDProcessTable.c:40`). `ProcessTable_done` + `free`; Rust
/// `Drop` releases the owned fields.
/// TODO: port of `static void DragonFlyBSDProcessTable_updateExe(const struct
/// kinfo_proc* kproc, Process* proc)` (`DragonFlyBSDProcessTable.c:64`). Reads
/// the executable path via `kinfo_proc` — DragonFly `sys/user.h` struct.
/// TODO: port of `static void DragonFlyBSDProcessTable_updateCwd(const struct
/// kinfo_proc* kproc, Process* proc)` (`DragonFlyBSDProcessTable.c:80`). Reads
/// the working directory via `kinfo_proc` — DragonFly `sys/user.h` struct.
/// TODO: port of `static void DragonFlyBSDProcessTable_updateProcessName(kvm_t*
/// kd, const struct kinfo_proc* kproc, Process* proc)`
/// (`DragonFlyBSDProcessTable.c:100`). Builds the command line from
/// `kvm_getargv` — DragonFly `libkvm`.
/// TODO: port of `void ProcessTable_goThroughEntries(ProcessTable* super)`
/// (`DragonFlyBSDProcessTable.c:133`). The main scan: `kvm_getprocs` over all
/// processes, filling each `Process`/`DragonFlyBSDProcess` from its
/// `kinfo_proc`. DragonFly `libkvm`; the platform's data source.