Skip to content

Commit aded2be

Browse files
committed
Auto merge of rust-lang#3705 - RalfJung:getpid, r=RalfJung
unix/foreign_items: move getpid to the right part of the file
2 parents 9a42436 + 903a424 commit aded2be

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
5151
// See `fn emulate_foreign_item_inner` in `shims/foreign_items.rs` for the general pattern.
5252
#[rustfmt::skip]
5353
match link_name.as_str() {
54-
// Environment variables
54+
// Environment related shims
5555
"getenv" => {
5656
let [name] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
5757
let result = this.getenv(name)?;
@@ -78,6 +78,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7878
let result = this.chdir(path)?;
7979
this.write_scalar(Scalar::from_i32(result), dest)?;
8080
}
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+
}
8186

8287
// File descriptors
8388
"read" => {
@@ -583,11 +588,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
583588
let ret = if complete { 0 } else { this.eval_libc_i32("ERANGE") };
584589
this.write_int(ret, dest)?;
585590
}
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-
}
591591
"getentropy" => {
592592
// This function is non-standard but exists with the same signature and behavior on
593593
// Linux, macOS, FreeBSD and Solaris/Illumos.

0 commit comments

Comments
 (0)