summaryrefslogtreecommitdiff
path: root/src/dir.rs
diff options
context:
space:
mode:
authorXavier L'Heureux <xavier.lheureux@icloud.com>2019-07-12 16:27:24 -0400
committerXavier L'Heureux <dev.xlheureux@gmail.com>2020-05-17 21:05:45 -0400
commit0259f9d51718b90118bbd1d792c88781d0aa98f7 (patch)
treec8d067b61393cb1628890790def3c6691c70bab6 /src/dir.rs
parentd3fef370b843e0ffd6fc6df6e80d9bbe0d024863 (diff)
downloadnix-0259f9d51718b90118bbd1d792c88781d0aa98f7.zip
Add Redox support for most of the modules
Some things are not implemented yet in redox, so a lot of annotations were added to remove functions when compiling for redox. Those functions will hopefully be added in time, but for now it's better to have partial support than none. Blocked by https://github.com/rust-lang/libc/pull/1438
Diffstat (limited to 'src/dir.rs')
-rw-r--r--src/dir.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dir.rs b/src/dir.rs
index d8c05e96..42731a4e 100644
--- a/src/dir.rs
+++ b/src/dir.rs
@@ -2,7 +2,9 @@ use {Error, NixPath, Result};
use errno::Errno;
use fcntl::{self, OFlag};
use libc;
-use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd};
+use std::os::unix::io::{IntoRawFd, RawFd};
+#[cfg(not(target_os = "redox"))]
+use std::os::unix::io::AsRawFd;
use std::{ffi, ptr};
use sys;
@@ -77,6 +79,7 @@ impl Dir {
// `Dir` is safe to pass from one thread to another, as it's not reference-counted.
unsafe impl Send for Dir {}
+#[cfg(not(target_os = "redox"))]
impl AsRawFd for Dir {
fn as_raw_fd(&self) -> RawFd {
unsafe { libc::dirfd(self.0.as_ptr()) }
@@ -152,6 +155,7 @@ impl Entry {
target_os = "l4re",
target_os = "linux",
target_os = "macos",
+ target_os = "redox",
target_os = "solaris"))]
pub fn ino(&self) -> u64 {
self.0.d_ino as u64
@@ -166,6 +170,7 @@ impl Entry {
target_os = "l4re",
target_os = "linux",
target_os = "macos",
+ target_os = "redox",
target_os = "solaris")))]
pub fn ino(&self) -> u64 {
u64::from(self.0.d_fileno)