Skip to content

Commit bedbb8d

Browse files
committed
Simply disable the dir module, since only the entry struct is available
1 parent 106927a commit bedbb8d

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

src/dir.rs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
1-
#[cfg(not(target_os = "redox"))]
21
use {Error, NixPath, Result};
3-
#[cfg(not(target_os = "redox"))]
42
use errno::Errno;
5-
#[cfg(not(target_os = "redox"))]
63
use fcntl::{self, OFlag};
74
use libc;
8-
#[cfg(not(target_os = "redox"))]
95
use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd};
10-
#[cfg(not(target_os = "redox"))]
116
use std::ptr;
127
use std::ffi;
13-
#[cfg(not(target_os = "redox"))]
148
use sys;
159

1610
#[cfg(target_os = "linux")]
1711
use libc::{dirent64 as dirent, readdir64_r as readdir_r};
1812

19-
#[cfg(target_os = "redox")]
20-
use libc::dirent;
21-
22-
#[cfg(not(any(target_os = "linux", target_os = "redox")))]
13+
#[cfg(not(target_os = "linux"))]
2314
use libc::{dirent, readdir_r};
2415

2516
/// An open directory.
@@ -36,12 +27,10 @@ use libc::{dirent, readdir_r};
3627
/// * returns entries' names as a `CStr` (no allocation or conversion beyond whatever libc
3728
/// does).
3829
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
39-
#[cfg(not(target_os = "redox"))]
4030
pub struct Dir(
4131
ptr::NonNull<libc::DIR>
4232
);
4333

44-
#[cfg(not(target_os = "redox"))]
4534
impl Dir {
4635
/// Opens the given path as with `fcntl::open`.
4736
pub fn open<P: ?Sized + NixPath>(path: &P, oflag: OFlag,
@@ -87,28 +76,23 @@ impl Dir {
8776
// call `readdir` simultaneously from multiple threads.
8877
//
8978
// `Dir` is safe to pass from one thread to another, as it's not reference-counted.
90-
#[cfg(not(target_os = "redox"))]
9179
unsafe impl Send for Dir {}
9280

93-
#[cfg(not(target_os = "redox"))]
9481
impl AsRawFd for Dir {
9582
fn as_raw_fd(&self) -> RawFd {
9683
unsafe { libc::dirfd(self.0.as_ptr()) }
9784
}
9885
}
9986

100-
#[cfg(not(target_os = "redox"))]
10187
impl Drop for Dir {
10288
fn drop(&mut self) {
10389
unsafe { libc::closedir(self.0.as_ptr()) };
10490
}
10591
}
10692

10793
#[derive(Debug, Eq, Hash, PartialEq)]
108-
#[cfg(not(target_os = "redox"))]
10994
pub struct Iter<'d>(&'d mut Dir);
11095

111-
#[cfg(not(target_os = "redox"))]
11296
impl<'d> Iterator for Iter<'d> {
11397
type Item = Result<Entry>;
11498

@@ -135,7 +119,6 @@ impl<'d> Iterator for Iter<'d> {
135119
}
136120
}
137121

138-
#[cfg(not(target_os = "redox"))]
139122
impl<'d> Drop for Iter<'d> {
140123
fn drop(&mut self) {
141124
unsafe { libc::rewinddir((self.0).0.as_ptr()) }
@@ -170,7 +153,6 @@ impl Entry {
170153
target_os = "l4re",
171154
target_os = "linux",
172155
target_os = "macos",
173-
target_os = "redox",
174156
target_os = "solaris"))]
175157
pub fn ino(&self) -> u64 {
176158
self.0.d_ino as u64
@@ -185,7 +167,6 @@ impl Entry {
185167
target_os = "l4re",
186168
target_os = "linux",
187169
target_os = "macos",
188-
target_os = "redox",
189170
target_os = "solaris")))]
190171
pub fn ino(&self) -> u64 {
191172
u64::from(self.0.d_fileno)

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub extern crate libc;
2828
#[macro_use] mod macros;
2929

3030
// Public crates
31+
#[cfg(not(target_os = "redox"))]
3132
pub mod dir;
3233
pub mod env;
3334
pub mod errno;

0 commit comments

Comments
 (0)