pub enum OpenFileKind {
File,
Socket,
Pipe,
EventQueue,
SharedMemory,
Semaphore,
Unknown,
}Expand description
What kind of object a file descriptor refers to.
The set is the intersection of what both platforms can name from a single read:
macOS’ proc_fdtype values and the prefix of a /proc/<pid>/fd/<n> link
target. It exists because §4’s “unavailable is never an empty string” needs an
answer for a descriptor that has no path at all — a socket is not a nameless
file, it is a socket, and the kind is what says so.
Variants§
File
A file, directory, or device: something with a path in the filesystem.
Socket
A socket. Has no filesystem path unless it is a bound Unix socket, and neither platform reports that path through the descriptor table.
Pipe
A pipe or FIFO.
EventQueue
A kernel event queue: kqueue on macOS, epoll/eventfd/timerfd on
Linux.
POSIX shared memory.
Semaphore
A POSIX semaphore.
Unknown
The platform reported something we do not model.
Implementations§
Source§impl OpenFileKind
impl OpenFileKind
Sourcepub const fn label(self) -> &'static str
pub const fn label(self) -> &'static str
A lower-case label, in the same spirit as ProcessState::label.
Every label is strict 7-bit ASCII so it is legal in both glyph modes (§5.1).
Sourcepub const fn has_path(self) -> bool
pub const fn has_path(self) -> bool
Whether a descriptor of this kind can have a filesystem path at all.
The one thing that distinguishes “the OS refused the path” from “there is no
path to refuse”: a collector that cannot resolve a Self::File’s path has
hit a permission or read failure, while a Self::Socket’s path is
MetricState::Unsupported on every platform and always will be.
Trait Implementations§
Source§impl Clone for OpenFileKind
impl Clone for OpenFileKind
Source§fn clone(&self) -> OpenFileKind
fn clone(&self) -> OpenFileKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more