pub struct OpenFileList { /* private fields */ }Expand description
The descriptors of one process, as far as the listing cap allowed.
The fields are private because the two of them have an invariant: not_listed
is exactly the number of descriptors the cap left out, and a caller that could
set them independently could claim a complete listing of a process it truncated.
OpenFileList::listed is the only constructor, and it enforces both the cap
and the arithmetic.
Implementations§
Source§impl OpenFileList
impl OpenFileList
Sourcepub const MAX_LISTED: usize = 256
pub const MAX_LISTED: usize = 256
The largest number of descriptors any collector will list paths for.
Resolving a path costs one syscall per descriptor on both platforms — a
proc_pidfdinfo on macOS, a readlink on Linux — and a process can hold
tens of thousands, so §16.1’s “nothing unbounded” applies even on the
on-demand tier of §8.6. 256 was measured at 0.9 µs per descriptor on an M4
Pro (216 µs for the 244 vnodes of a 442-descriptor process), which bounds
the whole walk at well under a millisecond, and it is far more rows than the
overlay can show without scrolling for a while.
Sourcepub fn listed(entries: Vec<OpenFileEntry>, total: usize) -> Self
pub fn listed(entries: Vec<OpenFileEntry>, total: usize) -> Self
A listing of entries taken from a descriptor table of total entries.
entries is truncated to OpenFileList::MAX_LISTED and everything the cap
left out is counted, so the panel can say how many descriptors it did not
list rather than presenting a partial list as a complete one (§4).
Sourcepub fn entries(&self) -> &[OpenFileEntry]
pub fn entries(&self) -> &[OpenFileEntry]
The descriptors that were listed.
Sourcepub const fn not_listed(&self) -> u32
pub const fn not_listed(&self) -> u32
How many descriptors the cap left out.
Sourcepub const fn is_complete(&self) -> bool
pub const fn is_complete(&self) -> bool
Whether every descriptor was listed.
Trait Implementations§
Source§impl Clone for OpenFileList
impl Clone for OpenFileList
Source§fn clone(&self) -> OpenFileList
fn clone(&self) -> OpenFileList
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more