6
6
use super :: raw:: { AsRawFd , FromRawFd , IntoRawFd , RawFd } ;
7
7
use crate :: marker:: PhantomData ;
8
8
use crate :: mem:: ManuallyDrop ;
9
- #[ cfg( not( any( target_arch = "wasm32" , target_env = "sgx" , target_os = "hermit" ) ) ) ]
9
+ #[ cfg( not( any( target_arch = "wasm32" , target_env = "sgx" , target_os = "hermit" , target_os = "trusty" ) ) ) ]
10
10
use crate :: sys:: cvt;
11
+ #[ cfg( not( target_os = "trusty" ) ) ]
11
12
use crate :: sys_common:: { AsInner , FromInner , IntoInner } ;
12
- use crate :: { fmt, fs, io} ;
13
+ use crate :: { fmt, io} ;
14
+ #[ cfg( not( target_os = "trusty" ) ) ]
15
+ use crate :: fs;
13
16
14
17
type ValidRawFd = core:: num:: niche_types:: NotAllOnes < RawFd > ;
15
18
@@ -89,7 +92,7 @@ impl OwnedFd {
89
92
impl BorrowedFd < ' _ > {
90
93
/// Creates a new `OwnedFd` instance that shares the same underlying file
91
94
/// description as the existing `BorrowedFd` instance.
92
- #[ cfg( not( any( target_arch = "wasm32" , target_os = "hermit" ) ) ) ]
95
+ #[ cfg( not( any( target_arch = "wasm32" , target_os = "hermit" , target_os = "trusty" ) ) ) ]
93
96
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
94
97
pub fn try_clone_to_owned ( & self ) -> crate :: io:: Result < OwnedFd > {
95
98
// We want to atomically duplicate this file descriptor and set the
@@ -112,7 +115,7 @@ impl BorrowedFd<'_> {
112
115
113
116
/// Creates a new `OwnedFd` instance that shares the same underlying file
114
117
/// description as the existing `BorrowedFd` instance.
115
- #[ cfg( any( target_arch = "wasm32" , target_os = "hermit" ) ) ]
118
+ #[ cfg( any( target_arch = "wasm32" , target_os = "hermit" , target_os = "trusty" ) ) ]
116
119
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
117
120
pub fn try_clone_to_owned ( & self ) -> crate :: io:: Result < OwnedFd > {
118
121
Err ( crate :: io:: Error :: UNSUPPORTED_PLATFORM )
@@ -284,6 +287,7 @@ impl AsFd for OwnedFd {
284
287
}
285
288
286
289
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
290
+ #[ cfg( not( target_os = "trusty" ) ) ]
287
291
impl AsFd for fs:: File {
288
292
#[ inline]
289
293
fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -292,6 +296,7 @@ impl AsFd for fs::File {
292
296
}
293
297
294
298
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
299
+ #[ cfg( not( target_os = "trusty" ) ) ]
295
300
impl From < fs:: File > for OwnedFd {
296
301
/// Takes ownership of a [`File`](fs::File)'s underlying file descriptor.
297
302
#[ inline]
@@ -301,6 +306,7 @@ impl From<fs::File> for OwnedFd {
301
306
}
302
307
303
308
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
309
+ #[ cfg( not( target_os = "trusty" ) ) ]
304
310
impl From < OwnedFd > for fs:: File {
305
311
/// Returns a [`File`](fs::File) that takes ownership of the given
306
312
/// file descriptor.
@@ -311,6 +317,7 @@ impl From<OwnedFd> for fs::File {
311
317
}
312
318
313
319
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
320
+ #[ cfg( not( target_os = "trusty" ) ) ]
314
321
impl AsFd for crate :: net:: TcpStream {
315
322
#[ inline]
316
323
fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -319,6 +326,7 @@ impl AsFd for crate::net::TcpStream {
319
326
}
320
327
321
328
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
329
+ #[ cfg( not( target_os = "trusty" ) ) ]
322
330
impl From < crate :: net:: TcpStream > for OwnedFd {
323
331
/// Takes ownership of a [`TcpStream`](crate::net::TcpStream)'s socket file descriptor.
324
332
#[ inline]
@@ -328,6 +336,7 @@ impl From<crate::net::TcpStream> for OwnedFd {
328
336
}
329
337
330
338
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
339
+ #[ cfg( not( target_os = "trusty" ) ) ]
331
340
impl From < OwnedFd > for crate :: net:: TcpStream {
332
341
#[ inline]
333
342
fn from ( owned_fd : OwnedFd ) -> Self {
@@ -338,6 +347,7 @@ impl From<OwnedFd> for crate::net::TcpStream {
338
347
}
339
348
340
349
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
350
+ #[ cfg( not( target_os = "trusty" ) ) ]
341
351
impl AsFd for crate :: net:: TcpListener {
342
352
#[ inline]
343
353
fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -346,6 +356,7 @@ impl AsFd for crate::net::TcpListener {
346
356
}
347
357
348
358
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
359
+ #[ cfg( not( target_os = "trusty" ) ) ]
349
360
impl From < crate :: net:: TcpListener > for OwnedFd {
350
361
/// Takes ownership of a [`TcpListener`](crate::net::TcpListener)'s socket file descriptor.
351
362
#[ inline]
@@ -355,6 +366,7 @@ impl From<crate::net::TcpListener> for OwnedFd {
355
366
}
356
367
357
368
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
369
+ #[ cfg( not( target_os = "trusty" ) ) ]
358
370
impl From < OwnedFd > for crate :: net:: TcpListener {
359
371
#[ inline]
360
372
fn from ( owned_fd : OwnedFd ) -> Self {
@@ -365,6 +377,7 @@ impl From<OwnedFd> for crate::net::TcpListener {
365
377
}
366
378
367
379
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
380
+ #[ cfg( not( target_os = "trusty" ) ) ]
368
381
impl AsFd for crate :: net:: UdpSocket {
369
382
#[ inline]
370
383
fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -373,6 +386,7 @@ impl AsFd for crate::net::UdpSocket {
373
386
}
374
387
375
388
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
389
+ #[ cfg( not( target_os = "trusty" ) ) ]
376
390
impl From < crate :: net:: UdpSocket > for OwnedFd {
377
391
/// Takes ownership of a [`UdpSocket`](crate::net::UdpSocket)'s file descriptor.
378
392
#[ inline]
@@ -382,6 +396,7 @@ impl From<crate::net::UdpSocket> for OwnedFd {
382
396
}
383
397
384
398
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
399
+ #[ cfg( not( target_os = "trusty" ) ) ]
385
400
impl From < OwnedFd > for crate :: net:: UdpSocket {
386
401
#[ inline]
387
402
fn from ( owned_fd : OwnedFd ) -> Self {
0 commit comments