Skip to content

Commit d11b900

Browse files
committed
let freebsd truncates itself the id name
1 parent 2117ef5 commit d11b900

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/shims/unix/freebsd/foreign_items.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
3030
"pthread_set_name_np" => {
3131
let [thread, name] =
3232
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
33-
// freebsd silently truncates to MAXCOMLEN (+ 1).
34-
//
35-
// ref. https://github.com/freebsd/freebsd-src/blob/314542de6d0a044640d349d68b2d1a1fe5f427ff/sys/sys/param.h#L127
36-
// ref. https://github.com/freebsd/freebsd-src/blob/314542de6d0a044640d349d68b2d1a1fe5f427ff/lib/libc/sys/thr_set_name.2#L47
37-
let max_len = usize::MAX; //20;
33+
let max_len = usize::MAX;
3834
this.pthread_setname_np(
3935
this.read_scalar(thread)?,
4036
this.read_scalar(name)?,

tests/pass-dep/shims/pthreads.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ fn test_named_thread_truncation() {
176176
// Also test directly calling pthread_setname to check its return value.
177177
assert_eq!(set_thread_name(&cstr), 0);
178178
// But with a too long name it should fail.
179+
#[cfg(not(target_os = "freebsd"))]
179180
assert_ne!(set_thread_name(&CString::new(long_name).unwrap()), 0);
180181
});
181182
result.unwrap().join().unwrap();

0 commit comments

Comments
 (0)