miri/shims/unix/netbsd/
foreign_items.rs1use rustc_middle::ty::Ty;
2use rustc_span::Symbol;
3use rustc_target::callconv::FnAbi;
4
5use crate::shims::unix::*;
6use crate::*;
7
8pub fn is_dyn_sym(_name: &str) -> bool {
9 false
10}
11
12impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
13pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
14 fn emulate_foreign_item_inner(
15 &mut self,
16 link_name: Symbol,
17 abi: &FnAbi<'tcx, Ty<'tcx>>,
18 args: &[OpTy<'tcx>],
19 dest: &MPlaceTy<'tcx>,
20 ) -> InterpResult<'tcx, EmulateItemResult> {
21 let this = self.eval_context_mut();
22 match link_name.as_str() {
23 "__unsetenv13" => {
25 let [name] = this
26 .check_shim_sig(shim_sig!(extern "C" fn(*_) -> i32), (link_name, abi, args))?;
27 let result = this.unsetenv(name)?;
28 this.write_scalar(result, dest)?;
29 }
30
31 "__errno" => {
33 let [] =
34 this.check_shim_sig(shim_sig!(extern "C" fn() -> *_), (link_name, abi, args))?;
35 let errno_place = this.last_error_place()?;
36 this.write_scalar(errno_place.to_ref(this).to_scalar(), dest)?;
37 }
38
39 _ => return interp_ok(EmulateItemResult::NotSupported),
40 }
41 interp_ok(EmulateItemResult::NeedsReturn)
42 }
43}