From ce1bd70035d594755c109ebb313b51becca73213 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Thu, 29 Jul 2021 17:49:48 +0100 Subject: [PATCH] fs File get_path procfs usage for netbsd same as linux. --- library/std/src/sys/unix/fs.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index 5c8c94971c3..7f69ebbeb4d 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -939,7 +939,7 @@ fn from_inner(fd: c_int) -> 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 { let mut p = PathBuf::from("/proc/self/fd"); p.push(&fd.to_string()); @@ -976,7 +976,12 @@ fn get_path(fd: c_int) -> Option { 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 { // FIXME(#24570): implement this for other Unix platforms None