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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
//! [`MemberInfo`] — an enriched, point-in-time snapshot of one process in a
//! [`ProcessGroup`](crate::ProcessGroup)'s tree.
use ;
/// An enriched snapshot of one member of a [`ProcessGroup`](crate::ProcessGroup)
/// — its pid plus best-effort metadata (parent pid, image name, start time).
///
/// Produced two ways, both filling the same fields the same way: by
/// [`ProcessGroup::members_info`](crate::ProcessGroup::members_info) — the
/// metadata-carrying companion to [`members`](crate::ProcessGroup::members) (which
/// returns bare pids) — for a *member* of a group, and by the free-standing
/// [`process_info`](crate::process_info) query for an **arbitrary** pid the caller
/// holds *outside* any group. From `members_info`, *which* processes appear follows
/// the **same** platform matrix as `members` — the whole tree on Windows and
/// Linux-cgroup, the tracked group *leaders* on the POSIX process-group fallback
/// (macOS/BSD and Linux without a usable cgroup). The enriching fields beyond
/// [`pid`](Self::pid) are each independently `Option` and are `None` wherever the
/// platform can't report them — never a fabricated value.
///
/// # Field availability by platform
///
/// | field | Windows | Linux (cgroup / fallback) | macOS | the BSDs |
/// |------------------------------|---------|---------------------------|--------|----------|
/// | [`pid`](Self::pid) | yes | yes | yes | yes |
/// | [`ppid`](Self::ppid) | yes | yes | yes | `None` |
/// | [`exe_name`](Self::exe_name) | yes | yes | yes | `None` |
/// | [`start_time`](Self::start_time) | yes | yes | yes | `None` |
///
/// On the "bare" BSDs the crate wires up no per-process introspection (see the
/// note on [`start_time`](Self::start_time) for why), so every enriching field is
/// honestly `None` while the pid is still reported — that is a correct result, not
/// an error.
///
/// # No command line
///
/// The raw argv / environment of a member is **deliberately never** included, on
/// any platform: a command line routinely carries secrets, and redaction or
/// hashing is a policy the *consumer* must own — the same "never log argv/env"
/// stance the crate takes in its `tracing` output. This will not change.
///
/// # Racing a member that exits
///
/// The list is a point-in-time snapshot taken per pid: if a process exits between
/// when its pid is enumerated and when its metadata is read, that pid is simply
/// **omitted** from the returned `Vec` — a vanished member is never reported with
/// fabricated fields, and its disappearance never fails the whole call. See
/// [`ProcessGroup::members_info`](crate::ProcessGroup::members_info) for the exact
/// error contract.
///
/// Non-exhaustive and accessor-only: a read-only snapshot the crate produces, so
/// new metadata can be added without a breaking change, and each field is exposed
/// through a method — documenting its own platform caveats — rather than a public
/// struct field.
/// *(feature `report-serde`)* The snapshot, field for field:
///
/// ```json
/// {"pid": 4242, "ppid": 1, "exe_name": "worker", "start_time": 8407251}
/// ```
///
/// Each enriching field is `null` exactly where the platform could not report
/// it (see the field-availability matrix above) — never a fabricated value —
/// and the type's **"No command line"** rule reaches the wire form unchanged:
/// there is no argv/environment key here, on any platform, for the same reason
/// the crate never logs one.
///
/// `start_time` is the opaque platform token described on
/// [`start_time`](Self::start_time), serialized verbatim as the `u64` it is. On
/// Windows that token is a `FILETIME` well above `2^53`, so read it as an exact
/// integer (a JSON parser that decodes every number as a double will round it,
/// and this is a field compared for *equality*).