Skip to main content

cat_plain_file_linux

Function cat_plain_file_linux 

Source
pub fn cat_plain_file_linux(path: &Path) -> Result<bool, CatPlainError>
Expand description

Zero-copy file→stdout on Linux using splice, copy_file_range, or fast read/write. Also performs directory check and input==output detection using the fstat results to avoid redundant syscalls in the caller.

Returns: Ok(true) — file was fully handled Ok(false) — caller should fall back to generic path Err(CatPlainError::IsDirectory) — path is a directory Err(CatPlainError::InputIsOutput) — input file is the same as stdout Err(CatPlainError::Io(e)) — I/O error