44#![ deny( unsafe_op_in_unsafe_fn) ]
55
66use super :: raw:: { AsRawFd , FromRawFd , IntoRawFd , RawFd } ;
7+ #[ cfg( not( target_os = "trusty" ) ) ]
8+ use crate :: fs;
79use crate :: marker:: PhantomData ;
810use 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+ ) ) ) ]
1017use crate :: sys:: cvt;
18+ #[ cfg( not( target_os = "trusty" ) ) ]
1119use crate :: sys_common:: { AsInner , FromInner , IntoInner } ;
12- use crate :: { fmt, fs , io} ;
20+ use crate :: { fmt, io} ;
1321
1422type ValidRawFd = core:: num:: niche_types:: NotAllOnes < RawFd > ;
1523
@@ -87,7 +95,7 @@ impl OwnedFd {
8795impl BorrowedFd < ' _ > {
8896 /// Creates a new `OwnedFd` instance that shares the same underlying file
8997 /// 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" ) ) ) ]
9199 #[ stable( feature = "io_safety" , since = "1.63.0" ) ]
92100 pub fn try_clone_to_owned ( & self ) -> crate :: io:: Result < OwnedFd > {
93101 // We want to atomically duplicate this file descriptor and set the
@@ -110,7 +118,7 @@ impl BorrowedFd<'_> {
110118
111119 /// Creates a new `OwnedFd` instance that shares the same underlying file
112120 /// 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" ) ) ]
114122 #[ stable( feature = "io_safety" , since = "1.63.0" ) ]
115123 pub fn try_clone_to_owned ( & self ) -> crate :: io:: Result < OwnedFd > {
116124 Err ( crate :: io:: Error :: UNSUPPORTED_PLATFORM )
@@ -280,6 +288,7 @@ impl AsFd for OwnedFd {
280288}
281289
282290#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
291+ #[ cfg( not( target_os = "trusty" ) ) ]
283292impl AsFd for fs:: File {
284293 #[ inline]
285294 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -288,6 +297,7 @@ impl AsFd for fs::File {
288297}
289298
290299#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
300+ #[ cfg( not( target_os = "trusty" ) ) ]
291301impl From < fs:: File > for OwnedFd {
292302 /// Takes ownership of a [`File`](fs::File)'s underlying file descriptor.
293303 #[ inline]
@@ -297,6 +307,7 @@ impl From<fs::File> for OwnedFd {
297307}
298308
299309#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
310+ #[ cfg( not( target_os = "trusty" ) ) ]
300311impl From < OwnedFd > for fs:: File {
301312 /// Returns a [`File`](fs::File) that takes ownership of the given
302313 /// file descriptor.
@@ -307,6 +318,7 @@ impl From<OwnedFd> for fs::File {
307318}
308319
309320#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
321+ #[ cfg( not( target_os = "trusty" ) ) ]
310322impl AsFd for crate :: net:: TcpStream {
311323 #[ inline]
312324 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -315,6 +327,7 @@ impl AsFd for crate::net::TcpStream {
315327}
316328
317329#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
330+ #[ cfg( not( target_os = "trusty" ) ) ]
318331impl From < crate :: net:: TcpStream > for OwnedFd {
319332 /// Takes ownership of a [`TcpStream`](crate::net::TcpStream)'s socket file descriptor.
320333 #[ inline]
@@ -324,6 +337,7 @@ impl From<crate::net::TcpStream> for OwnedFd {
324337}
325338
326339#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
340+ #[ cfg( not( target_os = "trusty" ) ) ]
327341impl From < OwnedFd > for crate :: net:: TcpStream {
328342 #[ inline]
329343 fn from ( owned_fd : OwnedFd ) -> Self {
@@ -334,6 +348,7 @@ impl From<OwnedFd> for crate::net::TcpStream {
334348}
335349
336350#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
351+ #[ cfg( not( target_os = "trusty" ) ) ]
337352impl AsFd for crate :: net:: TcpListener {
338353 #[ inline]
339354 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -342,6 +357,7 @@ impl AsFd for crate::net::TcpListener {
342357}
343358
344359#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
360+ #[ cfg( not( target_os = "trusty" ) ) ]
345361impl From < crate :: net:: TcpListener > for OwnedFd {
346362 /// Takes ownership of a [`TcpListener`](crate::net::TcpListener)'s socket file descriptor.
347363 #[ inline]
@@ -351,6 +367,7 @@ impl From<crate::net::TcpListener> for OwnedFd {
351367}
352368
353369#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
370+ #[ cfg( not( target_os = "trusty" ) ) ]
354371impl From < OwnedFd > for crate :: net:: TcpListener {
355372 #[ inline]
356373 fn from ( owned_fd : OwnedFd ) -> Self {
@@ -361,6 +378,7 @@ impl From<OwnedFd> for crate::net::TcpListener {
361378}
362379
363380#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
381+ #[ cfg( not( target_os = "trusty" ) ) ]
364382impl AsFd for crate :: net:: UdpSocket {
365383 #[ inline]
366384 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -369,6 +387,7 @@ impl AsFd for crate::net::UdpSocket {
369387}
370388
371389#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
390+ #[ cfg( not( target_os = "trusty" ) ) ]
372391impl From < crate :: net:: UdpSocket > for OwnedFd {
373392 /// Takes ownership of a [`UdpSocket`](crate::net::UdpSocket)'s file descriptor.
374393 #[ inline]
@@ -378,6 +397,7 @@ impl From<crate::net::UdpSocket> for OwnedFd {
378397}
379398
380399#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
400+ #[ cfg( not( target_os = "trusty" ) ) ]
381401impl From < OwnedFd > for crate :: net:: UdpSocket {
382402 #[ inline]
383403 fn from ( owned_fd : OwnedFd ) -> Self {
0 commit comments