Skip to content

Commit 5ba2c1e

Browse files
committed
posix_fadvise is not Linux-specific
1 parent ae51998 commit 5ba2c1e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/shims/unix/foreign_items.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,16 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
153153
let result = this.readlink(pathname, buf, bufsize)?;
154154
this.write_scalar(Scalar::from_machine_isize(result, this), dest)?;
155155
}
156+
"posix_fadvise" => {
157+
let [fd, offset, len, advice] =
158+
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
159+
this.read_scalar(fd)?.to_i32()?;
160+
this.read_scalar(offset)?.to_machine_isize(this)?;
161+
this.read_scalar(len)?.to_machine_isize(this)?;
162+
this.read_scalar(advice)?.to_i32()?;
163+
// fadvise is only informational, we can ignore it.
164+
this.write_null(dest)?;
165+
}
156166

157167
// Time related shims
158168
"gettimeofday" => {

src/shims/unix/linux/foreign_items.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
3636
this.write_scalar(result, dest)?;
3737
}
3838
// Linux-only
39-
"posix_fadvise" => {
40-
let [fd, offset, len, advice] =
41-
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
42-
this.read_scalar(fd)?.to_i32()?;
43-
this.read_scalar(offset)?.to_machine_isize(this)?;
44-
this.read_scalar(len)?.to_machine_isize(this)?;
45-
this.read_scalar(advice)?.to_i32()?;
46-
// fadvise is only informational, we can ignore it.
47-
this.write_null(dest)?;
48-
}
4939
"sync_file_range" => {
5040
let [fd, offset, nbytes, flags] =
5141
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;

0 commit comments

Comments
 (0)