@@ -105,8 +105,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
105105 // Now, `result` is the value we return back to the program.
106106 this. write_scalar ( Scalar :: from_target_isize ( result, this) , dest) ?;
107107 }
108- #[ cfg( unix) ]
109108 "pread" => {
109+ if matches ! ( & * this. tcx. sess. target. os, "windows" ) {
110+ throw_unsup_format ! (
111+ "`pread` is not supported on {}" ,
112+ this. tcx. sess. target. os
113+ ) ;
114+ }
110115 let [ fd, buf, count, offset] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
111116 let fd = this. read_scalar ( fd) ?. to_i32 ( ) ?;
112117 let buf = this. read_pointer ( buf) ?;
@@ -115,8 +120,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
115120 let result = this. pread ( fd, buf, count, offset) ?;
116121 this. write_scalar ( Scalar :: from_target_isize ( result, this) , dest) ?;
117122 }
118- #[ cfg( unix) ]
119123 "pwrite" => {
124+ if matches ! ( & * this. tcx. sess. target. os, "windows" ) {
125+ throw_unsup_format ! (
126+ "`pwrite` is not supported on {}" ,
127+ this. tcx. sess. target. os
128+ ) ;
129+ }
120130 let [ fd, buf, n, offset] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
121131 let fd = this. read_scalar ( fd) ?. to_i32 ( ) ?;
122132 let buf = this. read_pointer ( buf) ?;
@@ -127,12 +137,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
127137 // Now, `result` is the value we return back to the program.
128138 this. write_scalar ( Scalar :: from_target_isize ( result, this) , dest) ?;
129139 }
130- #[ cfg( any(
131- all( target_os = "linux" , not( target_env = "musl" ) ) ,
132- target_os = "android" ,
133- target_os = "hurd"
134- ) ) ]
135140 "pread64" => {
141+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "android" | "hurd" ) {
142+ throw_unsup_format ! (
143+ "`pread64` is not supported on {}" ,
144+ this. tcx. sess. target. os
145+ ) ;
146+ }
136147 let [ fd, buf, count, offset] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
137148 let fd = this. read_scalar ( fd) ?. to_i32 ( ) ?;
138149 let buf = this. read_pointer ( buf) ?;
@@ -141,12 +152,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
141152 let result = this. pread ( fd, buf, count, offset) ?;
142153 this. write_scalar ( Scalar :: from_target_isize ( result, this) , dest) ?;
143154 }
144- #[ cfg( any(
145- all( target_os = "linux" , not( target_env = "musl" ) ) ,
146- target_os = "android" ,
147- target_os = "hurd"
148- ) ) ]
149155 "pwrite64" => {
156+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "android" | "hurd" ) {
157+ throw_unsup_format ! (
158+ "`pwrite64` is not supported on {}" ,
159+ this. tcx. sess. target. os
160+ ) ;
161+ }
150162 let [ fd, buf, n, offset] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
151163 let fd = this. read_scalar ( fd) ?. to_i32 ( ) ?;
152164 let buf = this. read_pointer ( buf) ?;
0 commit comments