File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
library/std/src/sys/pal/unix Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -225,9 +225,14 @@ impl Thread {
225225 // Newlib, Emscripten, and VxWorks have no way to set a thread name.
226226 }
227227
228- #[ cfg( target_os = "linux" ) ]
228+ #[ cfg( any ( target_os = "linux" , target_os = "freebsd" , target_os = "netbsd" , ) ) ]
229229 pub fn get_name ( ) -> Option < CString > {
230+ #[ cfg( target_os = "linux" ) ]
230231 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 ;
231236 let mut name = vec ! [ 0u8 ; TASK_COMM_LEN ] ;
232237 let res = unsafe {
233238 libc:: pthread_getname_np ( libc:: pthread_self ( ) , name. as_mut_ptr ( ) . cast ( ) , name. len ( ) )
@@ -254,6 +259,8 @@ impl Thread {
254259
255260 #[ cfg( not( any(
256261 target_os = "linux" ,
262+ target_os = "freebsd" ,
263+ target_os = "netbsd" ,
257264 target_os = "macos" ,
258265 target_os = "ios" ,
259266 target_os = "tvos" ,
You can’t perform that action at this time.
0 commit comments