Skip to content

Commit 6f48edf

Browse files
committed
FD table: rename dup to get_ref
1 parent 6283c4d commit 6f48edf

File tree

1 file changed

+6
-6
lines changed
  • src/tools/miri/src/shims/unix

1 file changed

+6
-6
lines changed

src/tools/miri/src/shims/unix/fd.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl FdTable {
294294
Some(fd.borrow_mut())
295295
}
296296

297-
pub fn dup(&self, fd: i32) -> Option<FileDescriptionRef> {
297+
pub fn get_ref(&self, fd: i32) -> Option<FileDescriptionRef> {
298298
let fd = self.fds.get(&fd)?;
299299
Some(fd.clone())
300300
}
@@ -313,7 +313,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
313313
fn dup(&mut self, old_fd: i32) -> InterpResult<'tcx, Scalar> {
314314
let this = self.eval_context_mut();
315315

316-
let Some(dup_fd) = this.machine.fds.dup(old_fd) else {
316+
let Some(dup_fd) = this.machine.fds.get_ref(old_fd) else {
317317
return Ok(Scalar::from_i32(this.fd_not_found()?));
318318
};
319319
Ok(Scalar::from_i32(this.machine.fds.insert_ref_with_min_fd(dup_fd, 0)))
@@ -322,7 +322,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
322322
fn dup2(&mut self, old_fd: i32, new_fd: i32) -> InterpResult<'tcx, Scalar> {
323323
let this = self.eval_context_mut();
324324

325-
let Some(dup_fd) = this.machine.fds.dup(old_fd) else {
325+
let Some(dup_fd) = this.machine.fds.get_ref(old_fd) else {
326326
return Ok(Scalar::from_i32(this.fd_not_found()?));
327327
};
328328
if new_fd != old_fd {
@@ -408,7 +408,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
408408
}
409409
let start = this.read_scalar(&args[2])?.to_i32()?;
410410

411-
match this.machine.fds.dup(fd) {
411+
match this.machine.fds.get_ref(fd) {
412412
Some(dup_fd) =>
413413
Ok(Scalar::from_i32(this.machine.fds.insert_ref_with_min_fd(dup_fd, start))),
414414
None => Ok(Scalar::from_i32(this.fd_not_found()?)),
@@ -481,7 +481,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
481481
let communicate = this.machine.communicate();
482482

483483
// We temporarily dup the FD to be able to retain mutable access to `this`.
484-
let Some(fd) = this.machine.fds.dup(fd) else {
484+
let Some(fd) = this.machine.fds.get_ref(fd) else {
485485
trace!("read: FD not found");
486486
return Ok(Scalar::from_target_isize(this.fd_not_found()?, this));
487487
};
@@ -546,7 +546,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
546546

547547
let bytes = this.read_bytes_ptr_strip_provenance(buf, Size::from_bytes(count))?.to_owned();
548548
// We temporarily dup the FD to be able to retain mutable access to `this`.
549-
let Some(fd) = this.machine.fds.dup(fd) else {
549+
let Some(fd) = this.machine.fds.get_ref(fd) else {
550550
return Ok(Scalar::from_target_isize(this.fd_not_found()?, this));
551551
};
552552

0 commit comments

Comments
 (0)