about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2021-07-29 17:49:48 +0100
committerDavid Carlier <devnexen@gmail.com>2021-07-29 17:49:48 +0100
commitce1bd70035d594755c109ebb313b51becca73213 (patch)
tree8679e0488745d71b3f9e882762f0a7443687d72e /library/std/src
parent5fb3394cbdf0622c9d0c292feb55db0f4c828dc3 (diff)
downloadrust-ce1bd70035d594755c109ebb313b51becca73213.tar.gz
rust-ce1bd70035d594755c109ebb313b51becca73213.zip
fs File get_path procfs usage for netbsd same as linux.
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/sys/unix/fs.rs9
1 files 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 @@ 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());
@@ -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