66use super :: raw:: { AsRawFd , FromRawFd , IntoRawFd , RawFd } ;
77use crate :: marker:: PhantomData ;
88use 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" ) ) ) ]
1010use crate :: sys:: cvt;
11+ #[ cfg( not( target_os = "trusty" ) ) ]
1112use 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;
1316
1417type ValidRawFd = core:: num:: niche_types:: NotAllOnes < RawFd > ;
1518
@@ -87,7 +90,7 @@ impl OwnedFd {
8790impl BorrowedFd < ' _ > {
8891 /// Creates a new `OwnedFd` instance that shares the same underlying file
8992 /// 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" ) ) ) ]
9194 #[ stable( feature = "io_safety" , since = "1.63.0" ) ]
9295 pub fn try_clone_to_owned ( & self ) -> crate :: io:: Result < OwnedFd > {
9396 // We want to atomically duplicate this file descriptor and set the
@@ -110,7 +113,7 @@ impl BorrowedFd<'_> {
110113
111114 /// Creates a new `OwnedFd` instance that shares the same underlying file
112115 /// 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" ) ) ]
114117 #[ stable( feature = "io_safety" , since = "1.63.0" ) ]
115118 pub fn try_clone_to_owned ( & self ) -> crate :: io:: Result < OwnedFd > {
116119 Err ( crate :: io:: Error :: UNSUPPORTED_PLATFORM )
@@ -280,6 +283,7 @@ impl AsFd for OwnedFd {
280283}
281284
282285#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
286+ #[ cfg( not( target_os = "trusty" ) ) ]
283287impl AsFd for fs:: File {
284288 #[ inline]
285289 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -288,6 +292,7 @@ impl AsFd for fs::File {
288292}
289293
290294#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
295+ #[ cfg( not( target_os = "trusty" ) ) ]
291296impl From < fs:: File > for OwnedFd {
292297 /// Takes ownership of a [`File`](fs::File)'s underlying file descriptor.
293298 #[ inline]
@@ -297,6 +302,7 @@ impl From<fs::File> for OwnedFd {
297302}
298303
299304#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
305+ #[ cfg( not( target_os = "trusty" ) ) ]
300306impl From < OwnedFd > for fs:: File {
301307 /// Returns a [`File`](fs::File) that takes ownership of the given
302308 /// file descriptor.
@@ -307,6 +313,7 @@ impl From<OwnedFd> for fs::File {
307313}
308314
309315#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
316+ #[ cfg( not( target_os = "trusty" ) ) ]
310317impl AsFd for crate :: net:: TcpStream {
311318 #[ inline]
312319 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -315,6 +322,7 @@ impl AsFd for crate::net::TcpStream {
315322}
316323
317324#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
325+ #[ cfg( not( target_os = "trusty" ) ) ]
318326impl From < crate :: net:: TcpStream > for OwnedFd {
319327 /// Takes ownership of a [`TcpStream`](crate::net::TcpStream)'s socket file descriptor.
320328 #[ inline]
@@ -324,6 +332,7 @@ impl From<crate::net::TcpStream> for OwnedFd {
324332}
325333
326334#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
335+ #[ cfg( not( target_os = "trusty" ) ) ]
327336impl From < OwnedFd > for crate :: net:: TcpStream {
328337 #[ inline]
329338 fn from ( owned_fd : OwnedFd ) -> Self {
@@ -334,6 +343,7 @@ impl From<OwnedFd> for crate::net::TcpStream {
334343}
335344
336345#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
346+ #[ cfg( not( target_os = "trusty" ) ) ]
337347impl AsFd for crate :: net:: TcpListener {
338348 #[ inline]
339349 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -342,6 +352,7 @@ impl AsFd for crate::net::TcpListener {
342352}
343353
344354#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
355+ #[ cfg( not( target_os = "trusty" ) ) ]
345356impl From < crate :: net:: TcpListener > for OwnedFd {
346357 /// Takes ownership of a [`TcpListener`](crate::net::TcpListener)'s socket file descriptor.
347358 #[ inline]
@@ -351,6 +362,7 @@ impl From<crate::net::TcpListener> for OwnedFd {
351362}
352363
353364#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
365+ #[ cfg( not( target_os = "trusty" ) ) ]
354366impl From < OwnedFd > for crate :: net:: TcpListener {
355367 #[ inline]
356368 fn from ( owned_fd : OwnedFd ) -> Self {
@@ -361,6 +373,7 @@ impl From<OwnedFd> for crate::net::TcpListener {
361373}
362374
363375#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
376+ #[ cfg( not( target_os = "trusty" ) ) ]
364377impl AsFd for crate :: net:: UdpSocket {
365378 #[ inline]
366379 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -369,6 +382,7 @@ impl AsFd for crate::net::UdpSocket {
369382}
370383
371384#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
385+ #[ cfg( not( target_os = "trusty" ) ) ]
372386impl From < crate :: net:: UdpSocket > for OwnedFd {
373387 /// Takes ownership of a [`UdpSocket`](crate::net::UdpSocket)'s file descriptor.
374388 #[ inline]
@@ -378,6 +392,7 @@ impl From<crate::net::UdpSocket> for OwnedFd {
378392}
379393
380394#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
395+ #[ cfg( not( target_os = "trusty" ) ) ]
381396impl From < OwnedFd > for crate :: net:: UdpSocket {
382397 #[ inline]
383398 fn from ( owned_fd : OwnedFd ) -> Self {
0 commit comments