Skip to content

Commit

Permalink
Rollup merge of rust-lang#87594 - devnexen:netbsd_fs_getfiledescripto…
Browse files Browse the repository at this point in the history
…r_path, r=joshtriplett

fs File get_path procfs usage for netbsd same as linux.
  • Loading branch information
JohnTitor committed Jul 30, 2021
2 parents 6e61383 + ce1bd70 commit 0180d4c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions library/std/src/sys/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ impl FromInner<c_int> for File {

impl fmt::Debug for File {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "netbsd"))]
fn get_path(fd: c_int) -> Option<PathBuf> {
let mut p = PathBuf::from("/proc/self/fd");
p.push(&fd.to_string());
Expand Down Expand Up @@ -976,7 +976,12 @@ impl fmt::Debug for File {
Some(PathBuf::from(OsString::from_vec(buf)))
}

#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "vxworks")))]
#[cfg(not(any(
target_os = "linux",
target_os = "macos",
target_os = "vxworks",
target_os = "netbsd"
)))]
fn get_path(_fd: c_int) -> Option<PathBuf> {
// FIXME(#24570): implement this for other Unix platforms
None
Expand Down

0 comments on commit 0180d4c

Please sign in to comment.