about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-23 07:00:35 +0000
committerbors <bors@rust-lang.org>2024-06-23 07:00:35 +0000
commitaded2be375993cfb08c8d13be71c046bd048c5d2 (patch)
tree97e76a171f90038ab29d9098ddaf64a96de9ab7b /src
parent9a42436d1fe0ecd25ddb1f1397ca446c005c2dc3 (diff)
parent903a424ae2f9d1fc2c36718f71aa665c9507850a (diff)
downloadrust-aded2be375993cfb08c8d13be71c046bd048c5d2.tar.gz
rust-aded2be375993cfb08c8d13be71c046bd048c5d2.zip
Auto merge of #3705 - RalfJung:getpid, r=RalfJung
unix/foreign_items: move getpid to the right part of the file
Diffstat (limited to 'src')
-rw-r--r--src/tools/miri/src/shims/unix/foreign_items.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tools/miri/src/shims/unix/foreign_items.rs b/src/tools/miri/src/shims/unix/foreign_items.rs
index 2282099fa0d..53ad40cfd2c 100644
--- a/src/tools/miri/src/shims/unix/foreign_items.rs
+++ b/src/tools/miri/src/shims/unix/foreign_items.rs
@@ -51,7 +51,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
         // See `fn emulate_foreign_item_inner` in `shims/foreign_items.rs` for the general pattern.
         #[rustfmt::skip]
         match link_name.as_str() {
-            // Environment variables
+            // Environment related shims
             "getenv" => {
                 let [name] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
                 let result = this.getenv(name)?;
@@ -78,6 +78,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
                 let result = this.chdir(path)?;
                 this.write_scalar(Scalar::from_i32(result), dest)?;
             }
+            "getpid" => {
+                let [] = this.check_shim(abi, Abi::C { unwind: false}, link_name, args)?;
+                let result = this.getpid()?;
+                this.write_scalar(Scalar::from_i32(result), dest)?;
+            }
 
             // File descriptors
             "read" => {
@@ -583,11 +588,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
                 let ret = if complete { 0 } else { this.eval_libc_i32("ERANGE") };
                 this.write_int(ret, dest)?;
             }
-            "getpid" => {
-                let [] = this.check_shim(abi, Abi::C { unwind: false}, link_name, args)?;
-                let result = this.getpid()?;
-                this.write_scalar(Scalar::from_i32(result), dest)?;
-            }
             "getentropy" => {
                 // This function is non-standard but exists with the same signature and behavior on
                 // Linux, macOS, FreeBSD and Solaris/Illumos.