@@ -105,8 +105,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
105
105
// Now, `result` is the value we return back to the program.
106
106
this. write_scalar ( Scalar :: from_target_isize ( result, this) , dest) ?;
107
107
}
108
- #[ cfg( unix) ]
109
108
"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
+ }
110
115
let [ fd, buf, count, offset] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
111
116
let fd = this. read_scalar ( fd) ?. to_i32 ( ) ?;
112
117
let buf = this. read_pointer ( buf) ?;
@@ -115,8 +120,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
115
120
let result = this. pread ( fd, buf, count, offset) ?;
116
121
this. write_scalar ( Scalar :: from_target_isize ( result, this) , dest) ?;
117
122
}
118
- #[ cfg( unix) ]
119
123
"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
+ }
120
130
let [ fd, buf, n, offset] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
121
131
let fd = this. read_scalar ( fd) ?. to_i32 ( ) ?;
122
132
let buf = this. read_pointer ( buf) ?;
@@ -127,12 +137,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
127
137
// Now, `result` is the value we return back to the program.
128
138
this. write_scalar ( Scalar :: from_target_isize ( result, this) , dest) ?;
129
139
}
130
- #[ cfg( any(
131
- all( target_os = "linux" , not( target_env = "musl" ) ) ,
132
- target_os = "android" ,
133
- target_os = "hurd"
134
- ) ) ]
135
140
"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
+ }
136
147
let [ fd, buf, count, offset] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
137
148
let fd = this. read_scalar ( fd) ?. to_i32 ( ) ?;
138
149
let buf = this. read_pointer ( buf) ?;
@@ -141,12 +152,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
141
152
let result = this. pread ( fd, buf, count, offset) ?;
142
153
this. write_scalar ( Scalar :: from_target_isize ( result, this) , dest) ?;
143
154
}
144
- #[ cfg( any(
145
- all( target_os = "linux" , not( target_env = "musl" ) ) ,
146
- target_os = "android" ,
147
- target_os = "hurd"
148
- ) ) ]
149
155
"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
+ }
150
162
let [ fd, buf, n, offset] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
151
163
let fd = this. read_scalar ( fd) ?. to_i32 ( ) ?;
152
164
let buf = this. read_pointer ( buf) ?;
0 commit comments