Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 41ab4ec

Browse files
committed
Pass dest place reference to epoll_wait
1 parent e8175a4 commit 41ab4ec

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/tools/miri/src/shims/unix/linux/epoll.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
430430
events_op: &OpTy<'tcx>,
431431
maxevents: &OpTy<'tcx>,
432432
timeout: &OpTy<'tcx>,
433-
dest: MPlaceTy<'tcx>,
433+
dest: &MPlaceTy<'tcx>,
434434
) -> InterpResult<'tcx> {
435435
let this = self.eval_context_mut();
436436

@@ -442,7 +442,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
442442
if epfd_value <= 0 || maxevents <= 0 {
443443
let einval = this.eval_libc("EINVAL");
444444
this.set_last_error(einval)?;
445-
this.write_int(-1, &dest)?;
445+
this.write_int(-1, dest)?;
446446
return Ok(());
447447
}
448448

@@ -455,7 +455,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
455455

456456
let Some(epfd) = this.machine.fds.get(epfd_value) else {
457457
let result_value: i32 = this.fd_not_found()?;
458-
this.write_int(result_value, &dest)?;
458+
this.write_int(result_value, dest)?;
459459
return Ok(());
460460
};
461461
// 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> {
476476
}
477477
if timeout == 0 || !ready_list_empty {
478478
// If the ready list is not empty, or the timeout is 0, we can return immediately.
479-
this.blocking_epoll_callback(epfd_value, weak_epfd, &dest, &event)?;
479+
this.blocking_epoll_callback(epfd_value, weak_epfd, dest, &event)?;
480480
} else {
481481
// Blocking
482482
let timeout = match timeout {
@@ -492,6 +492,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
492492
}
493493
};
494494
thread_ids.push(this.active_thread());
495+
let dest = dest.clone();
495496
this.block_thread(
496497
BlockReason::Epoll,
497498
timeout,

src/tools/miri/src/shims/unix/linux/foreign_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
6262
"epoll_wait" => {
6363
let [epfd, events, maxevents, timeout] =
6464
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
65-
this.epoll_wait(epfd, events, maxevents, timeout, dest.clone())?;
65+
this.epoll_wait(epfd, events, maxevents, timeout, dest)?;
6666
}
6767
"eventfd" => {
6868
let [val, flag] =

0 commit comments

Comments
 (0)