diff options
| author | Ralf Jung <post@ralfj.de> | 2025-07-03 17:47:34 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-07-03 17:48:33 +0200 |
| commit | 7ea812fd54f04070d16a5f69ff3b034814bf72b8 (patch) | |
| tree | ac5f20421646b9f0e10eeac991a23e99ab2761d6 | |
| parent | 3c3f1e461cc6009e1dc025205e984a932bc0ab62 (diff) | |
| download | rust-7ea812fd54f04070d16a5f69ff3b034814bf72b8.tar.gz rust-7ea812fd54f04070d16a5f69ff3b034814bf72b8.zip | |
nanosleep: fix argument name and add a missing argument read
| -rw-r--r-- | src/tools/miri/src/shims/time.rs | 11 | ||||
| -rw-r--r-- | src/tools/miri/src/shims/unix/foreign_items.rs | 4 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/tools/miri/src/shims/time.rs b/src/tools/miri/src/shims/time.rs index 28f4ca5bb1b..2fc42c13edd 100644 --- a/src/tools/miri/src/shims/time.rs +++ b/src/tools/miri/src/shims/time.rs @@ -330,18 +330,15 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { interp_ok(Scalar::from_i32(0)) // KERN_SUCCESS } - fn nanosleep( - &mut self, - req_op: &OpTy<'tcx>, - _rem: &OpTy<'tcx>, // Signal handlers are not supported, so rem will never be written to. - ) -> InterpResult<'tcx, Scalar> { + fn nanosleep(&mut self, duration: &OpTy<'tcx>, rem: &OpTy<'tcx>) -> InterpResult<'tcx, Scalar> { let this = self.eval_context_mut(); this.assert_target_os_is_unix("nanosleep"); - let req = this.deref_pointer_as(req_op, this.libc_ty_layout("timespec"))?; + let duration = this.deref_pointer_as(duration, this.libc_ty_layout("timespec"))?; + let _rem = this.read_pointer(rem)?; // Signal handlers are not supported, so rem will never be written to. - let duration = match this.read_timespec(&req)? { + let duration = match this.read_timespec(&duration)? { Some(duration) => duration, None => { return this.set_last_error_and_return_i32(LibcError("EINVAL")); diff --git a/src/tools/miri/src/shims/unix/foreign_items.rs b/src/tools/miri/src/shims/unix/foreign_items.rs index b3c58397a02..438a9b420be 100644 --- a/src/tools/miri/src/shims/unix/foreign_items.rs +++ b/src/tools/miri/src/shims/unix/foreign_items.rs @@ -963,8 +963,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { this.write_null(dest)?; } "nanosleep" => { - let [req, rem] = this.check_shim(abi, CanonAbi::C, link_name, args)?; - let result = this.nanosleep(req, rem)?; + let [duration, rem] = this.check_shim(abi, CanonAbi::C, link_name, args)?; + let result = this.nanosleep(duration, rem)?; this.write_scalar(result, dest)?; } "sched_getaffinity" => { |
