File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -225,9 +225,14 @@ 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( target_os = "linux" ) ]
230
231
const TASK_COMM_LEN : usize = 16 ;
232
+ #[ cfg( target_os = "freebsd" ) ]
233
+ const TASK_COMM_LEN : usize = libc:: MAXCOMLEN + 1 ;
234
+ #[ cfg( target_os = "netbsd" ) ]
235
+ const TASK_COMM_LEN : usize = 32 ;
231
236
let mut name = vec ! [ 0u8 ; TASK_COMM_LEN ] ;
232
237
let res = unsafe {
233
238
libc:: pthread_getname_np ( libc:: pthread_self ( ) , name. as_mut_ptr ( ) . cast ( ) , name. len ( ) )
@@ -254,6 +259,8 @@ impl Thread {
254
259
255
260
#[ cfg( not( any(
256
261
target_os = "linux" ,
262
+ target_os = "freebsd" ,
263
+ target_os = "netbsd" ,
257
264
target_os = "macos" ,
258
265
target_os = "ios" ,
259
266
target_os = "tvos" ,
You can’t perform that action at this time.
0 commit comments