11//! libc syscalls supporting `rustix::fs`.
22
33use crate :: backend:: c;
4- #[ cfg( any ( not ( target_os = "redox" ) , feature = "alloc" ) ) ]
4+ #[ cfg( feature = "alloc" ) ]
55use crate :: backend:: conv:: ret_usize;
66use crate :: backend:: conv:: { borrowed_fd, c_str, ret, ret_c_int, ret_off_t, ret_owned_fd} ;
77use crate :: fd:: { BorrowedFd , OwnedFd } ;
@@ -12,7 +12,7 @@ use crate::ffi::CStr;
1212use crate :: ffi:: CString ;
1313#[ cfg( not( any( target_os = "espidf" , target_os = "horizon" , target_os = "vita" ) ) ) ]
1414use crate :: fs:: Access ;
15- #[ cfg( not( any ( target_os = "espidf" , target_os = "redox" ) ) ) ]
15+ #[ cfg( not( target_os = "espidf" ) ) ]
1616use crate :: fs:: AtFlags ;
1717#[ cfg( not( any(
1818 netbsdlike,
@@ -287,7 +287,6 @@ pub(crate) fn readlink(path: &CStr, buf: &mut [u8]) -> io::Result<usize> {
287287 unsafe { ret_usize ( c:: readlink ( c_str ( path) , buf. as_mut_ptr ( ) . cast ( ) , buf. len ( ) ) as isize ) }
288288}
289289
290- #[ cfg( not( target_os = "redox" ) ) ]
291290#[ inline]
292291pub ( crate ) unsafe fn readlinkat (
293292 dirfd : BorrowedFd < ' _ > ,
@@ -301,7 +300,6 @@ pub(crate) fn mkdir(path: &CStr, mode: Mode) -> io::Result<()> {
301300 unsafe { ret ( c:: mkdir ( c_str ( path) , mode. bits ( ) as c:: mode_t ) ) }
302301}
303302
304- #[ cfg( not( target_os = "redox" ) ) ]
305303pub ( crate ) fn mkdirat ( dirfd : BorrowedFd < ' _ > , path : & CStr , mode : Mode ) -> io:: Result < ( ) > {
306304 unsafe {
307305 ret ( c:: mkdirat (
@@ -337,7 +335,7 @@ pub(crate) fn link(old_path: &CStr, new_path: &CStr) -> io::Result<()> {
337335 unsafe { ret ( c:: link ( c_str ( old_path) , c_str ( new_path) ) ) }
338336}
339337
340- #[ cfg( not( any ( target_os = "espidf" , target_os = "redox" ) ) ) ]
338+ #[ cfg( not( target_os = "espidf" ) ) ]
341339pub ( crate ) fn linkat (
342340 old_dirfd : BorrowedFd < ' _ > ,
343341 old_path : & CStr ,
@@ -400,7 +398,7 @@ pub(crate) fn unlink(path: &CStr) -> io::Result<()> {
400398 unsafe { ret ( c:: unlink ( c_str ( path) ) ) }
401399}
402400
403- #[ cfg( not( any ( target_os = "espidf" , target_os = "redox" ) ) ) ]
401+ #[ cfg( not( target_os = "espidf" ) ) ]
404402pub ( crate ) fn unlinkat ( dirfd : BorrowedFd < ' _ > , path : & CStr , flags : AtFlags ) -> io:: Result < ( ) > {
405403 // macOS ≤ 10.9 lacks `unlinkat`.
406404 #[ cfg( target_os = "macos" ) ]
@@ -627,7 +625,6 @@ pub(crate) fn symlink(old_path: &CStr, new_path: &CStr) -> io::Result<()> {
627625 unsafe { ret ( c:: symlink ( c_str ( old_path) , c_str ( new_path) ) ) }
628626}
629627
630- #[ cfg( not( target_os = "redox" ) ) ]
631628pub ( crate ) fn symlinkat (
632629 old_path : & CStr ,
633630 new_dirfd : BorrowedFd < ' _ > ,
@@ -729,7 +726,7 @@ pub(crate) fn lstat(path: &CStr) -> io::Result<Stat> {
729726 }
730727}
731728
732- #[ cfg( not( any ( target_os = "espidf" , target_os = "redox" ) ) ) ]
729+ #[ cfg( not( target_os = "espidf" ) ) ]
733730pub ( crate ) fn statat ( dirfd : BorrowedFd < ' _ > , path : & CStr , flags : AtFlags ) -> io:: Result < Stat > {
734731 // See the comments in `fstat` about using `crate::fs::statx` here.
735732 #[ cfg( all(
@@ -811,7 +808,6 @@ pub(crate) fn access(path: &CStr, access: Access) -> io::Result<()> {
811808 target_os = "emscripten" ,
812809 target_os = "espidf" ,
813810 target_os = "horizon" ,
814- target_os = "redox" ,
815811 target_os = "vita"
816812) ) ) ]
817813pub ( crate ) fn accessat (
@@ -879,12 +875,7 @@ pub(crate) fn accessat(
879875 Ok ( ( ) )
880876}
881877
882- #[ cfg( not( any(
883- target_os = "espidf" ,
884- target_os = "horizon" ,
885- target_os = "redox" ,
886- target_os = "vita"
887- ) ) ) ]
878+ #[ cfg( not( any( target_os = "espidf" , target_os = "horizon" , target_os = "vita" ) ) ) ]
888879pub ( crate ) fn utimensat (
889880 dirfd : BorrowedFd < ' _ > ,
890881 path : & CStr ,
@@ -1092,12 +1083,7 @@ pub(crate) fn chmod(path: &CStr, mode: Mode) -> io::Result<()> {
10921083 unsafe { ret ( c:: chmod ( c_str ( path) , mode. bits ( ) as c:: mode_t ) ) }
10931084}
10941085
1095- #[ cfg( not( any(
1096- linux_kernel,
1097- target_os = "espidf" ,
1098- target_os = "redox" ,
1099- target_os = "wasi"
1100- ) ) ) ]
1086+ #[ cfg( not( any( linux_kernel, target_os = "espidf" , target_os = "wasi" ) ) ) ]
11011087pub ( crate ) fn chmodat (
11021088 dirfd : BorrowedFd < ' _ > ,
11031089 path : & CStr ,
@@ -1175,7 +1161,7 @@ pub(crate) fn fclonefileat(
11751161 }
11761162}
11771163
1178- #[ cfg( not( any( target_os = "espidf" , target_os = "redox" , target_os = " wasi") ) ) ]
1164+ #[ cfg( not( any( target_os = "espidf" , target_os = "wasi" ) ) ) ]
11791165pub ( crate ) fn chownat (
11801166 dirfd : BorrowedFd < ' _ > ,
11811167 path : & CStr ,
@@ -1199,7 +1185,6 @@ pub(crate) fn chownat(
11991185 apple,
12001186 target_os = "espidf" ,
12011187 target_os = "horizon" ,
1202- target_os = "redox" ,
12031188 target_os = "vita" ,
12041189 target_os = "wasi"
12051190) ) ) ]
0 commit comments