this.write_scalar(errno_place.to_ref().to_scalar()?, dest)?;
}
- // File related shims
+ // File related shims (but also see "syscall" below for statx)
// The only reason this is not in the `posix` module is because the `macos` item has a
// different name.
this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?;
}
+ // The only reason this is not in the `posix` module is because the `macos` item has a
+ // different name.
+ "opendir" => {
+ let result = this.opendir(args[0])?;
+ this.write_scalar(result, dest)?;
+ }
+
+ // The `macos` module has a parallel foreign item, `readdir_r`, which uses a different
+ // struct layout.
+ "readdir64_r" => {
+ let result = this.linux_readdir64_r(args[0], args[1], args[2])?;
+ this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?;
+ }
+
// Time related shims
// This is a POSIX function but it has only been tested on linux.
// so skip over it.
getrandom(this, &args[1..], dest)?;
}
- // `statx` is used by `libstd` to retrieve metadata information in `linux`
- // instead of using `stat`,`lstat` or `fstat` as in the `macos` platform.
+ // `statx` is used by `libstd` to retrieve metadata information on `linux`
+ // instead of using `stat`,`lstat` or `fstat` as on `macos`.
id if id == sys_statx => {
// The first argument is the syscall id,
// so skip over it.
}
}
-// Shims the linux 'getrandom()' syscall.
+// Shims the linux `getrandom` syscall.
fn getrandom<'tcx>(
this: &mut MiriEvalContext<'_, 'tcx>,
args: &[OpTy<'tcx, Tag>],
// neither of which have any effect on our current PRNG.
let _flags = this.read_scalar(args[2])?.to_i32()?;
- this.gen_random(ptr, len as usize)?;
+ this.gen_random(ptr, len)?;
this.write_scalar(Scalar::from_uint(len, dest.layout.size), dest)?;
Ok(())
}