Skip to content

Commit 61289a0

Browse files
committed
std::thread: set_name change for solaris/illumos.
truncate down to 32 (31 + 1) for solaris/illumos.
1 parent 3d5528c commit 61289a0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/std/src/sys/pal/unix/thread.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,11 @@ impl Thread {
182182

183183
if let Some(f) = pthread_setname_np.get() {
184184
#[cfg(target_os = "nto")]
185-
let name = truncate_cstr::<{ libc::_NTO_THREAD_NAME_MAX as usize }>(name);
185+
const THREAD_NAME_MAX: usize = libc::_NTO_THREAD_NAME_MAX as usize;
186+
#[cfg(any(target_os = "solaris", target_os = "illumos"))]
187+
const THREAD_NAME_MAX: usize = 32;
186188

189+
let name = truncate_cstr::<{ THREAD_NAME_MAX }>(name);
187190
let res = unsafe { f(libc::pthread_self(), name.as_ptr()) };
188191
debug_assert_eq!(res, 0);
189192
}

0 commit comments

Comments
 (0)