From 5ba2c1e6be8d79837fb439bafe74b9a20500cf22 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 2 Jul 2022 09:06:35 -0400 Subject: [PATCH] posix_fadvise is not Linux-specific --- src/shims/unix/foreign_items.rs | 10 ++++++++++ src/shims/unix/linux/foreign_items.rs | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/shims/unix/foreign_items.rs b/src/shims/unix/foreign_items.rs index 43b0f7df7f..44147433c0 100644 --- a/src/shims/unix/foreign_items.rs +++ b/src/shims/unix/foreign_items.rs @@ -153,6 +153,16 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx let result = this.readlink(pathname, buf, bufsize)?; this.write_scalar(Scalar::from_machine_isize(result, this), dest)?; } + "posix_fadvise" => { + let [fd, offset, len, advice] = + this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; + this.read_scalar(fd)?.to_i32()?; + this.read_scalar(offset)?.to_machine_isize(this)?; + this.read_scalar(len)?.to_machine_isize(this)?; + this.read_scalar(advice)?.to_i32()?; + // fadvise is only informational, we can ignore it. + this.write_null(dest)?; + } // Time related shims "gettimeofday" => { diff --git a/src/shims/unix/linux/foreign_items.rs b/src/shims/unix/linux/foreign_items.rs index d89a2c78f4..bbdb1b8a31 100644 --- a/src/shims/unix/linux/foreign_items.rs +++ b/src/shims/unix/linux/foreign_items.rs @@ -36,16 +36,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx this.write_scalar(result, dest)?; } // Linux-only - "posix_fadvise" => { - let [fd, offset, len, advice] = - this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - this.read_scalar(fd)?.to_i32()?; - this.read_scalar(offset)?.to_machine_isize(this)?; - this.read_scalar(len)?.to_machine_isize(this)?; - this.read_scalar(advice)?.to_i32()?; - // fadvise is only informational, we can ignore it. - this.write_null(dest)?; - } "sync_file_range" => { let [fd, offset, nbytes, flags] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;