Sha256: 88e90b1ddef0a5e32eb24ad824580b62ab6b457b85d27d94038727739feabfb3
Contents?: true
Size: 717 Bytes
Versions: 39
Compression:
Stored size: 717 Bytes
Contents
use super::procfs::get_path_from_proc_self_fd; use std::fs; use std::path::PathBuf; pub(crate) fn file_path(file: &fs::File) -> Option<PathBuf> { use std::os::unix::fs::MetadataExt; // Ignore paths that don't start with '/', which are things like // `socket:[3556564]` or similar. let path = get_path_from_proc_self_fd(file) .ok() .filter(|path| path.starts_with("/"))?; // Linux appends the string " (deleted)" when a file is deleted; avoid // treating that as the actual name. Check this after doing the `readlink` // above so that we're conservative about concurrent deletions. if file.metadata().ok()?.nlink() == 0 { return None; } Some(path) }
Version data entries
39 entries across 39 versions & 1 rubygems