pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> {
// Provided methods
fn dup(&mut self, old_fd_num: i32) -> InterpResult<'tcx, Scalar> { ... }
fn dup2(
&mut self,
old_fd_num: i32,
new_fd_num: i32,
) -> InterpResult<'tcx, Scalar> { ... }
fn flock(&mut self, fd_num: i32, op: i32) -> InterpResult<'tcx, Scalar> { ... }
fn fcntl(&mut self, args: &[OpTy<'tcx>]) -> InterpResult<'tcx, Scalar> { ... }
fn close(&mut self, fd_op: &OpTy<'tcx>) -> InterpResult<'tcx, Scalar> { ... }
fn fd_not_found<T: From<i32>>(&mut self) -> InterpResult<'tcx, T> { ... }
fn read(
&mut self,
fd_num: i32,
buf: Pointer,
count: u64,
offset: Option<i128>,
dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx> { ... }
fn write(
&mut self,
fd_num: i32,
buf: Pointer,
count: u64,
offset: Option<i128>,
dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx> { ... }
fn return_read_success(
&mut self,
buf: Pointer,
bytes: &[u8],
actual_read_size: usize,
dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx> { ... }
fn return_write_success(
&mut self,
actual_write_size: usize,
dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx> { ... }
}
Provided Methods§
fn dup(&mut self, old_fd_num: i32) -> InterpResult<'tcx, Scalar>
fn dup2( &mut self, old_fd_num: i32, new_fd_num: i32, ) -> InterpResult<'tcx, Scalar>
fn flock(&mut self, fd_num: i32, op: i32) -> InterpResult<'tcx, Scalar>
fn fcntl(&mut self, args: &[OpTy<'tcx>]) -> InterpResult<'tcx, Scalar>
fn close(&mut self, fd_op: &OpTy<'tcx>) -> InterpResult<'tcx, Scalar>
sourcefn fd_not_found<T: From<i32>>(&mut self) -> InterpResult<'tcx, T>
fn fd_not_found<T: From<i32>>(&mut self) -> InterpResult<'tcx, T>
Function used when a file descriptor does not exist. It returns Ok(-1)
and sets
the last OS error to libc::EBADF
(invalid file descriptor). This function uses
T: From<i32>
instead of i32
directly because some fs functions return different integer
types (like read
, that returns an i64
).
sourcefn read(
&mut self,
fd_num: i32,
buf: Pointer,
count: u64,
offset: Option<i128>,
dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx>
fn read( &mut self, fd_num: i32, buf: Pointer, count: u64, offset: Option<i128>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx>
Read data from fd
into buffer specified by buf
and count
.
If offset
is None
, reads data from current cursor position associated with fd
and updates cursor position on completion. Otherwise, reads from the specified offset
and keeps the cursor unchanged.
fn write( &mut self, fd_num: i32, buf: Pointer, count: u64, offset: Option<i128>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx>
sourcefn return_read_success(
&mut self,
buf: Pointer,
bytes: &[u8],
actual_read_size: usize,
dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx>
fn return_read_success( &mut self, buf: Pointer, bytes: &[u8], actual_read_size: usize, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx>
Helper to implement FileDescription::read
:
This is only used when read
is successful.
actual_read_size
should be the return value of some underlying read
call that used
bytes
as its output buffer.
The length of bytes
must not exceed either the host’s or the target’s isize
.
bytes
is written to buf
and the size is written to dest
.
sourcefn return_write_success(
&mut self,
actual_write_size: usize,
dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx>
fn return_write_success( &mut self, actual_write_size: usize, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx>
Helper to implement FileDescription::write
:
This function is only used when write
is successful, and writes actual_write_size
to dest
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.