33use super :: super :: c;
44#[ cfg( not( any( target_os = "wasi" , target_os = "fuchsia" ) ) ) ]
55use super :: super :: conv:: borrowed_fd;
6- #[ cfg( not( target_os = "wasi" ) ) ]
7- use super :: super :: conv:: ret_pid_t;
86use super :: super :: conv:: { c_str, ret, ret_c_int, ret_discarded_char_ptr} ;
7+ #[ cfg( not( target_os = "wasi" ) ) ]
8+ use super :: super :: conv:: { ret_infallible, ret_pid_t} ;
99#[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
1010use super :: super :: conv:: { syscall_ret, syscall_ret_u32} ;
1111#[ cfg( any(
@@ -20,24 +20,25 @@ use crate::fd::BorrowedFd;
2020#[ cfg( target_os = "linux" ) ]
2121use crate :: fd:: { AsRawFd , OwnedFd } ;
2222use crate :: ffi:: CStr ;
23+ #[ cfg( feature = "fs" ) ]
24+ use crate :: fs:: Mode ;
2325use crate :: io;
2426#[ cfg( not( any( target_os = "wasi" , target_os = "redox" , target_os = "openbsd" ) ) ) ]
2527use crate :: process:: { WaitId , WaitidOptions , WaitidStatus } ;
2628use core:: mem:: MaybeUninit ;
27- #[ cfg( not( any( target_os = "fuchsia" , target_os = "redox" , target_os = "wasi" ) ) ) ]
28- use {
29- super :: super :: conv:: ret_infallible,
30- super :: super :: offset:: { libc_getrlimit, libc_rlimit, libc_setrlimit, LIBC_RLIM_INFINITY } ,
31- crate :: process:: { Resource , Rlimit } ,
32- core:: convert:: TryInto ,
33- } ;
3429#[ cfg( target_os = "linux" ) ]
3530use { super :: super :: conv:: syscall_ret_owned_fd, crate :: process:: PidfdFlags } ;
3631#[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
3732use {
3833 super :: super :: offset:: libc_prlimit,
3934 crate :: process:: { Cpuid , MembarrierCommand , MembarrierQuery } ,
4035} ;
36+ #[ cfg( not( any( target_os = "fuchsia" , target_os = "redox" , target_os = "wasi" ) ) ) ]
37+ use {
38+ super :: super :: offset:: { libc_getrlimit, libc_rlimit, libc_setrlimit, LIBC_RLIM_INFINITY } ,
39+ crate :: process:: { Resource , Rlimit } ,
40+ core:: convert:: TryInto ,
41+ } ;
4142#[ cfg( not( target_os = "wasi" ) ) ]
4243use {
4344 super :: types:: RawUname ,
@@ -220,11 +221,19 @@ pub(crate) fn sched_yield() {
220221pub ( crate ) fn uname ( ) -> RawUname {
221222 let mut uname = MaybeUninit :: < RawUname > :: uninit ( ) ;
222223 unsafe {
223- ret ( c:: uname ( uname. as_mut_ptr ( ) ) ) . unwrap ( ) ;
224+ ret_infallible ( c:: uname ( uname. as_mut_ptr ( ) ) ) ;
224225 uname. assume_init ( )
225226 }
226227}
227228
229+ #[ cfg( not( target_os = "wasi" ) ) ]
230+ #[ cfg( feature = "fs" ) ]
231+ #[ inline]
232+ pub ( crate ) fn umask ( mask : Mode ) -> Mode {
233+ // TODO: Use `from_bits_retain` when we switch to bitflags 2.0.
234+ unsafe { Mode :: from_bits_truncate ( c:: umask ( mask. bits ( ) as _ ) as _ ) }
235+ }
236+
228237#[ cfg( not( any( target_os = "fuchsia" , target_os = "wasi" ) ) ) ]
229238#[ inline]
230239pub ( crate ) fn nice ( inc : i32 ) -> io:: Result < i32 > {
0 commit comments