fs::get_mode enable getting the data via fcntl/F_GETFL on major BSD
supporting this flag.
This commit is contained in:
parent
91f128baf7
commit
c8f73e79b3
1 changed files with 16 additions and 2 deletions
|
@ -1260,7 +1260,14 @@ impl fmt::Debug for File {
|
||||||
None
|
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)> {
|
fn get_mode(fd: c_int) -> Option<(bool, bool)> {
|
||||||
let mode = unsafe { libc::fcntl(fd, libc::F_GETFL) };
|
let mode = unsafe { libc::fcntl(fd, libc::F_GETFL) };
|
||||||
if mode == -1 {
|
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)> {
|
fn get_mode(_fd: c_int) -> Option<(bool, bool)> {
|
||||||
// FIXME(#24570): implement this for other Unix platforms
|
// FIXME(#24570): implement this for other Unix platforms
|
||||||
None
|
None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue