posix_fadvise is Linux-only; also validate arguments a bit

This commit is contained in:
Ralf Jung 2020-03-28 11:33:56 +01:00
parent 9e39bfbbd9
commit 6ab82f5d35
2 changed files with 9 additions and 4 deletions

View file

@ -115,10 +115,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
let result = this.lseek64(args[0], args[1], args[2])?;
this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?;
}
"posix_fadvise" => {
// fadvise is only informational, we can ignore it.
this.write_null(dest)?;
}
// Allocation
"posix_memalign" => {

View file

@ -34,6 +34,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
let result = this.linux_readdir64_r(args[0], args[1], args[2])?;
this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?;
}
// Linux-only
"posix_fadvise" => {
let _fd = this.read_scalar(args[0])?.to_i32()?;
let _offset = this.read_scalar(args[1])?.to_machine_isize(this)?;
let _len = this.read_scalar(args[2])?.to_machine_isize(this)?;
let _advice = this.read_scalar(args[3])?.to_i32()?;
// fadvise is only informational, we can ignore it.
this.write_null(dest)?;
}
// Time related shims
"clock_gettime" => {