@@ -79,10 +79,9 @@ fn main() {
7979 // if the buffer is shorter than the thread name.
8080 #[ cfg( any( target_os = "illumos" , target_os = "solaris" ) ) ]
8181 assert_eq ! ( get_thread_name( & mut buf[ ..4 ] ) , libc:: ERANGE ) ;
82-
83- // For libc implementation for macOS it's not an error
84- // for a buffer being too short for the thread name.
85- #[ cfg( target_os = "macos" ) ]
82+ // On macOS and FreeBSD it's not an error for the buffer to be
83+ // too short for the thread name -- they truncate instead.
84+ #[ cfg( any( target_os = "freebsd" , target_os = "macos" ) ) ]
8685 {
8786 // Ensure that a zero sized buffer returns no error.
8887 assert_eq ! ( get_thread_name( & mut buf[ ..0 ] ) , 0 ) ;
@@ -123,8 +122,8 @@ fn main() {
123122 // Also test directly calling pthread_setname to check its return value.
124123 assert_eq ! ( set_thread_name( & cstr) , 0 ) ;
125124
126- // But with a too long name it should fail (except on FreeBSD where the
127- // function has no return, hence cannot indicate failure ).
125+ // But with a too long name it should fail (except on FreeBSD where
126+ // names of arbitrary size seem to be supported ).
128127 // On macOS, the error code is different.
129128 #[ cfg( not( any( target_os = "freebsd" , target_os = "macos" ) ) ) ]
130129 assert_eq ! ( set_thread_name( & CString :: new( long_name) . unwrap( ) ) , libc:: ERANGE ) ;
0 commit comments