@@ -8,6 +8,7 @@ use crate::fmt;
8
8
use crate :: fs;
9
9
use crate :: marker:: PhantomData ;
10
10
use crate :: mem:: forget;
11
+ #[ cfg( not( target_os = "wasi" ) ) ]
11
12
use crate :: sys:: cvt;
12
13
use crate :: sys_common:: { AsInner , FromInner , IntoInner } ;
13
14
@@ -71,6 +72,7 @@ impl BorrowedFd<'_> {
71
72
impl OwnedFd {
72
73
/// Creates a new `OwnedFd` instance that shares the same underlying file handle
73
74
/// as the existing `OwnedFd` instance.
75
+ #[ cfg( not( target_os = "wasi" ) ) ]
74
76
pub fn try_clone ( & self ) -> crate :: io:: Result < Self > {
75
77
// We want to atomically duplicate this file descriptor and set the
76
78
// CLOEXEC flag, and currently that's done via F_DUPFD_CLOEXEC. This
@@ -88,6 +90,14 @@ impl OwnedFd {
88
90
let fd = cvt ( unsafe { libc:: fcntl ( self . as_raw_fd ( ) , cmd, 0 ) } ) ?;
89
91
Ok ( unsafe { Self :: from_raw_fd ( fd) } )
90
92
}
93
+
94
+ #[ cfg( target_os = "wasi" ) ]
95
+ pub fn try_clone ( & self ) -> crate :: io:: Result < Self > {
96
+ Err ( crate :: io:: Error :: new_const (
97
+ crate :: io:: ErrorKind :: Unsupported ,
98
+ & "operation not supported on WASI yet" ,
99
+ ) )
100
+ }
91
101
}
92
102
93
103
#[ unstable( feature = "io_safety" , issue = "87074" ) ]
0 commit comments