1
- #[ cfg( not( target_os = "redox" ) ) ]
2
1
use { Error , NixPath , Result } ;
3
- #[ cfg( not( target_os = "redox" ) ) ]
4
2
use errno:: Errno ;
5
- #[ cfg( not( target_os = "redox" ) ) ]
6
3
use fcntl:: { self , OFlag } ;
7
4
use libc;
8
- #[ cfg( not( target_os = "redox" ) ) ]
9
5
use std:: os:: unix:: io:: { AsRawFd , IntoRawFd , RawFd } ;
10
- #[ cfg( not( target_os = "redox" ) ) ]
11
6
use std:: ptr;
12
7
use std:: ffi;
13
- #[ cfg( not( target_os = "redox" ) ) ]
14
8
use sys;
15
9
16
10
#[ cfg( target_os = "linux" ) ]
17
11
use libc:: { dirent64 as dirent, readdir64_r as readdir_r} ;
18
12
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" ) ) ]
23
14
use libc:: { dirent, readdir_r} ;
24
15
25
16
/// An open directory.
@@ -36,12 +27,10 @@ use libc::{dirent, readdir_r};
36
27
/// * returns entries' names as a `CStr` (no allocation or conversion beyond whatever libc
37
28
/// does).
38
29
#[ derive( Clone , Debug , Eq , Hash , PartialEq ) ]
39
- #[ cfg( not( target_os = "redox" ) ) ]
40
30
pub struct Dir (
41
31
ptr:: NonNull < libc:: DIR >
42
32
) ;
43
33
44
- #[ cfg( not( target_os = "redox" ) ) ]
45
34
impl Dir {
46
35
/// Opens the given path as with `fcntl::open`.
47
36
pub fn open < P : ?Sized + NixPath > ( path : & P , oflag : OFlag ,
@@ -87,28 +76,23 @@ impl Dir {
87
76
// call `readdir` simultaneously from multiple threads.
88
77
//
89
78
// `Dir` is safe to pass from one thread to another, as it's not reference-counted.
90
- #[ cfg( not( target_os = "redox" ) ) ]
91
79
unsafe impl Send for Dir { }
92
80
93
- #[ cfg( not( target_os = "redox" ) ) ]
94
81
impl AsRawFd for Dir {
95
82
fn as_raw_fd ( & self ) -> RawFd {
96
83
unsafe { libc:: dirfd ( self . 0 . as_ptr ( ) ) }
97
84
}
98
85
}
99
86
100
- #[ cfg( not( target_os = "redox" ) ) ]
101
87
impl Drop for Dir {
102
88
fn drop ( & mut self ) {
103
89
unsafe { libc:: closedir ( self . 0 . as_ptr ( ) ) } ;
104
90
}
105
91
}
106
92
107
93
#[ derive( Debug , Eq , Hash , PartialEq ) ]
108
- #[ cfg( not( target_os = "redox" ) ) ]
109
94
pub struct Iter < ' d > ( & ' d mut Dir ) ;
110
95
111
- #[ cfg( not( target_os = "redox" ) ) ]
112
96
impl < ' d > Iterator for Iter < ' d > {
113
97
type Item = Result < Entry > ;
114
98
@@ -135,7 +119,6 @@ impl<'d> Iterator for Iter<'d> {
135
119
}
136
120
}
137
121
138
- #[ cfg( not( target_os = "redox" ) ) ]
139
122
impl < ' d > Drop for Iter < ' d > {
140
123
fn drop ( & mut self ) {
141
124
unsafe { libc:: rewinddir ( ( self . 0 ) . 0 . as_ptr ( ) ) }
@@ -170,7 +153,6 @@ impl Entry {
170
153
target_os = "l4re" ,
171
154
target_os = "linux" ,
172
155
target_os = "macos" ,
173
- target_os = "redox" ,
174
156
target_os = "solaris" ) ) ]
175
157
pub fn ino ( & self ) -> u64 {
176
158
self . 0 . d_ino as u64
@@ -185,7 +167,6 @@ impl Entry {
185
167
target_os = "l4re" ,
186
168
target_os = "linux" ,
187
169
target_os = "macos" ,
188
- target_os = "redox" ,
189
170
target_os = "solaris" ) ) ) ]
190
171
pub fn ino ( & self ) -> u64 {
191
172
u64:: from ( self . 0 . d_fileno )
0 commit comments