@@ -166,38 +166,12 @@ impl<'a, T> Iterator for AncillaryDataIter<'a, T> {
166
166
}
167
167
168
168
/// Unix credential.
169
- #[ cfg( any(
170
- doc,
171
- target_os = "android" ,
172
- target_os = "dragonfly" ,
173
- target_os = "emscripten" ,
174
- target_os = "freebsd" ,
175
- target_os = "fuchsia" ,
176
- target_os = "ios" ,
177
- target_os = "linux" ,
178
- target_os = "macos" ,
179
- target_os = "netbsd" ,
180
- target_os = "openbsd" ,
181
- target_env = "uclibc" ,
182
- ) ) ]
169
+ #[ cfg( any( doc, target_os = "android" , target_os = "emscripten" , target_os = "linux" , ) ) ]
183
170
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "none" ) ]
184
171
#[ derive( Clone ) ]
185
172
pub struct SocketCred ( libc:: ucred ) ;
186
173
187
- #[ cfg( any(
188
- doc,
189
- target_os = "android" ,
190
- target_os = "dragonfly" ,
191
- target_os = "emscripten" ,
192
- target_os = "freebsd" ,
193
- target_os = "fuchsia" ,
194
- target_os = "ios" ,
195
- target_os = "linux" ,
196
- target_os = "macos" ,
197
- target_os = "netbsd" ,
198
- target_os = "openbsd" ,
199
- target_env = "uclibc" ,
200
- ) ) ]
174
+ #[ cfg( any( doc, target_os = "android" , target_os = "emscripten" , target_os = "linux" , ) ) ]
201
175
impl SocketCred {
202
176
/// Create a Unix credential struct.
203
177
///
@@ -262,37 +236,11 @@ impl<'a> Iterator for ScmRights<'a> {
262
236
/// This control message contains unix credentials.
263
237
///
264
238
/// The level is equal to `SOL_SOCKET` and the type is equal to `SCM_CREDENTIALS` or `SCM_CREDS`.
265
- #[ cfg( any(
266
- doc,
267
- target_os = "android" ,
268
- target_os = "dragonfly" ,
269
- target_os = "emscripten" ,
270
- target_os = "freebsd" ,
271
- target_os = "fuchsia" ,
272
- target_os = "ios" ,
273
- target_os = "linux" ,
274
- target_os = "macos" ,
275
- target_os = "netbsd" ,
276
- target_os = "openbsd" ,
277
- target_env = "uclibc" ,
278
- ) ) ]
239
+ #[ cfg( any( doc, target_os = "android" , target_os = "emscripten" , target_os = "linux" , ) ) ]
279
240
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "none" ) ]
280
241
pub struct ScmCredentials < ' a > ( AncillaryDataIter < ' a , libc:: ucred > ) ;
281
242
282
- #[ cfg( any(
283
- doc,
284
- target_os = "android" ,
285
- target_os = "dragonfly" ,
286
- target_os = "emscripten" ,
287
- target_os = "freebsd" ,
288
- target_os = "fuchsia" ,
289
- target_os = "ios" ,
290
- target_os = "linux" ,
291
- target_os = "macos" ,
292
- target_os = "netbsd" ,
293
- target_os = "openbsd" ,
294
- target_env = "uclibc" ,
295
- ) ) ]
243
+ #[ cfg( any( doc, target_os = "android" , target_os = "emscripten" , target_os = "linux" , ) ) ]
296
244
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "none" ) ]
297
245
impl < ' a > Iterator for ScmCredentials < ' a > {
298
246
type Item = SocketCred ;
@@ -314,20 +262,7 @@ pub enum AncillaryError {
314
262
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "none" ) ]
315
263
pub enum AncillaryData < ' a > {
316
264
ScmRights ( ScmRights < ' a > ) ,
317
- #[ cfg( any(
318
- doc,
319
- target_os = "android" ,
320
- target_os = "dragonfly" ,
321
- target_os = "emscripten" ,
322
- target_os = "freebsd" ,
323
- target_os = "fuchsia" ,
324
- target_os = "ios" ,
325
- target_os = "linux" ,
326
- target_os = "macos" ,
327
- target_os = "netbsd" ,
328
- target_os = "openbsd" ,
329
- target_env = "uclibc" ,
330
- ) ) ]
265
+ #[ cfg( any( doc, target_os = "android" , target_os = "emscripten" , target_os = "linux" , ) ) ]
331
266
ScmCredentials ( ScmCredentials < ' a > ) ,
332
267
}
333
268
@@ -350,20 +285,7 @@ impl<'a> AncillaryData<'a> {
350
285
///
351
286
/// `data` must contain a valid control message and the control message must be type of
352
287
/// `SOL_SOCKET` and level of `SCM_CREDENTIALS` or `SCM_CREDENTIALS`.
353
- #[ cfg( any(
354
- doc,
355
- target_os = "android" ,
356
- target_os = "dragonfly" ,
357
- target_os = "emscripten" ,
358
- target_os = "freebsd" ,
359
- target_os = "fuchsia" ,
360
- target_os = "ios" ,
361
- target_os = "linux" ,
362
- target_os = "macos" ,
363
- target_os = "netbsd" ,
364
- target_os = "openbsd" ,
365
- target_env = "uclibc" ,
366
- ) ) ]
288
+ #[ cfg( any( doc, target_os = "android" , target_os = "emscripten" , target_os = "linux" , ) ) ]
367
289
unsafe fn as_credentials ( data : & ' a [ u8 ] ) -> Self {
368
290
let ancillary_data_iter = AncillaryDataIter :: new ( data) ;
369
291
let scm_credentials = ScmCredentials ( ancillary_data_iter) ;
@@ -383,20 +305,9 @@ impl<'a> AncillaryData<'a> {
383
305
#[ cfg( any(
384
306
target_os = "android" ,
385
307
target_os = "emscripten" ,
386
- target_os = "fuchsia" ,
387
308
target_os = "linux" ,
388
- target_env = "uclibc" ,
389
309
) ) ]
390
310
libc:: SCM_CREDENTIALS => Ok ( AncillaryData :: as_credentials ( data) ) ,
391
- #[ cfg( any(
392
- target_os = "dragonfly" ,
393
- target_os = "freebsd" ,
394
- target_os = "ios" ,
395
- target_os = "macos" ,
396
- target_os = "netbsd" ,
397
- target_os = "openbsd" ,
398
- ) ) ]
399
- libc:: SCM_CREDS => Ok ( AncillaryData :: as_credentials ( data) ) ,
400
311
cmsg_type => {
401
312
Err ( AncillaryError :: Unknown { cmsg_level : libc:: SOL_SOCKET , cmsg_type } )
402
313
}
@@ -593,20 +504,7 @@ impl<'a> SocketAncillary<'a> {
593
504
/// Technically, that means this operation adds a control message with the level `SOL_SOCKET`
594
505
/// and type `SCM_CREDENTIALS` or `SCM_CREDS`.
595
506
///
596
- #[ cfg( any(
597
- doc,
598
- target_os = "android" ,
599
- target_os = "dragonfly" ,
600
- target_os = "emscripten" ,
601
- target_os = "freebsd" ,
602
- target_os = "fuchsia" ,
603
- target_os = "ios" ,
604
- target_os = "linux" ,
605
- target_os = "macos" ,
606
- target_os = "netbsd" ,
607
- target_os = "openbsd" ,
608
- target_env = "uclibc" ,
609
- ) ) ]
507
+ #[ cfg( any( doc, target_os = "android" , target_os = "emscripten" , target_os = "linux" , ) ) ]
610
508
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "none" ) ]
611
509
pub fn add_creds ( & mut self , creds : & [ SocketCred ] ) -> bool {
612
510
self . truncated = false ;
@@ -615,23 +513,7 @@ impl<'a> SocketAncillary<'a> {
615
513
& mut self . length ,
616
514
creds,
617
515
libc:: SOL_SOCKET ,
618
- #[ cfg( any(
619
- target_os = "android" ,
620
- target_os = "emscripten" ,
621
- target_os = "fuchsia" ,
622
- target_os = "linux" ,
623
- target_env = "uclibc" ,
624
- ) ) ]
625
516
libc:: SCM_CREDENTIALS ,
626
- #[ cfg( any(
627
- target_os = "dragonfly" ,
628
- target_os = "freebsd" ,
629
- target_os = "ios" ,
630
- target_os = "macos" ,
631
- target_os = "netbsd" ,
632
- target_os = "openbsd" ,
633
- ) ) ]
634
- libc:: SCM_CREDS ,
635
517
)
636
518
}
637
519
0 commit comments