@@ -79,10 +79,9 @@ fn main() {
79
79
// if the buffer is shorter than the thread name.
80
80
#[ cfg( any( target_os = "illumos" , target_os = "solaris" ) ) ]
81
81
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" ) ) ]
86
85
{
87
86
// Ensure that a zero sized buffer returns no error.
88
87
assert_eq ! ( get_thread_name( & mut buf[ ..0 ] ) , 0 ) ;
@@ -123,8 +122,8 @@ fn main() {
123
122
// Also test directly calling pthread_setname to check its return value.
124
123
assert_eq ! ( set_thread_name( & cstr) , 0 ) ;
125
124
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 ).
128
127
// On macOS, the error code is different.
129
128
#[ cfg( not( any( target_os = "freebsd" , target_os = "macos" ) ) ) ]
130
129
assert_eq ! ( set_thread_name( & CString :: new( long_name) . unwrap( ) ) , libc:: ERANGE ) ;
0 commit comments