about summary refs log tree commit diff
diff options
context:
space:
mode:
authortiif <pekyuan@gmail.com>2024-08-24 23:28:23 +0800
committertiif <pekyuan@gmail.com>2024-08-25 01:14:50 +0800
commit41ab4ecc0338958ea28463e8116b348c08cf62be (patch)
treeefd92f1b7a2365782f3ec693524c5c69b3b2bcd1
parente8175a42f78c2036845e8252061623eed9171820 (diff)
downloadrust-41ab4ecc0338958ea28463e8116b348c08cf62be.tar.gz
rust-41ab4ecc0338958ea28463e8116b348c08cf62be.zip
Pass dest place reference to epoll_wait
-rw-r--r--src/tools/miri/src/shims/unix/linux/epoll.rs9
-rw-r--r--src/tools/miri/src/shims/unix/linux/foreign_items.rs2
2 files changed, 6 insertions, 5 deletions
diff --git a/src/tools/miri/src/shims/unix/linux/epoll.rs b/src/tools/miri/src/shims/unix/linux/epoll.rs
index 471ff5af11b..fb2eba75b87 100644
--- a/src/tools/miri/src/shims/unix/linux/epoll.rs
+++ b/src/tools/miri/src/shims/unix/linux/epoll.rs
@@ -430,7 +430,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
         events_op: &OpTy<'tcx>,
         maxevents: &OpTy<'tcx>,
         timeout: &OpTy<'tcx>,
-        dest: MPlaceTy<'tcx>,
+        dest: &MPlaceTy<'tcx>,
     ) -> InterpResult<'tcx> {
         let this = self.eval_context_mut();
 
@@ -442,7 +442,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
         if epfd_value <= 0 || maxevents <= 0 {
             let einval = this.eval_libc("EINVAL");
             this.set_last_error(einval)?;
-            this.write_int(-1, &dest)?;
+            this.write_int(-1, dest)?;
             return Ok(());
         }
 
@@ -455,7 +455,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
 
         let Some(epfd) = this.machine.fds.get(epfd_value) else {
             let result_value: i32 = this.fd_not_found()?;
-            this.write_int(result_value, &dest)?;
+            this.write_int(result_value, dest)?;
             return Ok(());
         };
         // Create a weak ref of epfd and pass it to callback so we will make sure that epfd
@@ -476,7 +476,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
         }
         if timeout == 0 || !ready_list_empty {
             // If the ready list is not empty, or the timeout is 0, we can return immediately.
-            this.blocking_epoll_callback(epfd_value, weak_epfd, &dest, &event)?;
+            this.blocking_epoll_callback(epfd_value, weak_epfd, dest, &event)?;
         } else {
             // Blocking
             let timeout = match timeout {
@@ -492,6 +492,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
                 }
             };
             thread_ids.push(this.active_thread());
+            let dest = dest.clone();
             this.block_thread(
                 BlockReason::Epoll,
                 timeout,
diff --git a/src/tools/miri/src/shims/unix/linux/foreign_items.rs b/src/tools/miri/src/shims/unix/linux/foreign_items.rs
index d21f0e8f3e6..d64f13f63d9 100644
--- a/src/tools/miri/src/shims/unix/linux/foreign_items.rs
+++ b/src/tools/miri/src/shims/unix/linux/foreign_items.rs
@@ -62,7 +62,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
             "epoll_wait" => {
                 let [epfd, events, maxevents, timeout] =
                     this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
-                this.epoll_wait(epfd, events, maxevents, timeout, dest.clone())?;
+                this.epoll_wait(epfd, events, maxevents, timeout, dest)?;
             }
             "eventfd" => {
                 let [val, flag] =