@@ -51,7 +51,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
51
51
// See `fn emulate_foreign_item_inner` in `shims/foreign_items.rs` for the general pattern.
52
52
#[ rustfmt:: skip]
53
53
match link_name. as_str ( ) {
54
- // Environment variables
54
+ // Environment related shims
55
55
"getenv" => {
56
56
let [ name] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
57
57
let result = this. getenv ( name) ?;
@@ -78,6 +78,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
78
78
let result = this. chdir ( path) ?;
79
79
this. write_scalar ( Scalar :: from_i32 ( result) , dest) ?;
80
80
}
81
+ "getpid" => {
82
+ let [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
83
+ let result = this. getpid ( ) ?;
84
+ this. write_scalar ( Scalar :: from_i32 ( result) , dest) ?;
85
+ }
81
86
82
87
// File descriptors
83
88
"read" => {
@@ -583,11 +588,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
583
588
let ret = if complete { 0 } else { this. eval_libc_i32 ( "ERANGE" ) } ;
584
589
this. write_int ( ret, dest) ?;
585
590
}
586
- "getpid" => {
587
- let [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
588
- let result = this. getpid ( ) ?;
589
- this. write_scalar ( Scalar :: from_i32 ( result) , dest) ?;
590
- }
591
591
"getentropy" => {
592
592
// This function is non-standard but exists with the same signature and behavior on
593
593
// Linux, macOS, FreeBSD and Solaris/Illumos.
0 commit comments