about summary refs log tree commit diff
path: root/library/std/src/sys/unix
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-10-10 00:09:39 +0900
committerGitHub <noreply@github.com>2022-10-10 00:09:39 +0900
commitd0f1cf5de77a3ffe584de17658fa501e4aea5770 (patch)
tree2d72daa5633107e9a24d3cfd87b1bc3911e8588f /library/std/src/sys/unix
parent79a664d8b00505a76b53cfe017b9c80bcee7e080 (diff)
parentc8f73e79b33428664d8e7e98690612a6a79e3fe7 (diff)
downloadrust-d0f1cf5de77a3ffe584de17658fa501e4aea5770.tar.gz
rust-d0f1cf5de77a3ffe584de17658fa501e4aea5770.zip
Rollup merge of #101118 - devnexen:fs_getmode_bsd, r=Mark-Simulacrum
fs::get_mode enable getting the data via fcntl/F_GETFL on major BSD

supporting this flag.
Diffstat (limited to 'library/std/src/sys/unix')
-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 57c7bf6a28b..100409f14ef 100644
--- a/library/std/src/sys/unix/fs.rs
+++ b/library/std/src/sys/unix/fs.rs
@@ -1240,7 +1240,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 {
@@ -1254,7 +1261,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