@@ -43,6 +43,8 @@ use libc::c_char;
4343use libc:: dirfd;
4444#[ cfg( any( target_os = "linux" , target_os = "emscripten" ) ) ]
4545use libc:: fstatat64;
46+ #[ cfg( all( miri, any( target_os = "linux" ) ) ) ]
47+ use libc:: open64;
4648#[ cfg( any(
4749 target_os = "android" ,
4850 target_os = "solaris" ,
@@ -89,7 +91,7 @@ use libc::{
8991use libc:: { dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, stat64} ;
9092
9193// FIXME: port this to other unices that support *at syscalls
92- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
94+ #[ cfg( all ( not ( miri ) , any( target_os = "linux" , target_os = "android" ) ) ) ]
9395mod dir_fd;
9496
9597pub use crate :: sys_common:: fs:: try_exists;
@@ -1085,7 +1087,7 @@ impl File {
10851087 pub fn open ( path : & Path , opts : & OpenOptions ) -> io:: Result < File > {
10861088 let result = run_path_with_cstr ( path, |path| File :: open_c ( None , & path, opts) ) ;
10871089
1088- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1090+ #[ cfg( all ( not ( miri ) , any( target_os = "linux" , target_os = "android" ) ) ) ]
10891091 let result = {
10901092 use crate :: io:: ErrorKind ;
10911093 match result {
@@ -1100,7 +1102,7 @@ impl File {
11001102 result
11011103 }
11021104
1103- #[ cfg( not( any( target_os = "linux" , target_os = "android" ) ) ) ]
1105+ #[ cfg( any ( miri , not( any( target_os = "linux" , target_os = "android" ) ) ) ) ]
11041106 pub fn open_c (
11051107 dirfd : Option < BorrowedFd < ' _ > > ,
11061108 path : & CStr ,
@@ -1779,7 +1781,8 @@ pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
17791781
17801782macro long_filename_fallback ( $path: expr, $result: expr, $fallback: expr) { {
17811783 cfg_if:: cfg_if! {
1782- if #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ] {
1784+ // miri doesn't support the *at syscalls
1785+ if #[ cfg( all( not( miri) , any( target_os = "linux" , target_os = "android" ) ) ) ] {
17831786 dir_fd:: long_filename_fallback( $result, $path, $fallback)
17841787 } else {
17851788 $result
0 commit comments