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