]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/miri/src/shims/unix/linux/foreign_items.rs
Auto merge of #103571 - RalfJung:miri, r=RalfJung
[rust.git] / src / tools / miri / src / shims / unix / linux / foreign_items.rs
index 5d000f9d121d48a75e8b262ae325cd11648c0a67..2b53152688bb787abd713355236435213048034c 100644 (file)
@@ -68,8 +68,22 @@ fn emulate_foreign_item_by_name(
             "pthread_setname_np" => {
                 let [thread, name] =
                     this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
-                let res =
-                    this.pthread_setname_np(this.read_scalar(thread)?, this.read_scalar(name)?)?;
+                let max_len = 16;
+                let res = this.pthread_setname_np(
+                    this.read_scalar(thread)?,
+                    this.read_scalar(name)?,
+                    max_len,
+                )?;
+                this.write_scalar(res, dest)?;
+            }
+            "pthread_getname_np" => {
+                let [thread, name, len] =
+                    this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
+                let res = this.pthread_getname_np(
+                    this.read_scalar(thread)?,
+                    this.read_scalar(name)?,
+                    this.read_scalar(len)?,
+                )?;
                 this.write_scalar(res, dest)?;
             }
 
@@ -126,7 +140,7 @@ fn emulate_foreign_item_by_name(
                         futex(this, &args[1..], dest)?;
                     }
                     id => {
-                        this.handle_unsupported(format!("can't execute syscall with ID {}", id))?;
+                        this.handle_unsupported(format!("can't execute syscall with ID {id}"))?;
                         return Ok(EmulateByNameResult::AlreadyJumped);
                     }
                 }