let [fd, buf, count] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
let fd = this.read_scalar(fd)?.to_i32()?;
let buf = this.read_pointer(buf)?;
- let count = this.read_scalar(count)?.to_machine_usize(this)?;
+ let count = this.read_machine_usize(count)?;
let result = this.read(fd, buf, count)?;
this.write_scalar(Scalar::from_machine_isize(result, this), dest)?;
}
let [fd, buf, n] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
let fd = this.read_scalar(fd)?.to_i32()?;
let buf = this.read_pointer(buf)?;
- let count = this.read_scalar(n)?.to_machine_usize(this)?;
+ let count = this.read_machine_usize(n)?;
trace!("Called write({:?}, {:?}, {:?})", fd, buf, count);
let result = this.write(fd, buf, count)?;
// Now, `result` is the value we return back to the program.
let [fd, offset, len, advice] =
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
this.read_scalar(fd)?.to_i32()?;
- this.read_scalar(offset)?.to_machine_isize(this)?;
- this.read_scalar(len)?.to_machine_isize(this)?;
+ this.read_machine_isize(offset)?;
+ this.read_machine_isize(len)?;
this.read_scalar(advice)?.to_i32()?;
// fadvise is only informational, we can ignore it.
this.write_null(dest)?;
"posix_memalign" => {
let [ret, align, size] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
let ret = this.deref_operand(ret)?;
- let align = this.read_scalar(align)?.to_machine_usize(this)?;
- let size = this.read_scalar(size)?.to_machine_usize(this)?;
+ let align = this.read_machine_usize(align)?;
+ let size = this.read_machine_usize(size)?;
// Align must be power of 2, and also at least ptr-sized (POSIX rules).
// But failure to adhere to this is not UB, it's an error condition.
if !align.is_power_of_two() || align < this.pointer_size().bytes() {
- let einval = this.eval_libc_i32("EINVAL")?;
+ let einval = this.eval_libc_i32("EINVAL");
this.write_int(einval, dest)?;
} else {
if size == 0 {
// Dynamic symbol loading
"dlsym" => {
let [handle, symbol] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
- this.read_scalar(handle)?.to_machine_usize(this)?;
+ this.read_machine_usize(handle)?;
let symbol = this.read_pointer(symbol)?;
let symbol_name = this.read_c_str(symbol)?;
if let Some(dlsym) = Dlsym::from_str(symbol_name, &this.tcx.sess.target.os)? {
];
let mut result = None;
for &(sysconf_name, value) in sysconfs {
- let sysconf_name = this.eval_libc_i32(sysconf_name)?;
+ let sysconf_name = this.eval_libc_i32(sysconf_name);
if sysconf_name == name {
result = Some(value(this));
break;
let [errnum, buf, buflen] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
let errnum = this.read_scalar(errnum)?;
let buf = this.read_pointer(buf)?;
- let buflen = this.read_scalar(buflen)?.to_machine_usize(this)?;
+ let buflen = this.read_machine_usize(buflen)?;
let error = this.try_errnum_to_io_error(errnum)?;
let formatted = match error {
None => format!("<unknown errnum in strerror_r: {errnum}>"),
};
let (complete, _) = this.write_os_str_to_c_str(OsStr::new(&formatted), buf, buflen)?;
- let ret = if complete { 0 } else { this.eval_libc_i32("ERANGE")? };
+ let ret = if complete { 0 } else { this.eval_libc_i32("ERANGE") };
this.write_int(ret, dest)?;
}
"getpid" => {
if this.frame_in_std() => {
let [_attr, guard_size] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
let guard_size = this.deref_operand(guard_size)?;
- let guard_size_layout = this.libc_ty_layout("size_t")?;
+ let guard_size_layout = this.libc_ty_layout("size_t");
this.write_scalar(Scalar::from_uint(this.machine.page_size, guard_size_layout.size), &guard_size.into())?;
// Return success (`0`).
let uid = this.read_scalar(uid)?.to_u32()?;
let pwd = this.deref_operand(pwd)?;
let buf = this.read_pointer(buf)?;
- let buflen = this.read_scalar(buflen)?.to_machine_usize(this)?;
+ let buflen = this.read_machine_usize(buflen)?;
let result = this.deref_operand(result)?;
// Must be for "us".
this.write_null(dest)?;
} else {
this.write_null(&result.into())?;
- this.write_scalar(this.eval_libc("ERANGE")?, dest)?;
+ this.write_scalar(this.eval_libc("ERANGE"), dest)?;
}
}