11//! libc syscalls supporting `rustix::fs`.
22
33use crate :: backend:: c;
4- # [ cfg ( any ( not ( target_os = "redox" ) , feature = "alloc" ) ) ]
5- use crate :: backend :: conv :: ret_usize;
6- use crate :: backend :: conv :: { borrowed_fd , c_str , ret , ret_c_int , ret_off_t , ret_owned_fd } ;
4+ use crate :: backend :: conv :: {
5+ borrowed_fd , c_str , ret , ret_c_int , ret_off_t , ret_owned_fd , ret_usize,
6+ } ;
77use crate :: fd:: { BorrowedFd , OwnedFd } ;
88#[ allow( unused_imports) ]
99use crate :: ffi;
@@ -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,
@@ -55,7 +55,6 @@ use crate::fs::Timestamps;
5555 apple,
5656 target_os = "espidf" ,
5757 target_os = "horizon" ,
58- target_os = "redox" ,
5958 target_os = "vita" ,
6059 target_os = "wasi"
6160) ) ) ]
@@ -206,7 +205,6 @@ fn openat_via_syscall(
206205 }
207206}
208207
209- #[ cfg( not( target_os = "redox" ) ) ]
210208pub ( crate ) fn openat (
211209 dirfd : BorrowedFd < ' _ > ,
212210 path : & CStr ,
@@ -288,7 +286,6 @@ pub(crate) fn readlink(path: &CStr, buf: &mut [u8]) -> io::Result<usize> {
288286 unsafe { ret_usize ( c:: readlink ( c_str ( path) , buf. as_mut_ptr ( ) . cast ( ) , buf. len ( ) ) as isize ) }
289287}
290288
291- #[ cfg( not( target_os = "redox" ) ) ]
292289#[ inline]
293290pub ( crate ) unsafe fn readlinkat (
294291 dirfd : BorrowedFd < ' _ > ,
@@ -302,7 +299,6 @@ pub(crate) fn mkdir(path: &CStr, mode: Mode) -> io::Result<()> {
302299 unsafe { ret ( c:: mkdir ( c_str ( path) , mode. bits ( ) as c:: mode_t ) ) }
303300}
304301
305- #[ cfg( not( target_os = "redox" ) ) ]
306302pub ( crate ) fn mkdirat ( dirfd : BorrowedFd < ' _ > , path : & CStr , mode : Mode ) -> io:: Result < ( ) > {
307303 unsafe {
308304 ret ( c:: mkdirat (
@@ -338,7 +334,7 @@ pub(crate) fn link(old_path: &CStr, new_path: &CStr) -> io::Result<()> {
338334 unsafe { ret ( c:: link ( c_str ( old_path) , c_str ( new_path) ) ) }
339335}
340336
341- #[ cfg( not( any ( target_os = "espidf" , target_os = "redox" ) ) ) ]
337+ #[ cfg( not( target_os = "espidf" ) ) ]
342338pub ( crate ) fn linkat (
343339 old_dirfd : BorrowedFd < ' _ > ,
344340 old_path : & CStr ,
@@ -401,7 +397,7 @@ pub(crate) fn unlink(path: &CStr) -> io::Result<()> {
401397 unsafe { ret ( c:: unlink ( c_str ( path) ) ) }
402398}
403399
404- #[ cfg( not( any ( target_os = "espidf" , target_os = "redox" ) ) ) ]
400+ #[ cfg( not( target_os = "espidf" ) ) ]
405401pub ( crate ) fn unlinkat ( dirfd : BorrowedFd < ' _ > , path : & CStr , flags : AtFlags ) -> io:: Result < ( ) > {
406402 // macOS ≤ 10.9 lacks `unlinkat`.
407403 #[ cfg( target_os = "macos" ) ]
@@ -628,7 +624,6 @@ pub(crate) fn symlink(old_path: &CStr, new_path: &CStr) -> io::Result<()> {
628624 unsafe { ret ( c:: symlink ( c_str ( old_path) , c_str ( new_path) ) ) }
629625}
630626
631- #[ cfg( not( target_os = "redox" ) ) ]
632627pub ( crate ) fn symlinkat (
633628 old_path : & CStr ,
634629 new_dirfd : BorrowedFd < ' _ > ,
@@ -730,7 +725,7 @@ pub(crate) fn lstat(path: &CStr) -> io::Result<Stat> {
730725 }
731726}
732727
733- #[ cfg( not( any ( target_os = "espidf" , target_os = "redox" ) ) ) ]
728+ #[ cfg( not( target_os = "espidf" ) ) ]
734729pub ( crate ) fn statat ( dirfd : BorrowedFd < ' _ > , path : & CStr , flags : AtFlags ) -> io:: Result < Stat > {
735730 // See the comments in `fstat` about using `crate::fs::statx` here.
736731 #[ cfg( all(
@@ -812,7 +807,6 @@ pub(crate) fn access(path: &CStr, access: Access) -> io::Result<()> {
812807 target_os = "emscripten" ,
813808 target_os = "espidf" ,
814809 target_os = "horizon" ,
815- target_os = "redox" ,
816810 target_os = "vita"
817811) ) ) ]
818812pub ( crate ) fn accessat (
@@ -880,12 +874,7 @@ pub(crate) fn accessat(
880874 Ok ( ( ) )
881875}
882876
883- #[ cfg( not( any(
884- target_os = "espidf" ,
885- target_os = "horizon" ,
886- target_os = "redox" ,
887- target_os = "vita"
888- ) ) ) ]
877+ #[ cfg( not( any( target_os = "espidf" , target_os = "horizon" , target_os = "vita" ) ) ) ]
889878pub ( crate ) fn utimensat (
890879 dirfd : BorrowedFd < ' _ > ,
891880 path : & CStr ,
@@ -1102,12 +1091,7 @@ pub(crate) fn chmod(path: &CStr, mode: Mode) -> io::Result<()> {
11021091 unsafe { ret ( c:: chmod ( c_str ( path) , mode. bits ( ) as c:: mode_t ) ) }
11031092}
11041093
1105- #[ cfg( not( any(
1106- linux_kernel,
1107- target_os = "espidf" ,
1108- target_os = "redox" ,
1109- target_os = "wasi"
1110- ) ) ) ]
1094+ #[ cfg( not( any( linux_kernel, target_os = "espidf" , target_os = "wasi" ) ) ) ]
11111095pub ( crate ) fn chmodat (
11121096 dirfd : BorrowedFd < ' _ > ,
11131097 path : & CStr ,
@@ -1185,7 +1169,7 @@ pub(crate) fn fclonefileat(
11851169 }
11861170}
11871171
1188- #[ cfg( not( any( target_os = "espidf" , target_os = "redox" , target_os = " wasi") ) ) ]
1172+ #[ cfg( not( any( target_os = "espidf" , target_os = "wasi" ) ) ) ]
11891173pub ( crate ) fn chownat (
11901174 dirfd : BorrowedFd < ' _ > ,
11911175 path : & CStr ,
@@ -1209,7 +1193,6 @@ pub(crate) fn chownat(
12091193 apple,
12101194 target_os = "espidf" ,
12111195 target_os = "horizon" ,
1212- target_os = "redox" ,
12131196 target_os = "vita" ,
12141197 target_os = "wasi"
12151198) ) ) ]
0 commit comments