@@ -95,184 +95,184 @@ fn desc(errno: Errno) -> &'static str {
95
95
EHOSTDOWN => "Host is down" ,
96
96
EHOSTUNREACH => "No route to host" ,
97
97
98
- #[ cfg( target_os = "linux" ) ]
98
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
99
99
ECHRNG => "Channel number out of range" ,
100
100
101
- #[ cfg( target_os = "linux" ) ]
101
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
102
102
EL2NSYNC => "Level 2 not synchronized" ,
103
103
104
- #[ cfg( target_os = "linux" ) ]
104
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
105
105
EL3HLT => "Level 3 halted" ,
106
106
107
- #[ cfg( target_os = "linux" ) ]
107
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
108
108
EL3RST => "Level 3 reset" ,
109
109
110
- #[ cfg( target_os = "linux" ) ]
110
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
111
111
ELNRNG => "Link number out of range" ,
112
112
113
- #[ cfg( target_os = "linux" ) ]
113
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
114
114
EUNATCH => "Protocol driver not attached" ,
115
115
116
- #[ cfg( target_os = "linux" ) ]
116
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
117
117
ENOCSI => "No CSI structure available" ,
118
118
119
- #[ cfg( target_os = "linux" ) ]
119
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
120
120
EL2HLT => "Level 2 halted" ,
121
121
122
- #[ cfg( target_os = "linux" ) ]
122
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
123
123
EBADE => "Invalid exchange" ,
124
124
125
- #[ cfg( target_os = "linux" ) ]
125
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
126
126
EBADR => "Invalid request descriptor" ,
127
127
128
- #[ cfg( target_os = "linux" ) ]
128
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
129
129
EXFULL => "Exchange full" ,
130
130
131
- #[ cfg( target_os = "linux" ) ]
131
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
132
132
ENOANO => "No anode" ,
133
133
134
- #[ cfg( target_os = "linux" ) ]
134
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
135
135
EBADRQC => "Invalid request code" ,
136
136
137
- #[ cfg( target_os = "linux" ) ]
137
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
138
138
EBADSLT => "Invalid slot" ,
139
139
140
- #[ cfg( target_os = "linux" ) ]
140
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
141
141
EBFONT => "Bad font file format" ,
142
142
143
- #[ cfg( target_os = "linux" ) ]
143
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
144
144
ENOSTR => "Device not a stream" ,
145
145
146
- #[ cfg( target_os = "linux" ) ]
146
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
147
147
ENODATA => "No data available" ,
148
148
149
- #[ cfg( target_os = "linux" ) ]
149
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
150
150
ETIME => "Timer expired" ,
151
151
152
- #[ cfg( target_os = "linux" ) ]
152
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
153
153
ENOSR => "Out of streams resources" ,
154
154
155
- #[ cfg( target_os = "linux" ) ]
155
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
156
156
ENONET => "Machine is not on the network" ,
157
157
158
- #[ cfg( target_os = "linux" ) ]
158
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
159
159
ENOPKG => "Package not installed" ,
160
160
161
- #[ cfg( target_os = "linux" ) ]
161
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
162
162
EREMOTE => "Object is remote" ,
163
163
164
- #[ cfg( target_os = "linux" ) ]
164
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
165
165
ENOLINK => "Link has been severed" ,
166
166
167
- #[ cfg( target_os = "linux" ) ]
167
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
168
168
EADV => "Advertise error" ,
169
169
170
- #[ cfg( target_os = "linux" ) ]
170
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
171
171
ESRMNT => "Srmount error" ,
172
172
173
- #[ cfg( target_os = "linux" ) ]
173
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
174
174
ECOMM => "Communication error on send" ,
175
175
176
- #[ cfg( target_os = "linux" ) ]
176
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
177
177
EPROTO => "Protocol error" ,
178
178
179
- #[ cfg( target_os = "linux" ) ]
179
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
180
180
EMULTIHOP => "Multihop attempted" ,
181
181
182
- #[ cfg( target_os = "linux" ) ]
182
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
183
183
EDOTDOT => "RFS specific error" ,
184
184
185
- #[ cfg( target_os = "linux" ) ]
185
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
186
186
EBADMSG => "Not a data message" ,
187
187
188
- #[ cfg( target_os = "linux" ) ]
188
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
189
189
EOVERFLOW => "Value too large for defined data type" ,
190
190
191
- #[ cfg( target_os = "linux" ) ]
191
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
192
192
ENOTUNIQ => "Name not unique on network" ,
193
193
194
- #[ cfg( target_os = "linux" ) ]
194
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
195
195
EBADFD => "File descriptor in bad state" ,
196
196
197
- #[ cfg( target_os = "linux" ) ]
197
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
198
198
EREMCHG => "Remote address changed" ,
199
199
200
- #[ cfg( target_os = "linux" ) ]
200
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
201
201
ELIBACC => "Can not acces a needed shared library" ,
202
202
203
- #[ cfg( target_os = "linux" ) ]
203
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
204
204
ELIBBAD => "Accessing a corrupted shared library" ,
205
205
206
- #[ cfg( target_os = "linux" ) ]
206
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
207
207
ELIBSCN => ".lib section in a.out corrupted" ,
208
208
209
- #[ cfg( target_os = "linux" ) ]
209
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
210
210
ELIBMAX => "Attempting to link in too many shared libraries" ,
211
211
212
- #[ cfg( target_os = "linux" ) ]
212
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
213
213
ELIBEXEC => "Cannot exec a shared library directly" ,
214
214
215
- #[ cfg( target_os = "linux" ) ]
215
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
216
216
EILSEQ => "Illegal byte sequence" ,
217
217
218
- #[ cfg( target_os = "linux" ) ]
218
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
219
219
ERESTART => "Interrupted system call should be restarted" ,
220
220
221
- #[ cfg( target_os = "linux" ) ]
221
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
222
222
ESTRPIPE => "Streams pipe error" ,
223
223
224
- #[ cfg( target_os = "linux" ) ]
224
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
225
225
EUSERS => "Too many users" ,
226
226
227
- #[ cfg( target_os = "linux" ) ]
227
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
228
228
EOPNOTSUPP => "Operation not supported on transport endpoint" ,
229
229
230
- #[ cfg( target_os = "linux" ) ]
230
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
231
231
ESTALE => "Stale file handle" ,
232
232
233
- #[ cfg( target_os = "linux" ) ]
233
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
234
234
EUCLEAN => "Structure needs cleaning" ,
235
235
236
- #[ cfg( target_os = "linux" ) ]
236
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
237
237
ENOTNAM => "Not a XENIX named type file" ,
238
238
239
- #[ cfg( target_os = "linux" ) ]
239
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
240
240
ENAVAIL => "No XENIX semaphores available" ,
241
241
242
- #[ cfg( target_os = "linux" ) ]
242
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
243
243
EISNAM => "Is a named type file" ,
244
244
245
- #[ cfg( target_os = "linux" ) ]
245
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
246
246
EREMOTEIO => "Remote I/O error" ,
247
247
248
- #[ cfg( target_os = "linux" ) ]
248
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
249
249
EDQUOT => "Quota exceeded" ,
250
250
251
- #[ cfg( target_os = "linux" ) ]
251
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
252
252
ENOMEDIUM => "No medium found" ,
253
253
254
- #[ cfg( target_os = "linux" ) ]
254
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
255
255
EMEDIUMTYPE => "Wrong medium type" ,
256
256
257
- #[ cfg( target_os = "linux" ) ]
257
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
258
258
ECANCELED => "Operation canceled" ,
259
259
260
- #[ cfg( target_os = "linux" ) ]
260
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
261
261
ENOKEY => "Required key not available" ,
262
262
263
- #[ cfg( target_os = "linux" ) ]
263
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
264
264
EKEYEXPIRED => "Key has expired" ,
265
265
266
- #[ cfg( target_os = "linux" ) ]
266
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
267
267
EKEYREVOKED => "Key has been revoked" ,
268
268
269
- #[ cfg( target_os = "linux" ) ]
269
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
270
270
EKEYREJECTED => "Key was rejected by service" ,
271
271
272
- #[ cfg( target_os = "linux" ) ]
272
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
273
273
EOWNERDEAD => "Owner died" ,
274
274
275
- #[ cfg( target_os = "linux" ) ]
275
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
276
276
ENOTRECOVERABLE => "State not recoverable" ,
277
277
278
278
#[ cfg( target_os = "linux" ) ]
@@ -394,7 +394,7 @@ fn desc(errno: Errno) -> &'static str {
394
394
}
395
395
}
396
396
397
- #[ cfg( target_os = "linux" ) ]
397
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
398
398
mod consts {
399
399
#[ derive( Debug , Clone , PartialEq , FromPrimitive , Copy ) ]
400
400
pub enum Errno {
@@ -528,7 +528,10 @@ mod consts {
528
528
EKEYREJECTED = 129 ,
529
529
EOWNERDEAD = 130 ,
530
530
ENOTRECOVERABLE = 131 ,
531
+
532
+ #[ cfg( not( target_os = "android" ) ) ]
531
533
ERFKILL = 132 ,
534
+ #[ cfg( not( target_os = "android" ) ) ]
532
535
EHWPOISON = 133 ,
533
536
}
534
537
@@ -667,13 +670,8 @@ mod test {
667
670
use libc:: c_int;
668
671
669
672
macro_rules! check_errno {
670
- ( $errno: ident) => { {
671
- assert_errno_eq( stringify!( $errno) , $errno as c_int) ;
672
- } } ;
673
-
674
- ( $errno: ident, $( $rest: ident) ,+) => { {
675
- check_errno!( $errno) ;
676
- check_errno!( $( $rest) ,* ) ;
673
+ ( $( $errno: ident) ,+) => { {
674
+ $( assert_errno_eq( stringify!( $errno) , $errno as c_int) ; ) +
677
675
} } ;
678
676
}
679
677
@@ -754,7 +752,7 @@ mod test {
754
752
}
755
753
756
754
#[ test]
757
- #[ cfg( target_os = "linux" ) ]
755
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
758
756
pub fn test_linux_errnos ( ) {
759
757
check_errno ! (
760
758
ECHRNG ,
@@ -816,14 +814,19 @@ mod test {
816
814
EKEYREVOKED ,
817
815
EKEYREJECTED ,
818
816
EOWNERDEAD ,
819
- ENOTRECOVERABLE ,
817
+ ENOTRECOVERABLE ) ;
818
+ }
819
+
820
+ #[ test]
821
+ #[ cfg( target_os = "linux" ) ]
822
+ pub fn test_linux_not_android_errnos ( ) {
823
+ check_errno ! (
820
824
ERFKILL ,
821
825
EHWPOISON ) ;
822
826
}
823
827
824
-
825
828
#[ test]
826
- #[ cfg( target_os = "macos" ) ]
829
+ #[ cfg( any ( target_os = "macos" , target_os = "ios" ) ) ]
827
830
pub fn test_darwin_errnos ( ) {
828
831
check_errno ! (
829
832
ENOTSUP ,
0 commit comments