File tree 1 file changed +6
-1
lines changed
library/std/src/sys/pal/unix
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -225,9 +225,12 @@ impl Thread {
225
225
// Newlib, Emscripten, and VxWorks have no way to set a thread name.
226
226
}
227
227
228
- #[ cfg( target_os = "linux" ) ]
228
+ #[ cfg( any ( target_os = "linux" , target_os = "freebsd" , target_os = "netbsd" , ) ) ]
229
229
pub fn get_name ( ) -> Option < CString > {
230
+ #[ cfg( any( target_os = "linux" , target_os = "freebsd" ) ) ]
230
231
const TASK_COMM_LEN : usize = 16 ;
232
+ #[ cfg( target_os = "netbsd" ) ]
233
+ const TASK_COMM_LEN : usize = 32 ;
231
234
let mut name = vec ! [ 0u8 ; TASK_COMM_LEN ] ;
232
235
let res = unsafe {
233
236
libc:: pthread_getname_np ( libc:: pthread_self ( ) , name. as_mut_ptr ( ) . cast ( ) , name. len ( ) )
@@ -254,6 +257,8 @@ impl Thread {
254
257
255
258
#[ cfg( not( any(
256
259
target_os = "linux" ,
260
+ target_os = "freebsd" ,
261
+ target_os = "netbsd" ,
257
262
target_os = "macos" ,
258
263
target_os = "ios" ,
259
264
target_os = "tvos" ,
You can’t perform that action at this time.
0 commit comments