@@ -43,6 +43,8 @@ use libc::c_char;
43
43
use libc:: dirfd;
44
44
#[ cfg( any( target_os = "linux" , target_os = "emscripten" ) ) ]
45
45
use libc:: fstatat64;
46
+ #[ cfg( all( miri, any( target_os = "linux" ) ) ) ]
47
+ use libc:: open64;
46
48
#[ cfg( any(
47
49
target_os = "android" ,
48
50
target_os = "solaris" ,
@@ -89,7 +91,7 @@ use libc::{
89
91
use libc:: { dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, stat64} ;
90
92
91
93
// 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" ) ) ) ]
93
95
mod dir_fd;
94
96
95
97
pub use crate :: sys_common:: fs:: try_exists;
@@ -1085,7 +1087,7 @@ impl File {
1085
1087
pub fn open ( path : & Path , opts : & OpenOptions ) -> io:: Result < File > {
1086
1088
let result = run_path_with_cstr ( path, |path| File :: open_c ( None , & path, opts) ) ;
1087
1089
1088
- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1090
+ #[ cfg( all ( not ( miri ) , any( target_os = "linux" , target_os = "android" ) ) ) ]
1089
1091
let result = {
1090
1092
use crate :: io:: ErrorKind ;
1091
1093
match result {
@@ -1100,7 +1102,7 @@ impl File {
1100
1102
result
1101
1103
}
1102
1104
1103
- #[ cfg( not( any( target_os = "linux" , target_os = "android" ) ) ) ]
1105
+ #[ cfg( any ( miri , not( any( target_os = "linux" , target_os = "android" ) ) ) ) ]
1104
1106
pub fn open_c (
1105
1107
dirfd : Option < BorrowedFd < ' _ > > ,
1106
1108
path : & CStr ,
@@ -1779,7 +1781,8 @@ pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
1779
1781
1780
1782
macro long_filename_fallback ( $path: expr, $result: expr, $fallback: expr) { {
1781
1783
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" ) ) ) ] {
1783
1786
dir_fd:: long_filename_fallback( $result, $path, $fallback)
1784
1787
} else {
1785
1788
$result
0 commit comments