Skip to content

Commit c8f73e7

Browse files
committed
fs::get_mode enable getting the data via fcntl/F_GETFL on major BSD
supporting this flag.
1 parent 91f128b commit c8f73e7

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
@@ -1260,7 +1260,14 @@ impl fmt::Debug for File {
12601260
None
12611261
}
12621262

1263-
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "vxworks"))]
1263+
#[cfg(any(
1264+
target_os = "linux",
1265+
target_os = "macos",
1266+
target_os = "freebsd",
1267+
target_os = "netbsd",
1268+
target_os = "openbsd",
1269+
target_os = "vxworks"
1270+
))]
12641271
fn get_mode(fd: c_int) -> Option<(bool, bool)> {
12651272
let mode = unsafe { libc::fcntl(fd, libc::F_GETFL) };
12661273
if mode == -1 {
@@ -1274,7 +1281,14 @@ impl fmt::Debug for File {
12741281
}
12751282
}
12761283

1277-
#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "vxworks")))]
1284+
#[cfg(not(any(
1285+
target_os = "linux",
1286+
target_os = "macos",
1287+
target_os = "freebsd",
1288+
target_os = "netbsd",
1289+
target_os = "openbsd",
1290+
target_os = "vxworks"
1291+
)))]
12781292
fn get_mode(_fd: c_int) -> Option<(bool, bool)> {
12791293
// FIXME(#24570): implement this for other Unix platforms
12801294
None

0 commit comments

Comments
 (0)