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
@@ -89,7 +92,7 @@ impl OwnedFd {
8992impl BorrowedFd < ' _ > {
9093 /// Creates a new `OwnedFd` instance that shares the same underlying file
9194 /// 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" ) ) ) ]
9396 #[ stable( feature = "io_safety" , since = "1.63.0" ) ]
9497 pub fn try_clone_to_owned ( & self ) -> crate :: io:: Result < OwnedFd > {
9598 // We want to atomically duplicate this file descriptor and set the
@@ -112,7 +115,7 @@ impl BorrowedFd<'_> {
112115
113116 /// Creates a new `OwnedFd` instance that shares the same underlying file
114117 /// 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" ) ) ]
116119 #[ stable( feature = "io_safety" , since = "1.63.0" ) ]
117120 pub fn try_clone_to_owned ( & self ) -> crate :: io:: Result < OwnedFd > {
118121 Err ( crate :: io:: Error :: UNSUPPORTED_PLATFORM )
@@ -284,6 +287,7 @@ impl AsFd for OwnedFd {
284287}
285288
286289#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
290+ #[ cfg( not( target_os = "trusty" ) ) ]
287291impl AsFd for fs:: File {
288292 #[ inline]
289293 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -292,6 +296,7 @@ impl AsFd for fs::File {
292296}
293297
294298#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
299+ #[ cfg( not( target_os = "trusty" ) ) ]
295300impl From < fs:: File > for OwnedFd {
296301 /// Takes ownership of a [`File`](fs::File)'s underlying file descriptor.
297302 #[ inline]
@@ -301,6 +306,7 @@ impl From<fs::File> for OwnedFd {
301306}
302307
303308#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
309+ #[ cfg( not( target_os = "trusty" ) ) ]
304310impl From < OwnedFd > for fs:: File {
305311 /// Returns a [`File`](fs::File) that takes ownership of the given
306312 /// file descriptor.
@@ -311,6 +317,7 @@ impl From<OwnedFd> for fs::File {
311317}
312318
313319#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
320+ #[ cfg( not( target_os = "trusty" ) ) ]
314321impl AsFd for crate :: net:: TcpStream {
315322 #[ inline]
316323 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -319,6 +326,7 @@ impl AsFd for crate::net::TcpStream {
319326}
320327
321328#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
329+ #[ cfg( not( target_os = "trusty" ) ) ]
322330impl From < crate :: net:: TcpStream > for OwnedFd {
323331 /// Takes ownership of a [`TcpStream`](crate::net::TcpStream)'s socket file descriptor.
324332 #[ inline]
@@ -328,6 +336,7 @@ impl From<crate::net::TcpStream> for OwnedFd {
328336}
329337
330338#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
339+ #[ cfg( not( target_os = "trusty" ) ) ]
331340impl From < OwnedFd > for crate :: net:: TcpStream {
332341 #[ inline]
333342 fn from ( owned_fd : OwnedFd ) -> Self {
@@ -338,6 +347,7 @@ impl From<OwnedFd> for crate::net::TcpStream {
338347}
339348
340349#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
350+ #[ cfg( not( target_os = "trusty" ) ) ]
341351impl AsFd for crate :: net:: TcpListener {
342352 #[ inline]
343353 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -346,6 +356,7 @@ impl AsFd for crate::net::TcpListener {
346356}
347357
348358#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
359+ #[ cfg( not( target_os = "trusty" ) ) ]
349360impl From < crate :: net:: TcpListener > for OwnedFd {
350361 /// Takes ownership of a [`TcpListener`](crate::net::TcpListener)'s socket file descriptor.
351362 #[ inline]
@@ -355,6 +366,7 @@ impl From<crate::net::TcpListener> for OwnedFd {
355366}
356367
357368#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
369+ #[ cfg( not( target_os = "trusty" ) ) ]
358370impl From < OwnedFd > for crate :: net:: TcpListener {
359371 #[ inline]
360372 fn from ( owned_fd : OwnedFd ) -> Self {
@@ -365,6 +377,7 @@ impl From<OwnedFd> for crate::net::TcpListener {
365377}
366378
367379#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
380+ #[ cfg( not( target_os = "trusty" ) ) ]
368381impl AsFd for crate :: net:: UdpSocket {
369382 #[ inline]
370383 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
@@ -373,6 +386,7 @@ impl AsFd for crate::net::UdpSocket {
373386}
374387
375388#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
389+ #[ cfg( not( target_os = "trusty" ) ) ]
376390impl From < crate :: net:: UdpSocket > for OwnedFd {
377391 /// Takes ownership of a [`UdpSocket`](crate::net::UdpSocket)'s file descriptor.
378392 #[ inline]
@@ -382,6 +396,7 @@ impl From<crate::net::UdpSocket> for OwnedFd {
382396}
383397
384398#[ stable( feature = "io_safety" , since = "1.63.0" ) ]
399+ #[ cfg( not( target_os = "trusty" ) ) ]
385400impl From < OwnedFd > for crate :: net:: UdpSocket {
386401 #[ inline]
387402 fn from ( owned_fd : OwnedFd ) -> Self {
0 commit comments