For pthread_attr_get_np() attr should be initialized prior to the call by using pthread_attr_init(3). pthread_getattr_np() does this automatically so switch to it.