Skip to content

Commit d0f1cf5

Browse files
authored
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.
2 parents 79a664d + c8f73e7 commit d0f1cf5

File tree

1 file changed

+16
-2
lines changed
  • library/std/src/sys/unix

1 file changed

+16
-2
lines changed

library/std/src/sys/unix/fs.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,14 @@ impl fmt::Debug for File {
12401240
None
12411241
}
12421242

1243-
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "vxworks"))]
1243+
#[cfg(any(
1244+
target_os = "linux",
1245+
target_os = "macos",
1246+
target_os = "freebsd",
1247+
target_os = "netbsd",
1248+
target_os = "openbsd",
1249+
target_os = "vxworks"
1250+
))]
12441251
fn get_mode(fd: c_int) -> Option<(bool, bool)> {
12451252
let mode = unsafe { libc::fcntl(fd, libc::F_GETFL) };
12461253
if mode == -1 {
@@ -1254,7 +1261,14 @@ impl fmt::Debug for File {
12541261
}
12551262
}
12561263

1257-
#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "vxworks")))]
1264+
#[cfg(not(any(
1265+
target_os = "linux",
1266+
target_os = "macos",
1267+
target_os = "freebsd",
1268+
target_os = "netbsd",
1269+
target_os = "openbsd",
1270+
target_os = "vxworks"
1271+
)))]
12581272
fn get_mode(_fd: c_int) -> Option<(bool, bool)> {
12591273
// FIXME(#24570): implement this for other Unix platforms
12601274
None

0 commit comments

Comments
 (0)