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
@@ -87,7 +90,7 @@ impl OwnedFd {
87
90
impl BorrowedFd < ' _ > {
88
91
/// Creates a new `OwnedFd` instance that shares the same underlying file
89
92
/// description as the existing `BorrowedFd` instance.
90
- #[ cfg( not( any( target_arch = "wasm32" , target_os = "hermit" ) ) ) ]
93
+ #[ cfg( not( any( target_arch = "wasm32" , target_os = "hermit" , target_os = "trusty" ) ) ) ]
91
94
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
92
95
pub fn try_clone_to_owned ( & self ) -> crate :: io:: Result < OwnedFd > {
93
96
// We want to atomically duplicate this file descriptor and set the
@@ -110,7 +113,7 @@ impl BorrowedFd<'_> {
110
113
111
114
/// Creates a new `OwnedFd` instance that shares the same underlying file
112
115
/// description as the existing `BorrowedFd` instance.
113
- #[ cfg( any( target_arch = "wasm32" , target_os = "hermit" ) ) ]
116
+ #[ cfg( any( target_arch = "wasm32" , target_os = "hermit" , target_os = "trusty" ) ) ]
114
117
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
115
118
pub fn try_clone_to_owned ( & self ) -> crate :: io:: Result < OwnedFd > {
116
119
Err ( crate :: io:: Error :: UNSUPPORTED_PLATFORM )
@@ -280,6 +283,7 @@ impl AsFd for OwnedFd {
280
283
}
281
284
282
285
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
286
+ #[ cfg( not( target_os = "trusty" ) ) ]
283
287
impl AsFd for fs:: File {
284
288
#[ inline]
285
289
fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -288,6 +292,7 @@ impl AsFd for fs::File {
288
292
}
289
293
290
294
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
295
+ #[ cfg( not( target_os = "trusty" ) ) ]
291
296
impl From < fs:: File > for OwnedFd {
292
297
/// Takes ownership of a [`File`](fs::File)'s underlying file descriptor.
293
298
#[ inline]
@@ -297,6 +302,7 @@ impl From<fs::File> for OwnedFd {
297
302
}
298
303
299
304
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
305
+ #[ cfg( not( target_os = "trusty" ) ) ]
300
306
impl From < OwnedFd > for fs:: File {
301
307
/// Returns a [`File`](fs::File) that takes ownership of the given
302
308
/// file descriptor.
@@ -307,6 +313,7 @@ impl From<OwnedFd> for fs::File {
307
313
}
308
314
309
315
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
316
+ #[ cfg( not( target_os = "trusty" ) ) ]
310
317
impl AsFd for crate :: net:: TcpStream {
311
318
#[ inline]
312
319
fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -315,6 +322,7 @@ impl AsFd for crate::net::TcpStream {
315
322
}
316
323
317
324
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
325
+ #[ cfg( not( target_os = "trusty" ) ) ]
318
326
impl From < crate :: net:: TcpStream > for OwnedFd {
319
327
/// Takes ownership of a [`TcpStream`](crate::net::TcpStream)'s socket file descriptor.
320
328
#[ inline]
@@ -324,6 +332,7 @@ impl From<crate::net::TcpStream> for OwnedFd {
324
332
}
325
333
326
334
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
335
+ #[ cfg( not( target_os = "trusty" ) ) ]
327
336
impl From < OwnedFd > for crate :: net:: TcpStream {
328
337
#[ inline]
329
338
fn from ( owned_fd : OwnedFd ) -> Self {
@@ -334,6 +343,7 @@ impl From<OwnedFd> for crate::net::TcpStream {
334
343
}
335
344
336
345
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
346
+ #[ cfg( not( target_os = "trusty" ) ) ]
337
347
impl AsFd for crate :: net:: TcpListener {
338
348
#[ inline]
339
349
fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -342,6 +352,7 @@ impl AsFd for crate::net::TcpListener {
342
352
}
343
353
344
354
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
355
+ #[ cfg( not( target_os = "trusty" ) ) ]
345
356
impl From < crate :: net:: TcpListener > for OwnedFd {
346
357
/// Takes ownership of a [`TcpListener`](crate::net::TcpListener)'s socket file descriptor.
347
358
#[ inline]
@@ -351,6 +362,7 @@ impl From<crate::net::TcpListener> for OwnedFd {
351
362
}
352
363
353
364
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
365
+ #[ cfg( not( target_os = "trusty" ) ) ]
354
366
impl From < OwnedFd > for crate :: net:: TcpListener {
355
367
#[ inline]
356
368
fn from ( owned_fd : OwnedFd ) -> Self {
@@ -361,6 +373,7 @@ impl From<OwnedFd> for crate::net::TcpListener {
361
373
}
362
374
363
375
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
376
+ #[ cfg( not( target_os = "trusty" ) ) ]
364
377
impl AsFd for crate :: net:: UdpSocket {
365
378
#[ inline]
366
379
fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -369,6 +382,7 @@ impl AsFd for crate::net::UdpSocket {
369
382
}
370
383
371
384
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
385
+ #[ cfg( not( target_os = "trusty" ) ) ]
372
386
impl From < crate :: net:: UdpSocket > for OwnedFd {
373
387
/// Takes ownership of a [`UdpSocket`](crate::net::UdpSocket)'s file descriptor.
374
388
#[ inline]
@@ -378,6 +392,7 @@ impl From<crate::net::UdpSocket> for OwnedFd {
378
392
}
379
393
380
394
#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
395
+ #[ cfg( not( target_os = "trusty" ) ) ]
381
396
impl From < OwnedFd > for crate :: net:: UdpSocket {
382
397
#[ inline]
383
398
fn from ( owned_fd : OwnedFd ) -> Self {
0 commit comments