Skip to content

Commit 07d6bde

Browse files
committed
std::thread: adding get_name implementation for solaris/illumos.
THREAD_NAME_MAX is 32 (31 max + 1 for the null terminator).
1 parent 979c365 commit 07d6bde

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Diff for: std/src/sys/pal/unix/thread.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,19 @@ impl Thread {
225225
// Newlib, Emscripten, and VxWorks have no way to set a thread name.
226226
}
227227

228-
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd",))]
228+
#[cfg(any(
229+
target_os = "linux",
230+
target_os = "freebsd",
231+
target_os = "netbsd",
232+
target_os = "solaris",
233+
target_os = "illumos"
234+
))]
229235
pub fn get_name() -> Option<CString> {
230236
#[cfg(target_os = "linux")]
231237
const TASK_COMM_LEN: usize = 16;
232238
#[cfg(target_os = "freebsd")]
233239
const TASK_COMM_LEN: usize = libc::MAXCOMLEN + 1;
234-
#[cfg(target_os = "netbsd")]
240+
#[cfg(any(target_os = "netbsd", target_os = "solaris", target_os = "illumos"))]
235241
const TASK_COMM_LEN: usize = 32;
236242
let mut name = vec![0u8; TASK_COMM_LEN];
237243
let res = unsafe {
@@ -282,7 +288,9 @@ impl Thread {
282288
target_os = "ios",
283289
target_os = "tvos",
284290
target_os = "watchos",
285-
target_os = "haiku"
291+
target_os = "haiku",
292+
target_os = "solaris",
293+
target_os = "illumos"
286294
)))]
287295
pub fn get_name() -> Option<CString> {
288296
None

0 commit comments

Comments
 (0)