about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2022-08-28 10:26:59 +0100
committerDavid Carlier <devnexen@gmail.com>2022-08-28 10:43:30 +0100
commitc8f73e79b33428664d8e7e98690612a6a79e3fe7 (patch)
treeb315e2bc7338f61dca458167840a4d8254f24713 /library/std/src/sys
parent91f128baf7704a477ab7c499143a160fb069b3ad (diff)
downloadrust-c8f73e79b33428664d8e7e98690612a6a79e3fe7.tar.gz
rust-c8f73e79b33428664d8e7e98690612a6a79e3fe7.zip
fs::get_mode enable getting the data via fcntl/F_GETFL on major BSD
supporting this flag.
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/unix/fs.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs
index f38d2fd3d70..2c2435fd285 100644
--- a/library/std/src/sys/unix/fs.rs
+++ b/library/std/src/sys/unix/fs.rs
@@ -1260,7 +1260,14 @@ impl fmt::Debug for File {
             None
         }
 
-        #[cfg(any(target_os = "linux", target_os = "macos", target_os = "vxworks"))]
+        #[cfg(any(
+            target_os = "linux",
+            target_os = "macos",
+            target_os = "freebsd",
+            target_os = "netbsd",
+            target_os = "openbsd",
+            target_os = "vxworks"
+        ))]
         fn get_mode(fd: c_int) -> Option<(bool, bool)> {
             let mode = unsafe { libc::fcntl(fd, libc::F_GETFL) };
             if mode == -1 {
@@ -1274,7 +1281,14 @@ impl fmt::Debug for File {
             }
         }
 
-        #[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "vxworks")))]
+        #[cfg(not(any(
+            target_os = "linux",
+            target_os = "macos",
+            target_os = "freebsd",
+            target_os = "netbsd",
+            target_os = "openbsd",
+            target_os = "vxworks"
+        )))]
         fn get_mode(_fd: c_int) -> Option<(bool, bool)> {
             // FIXME(#24570): implement this for other Unix platforms
             None