Skip to content

Commit

Permalink
freebsd interceptions update proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Oct 26, 2023
1 parent f40022d commit 4f377a5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/shims/unix/freebsd/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,27 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
this.write_null(dest)?;
}
"pthread_set_name_np" => {
"pthread_set_name_np" | "pthread_setname_np" => {
let [thread, name] =
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
let max_len = usize::MAX; // freebsd does not seem to have a limit.
let max_len = 20; // freebsd silently truncates to MAXCOMLEN (+ 1).
let res = this.pthread_setname_np(
this.read_scalar(thread)?,
this.read_scalar(name)?,
max_len,
)?;
this.write_scalar(res, dest)?;
}
"pthread_get_name_np" | "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)?;
}

// errno
"__error" => {
Expand Down

0 comments on commit 4f377a5

Please sign in to comment.