I found out that there is a test in 4.12-master about pthread_getattr_np, so I compiled that one and ran it.
The result shows that this function works well, like this ************************************************************************* *** BEGIN OF TEST PSXGETATTRNP 1 *** Init - pthread_getattr_np - attr NULL - EINVAL Init - pthread_getattr_np - invalid id - ESRCH Init - pthread_attr_init Init - pthread_attr_setinheritsched - PTHREAD_EXPLICIT_SCHED Init - pthread_attr_setschedpolicy to SCHED_RR Init - pthread_attr_setschedparam to minimum priority + 2 Init - pthread_attr_getstack Init - pthread_attr_setstack double the stacksize Init - pthread_attr_getguardsize Init - pthread_attr_setguardsize double the guardsizecreate Init - Lower pri Init - raise priority to max Init - pthread_ority Thread - pthread_getattr_np - Verify value Thread - pthread_setschedparam: Setting highest priority SCHED_FIFO Thread - Detach Thread - pthread_getattr_np Thread - Verify SCHED_FIFO policy Thread - Verify max priority Thread - Verify detached *** END OF ************************************************************************* But, this test just checks the return value, not the value of elements in pthread_attr_t structure. When I tried to print out these values, the same result as before appeared, all 0... So, how can I modify the source code in rtems to let this function work? Thanks a lot. Best wishes, xuelin.t...@qkmtech.com From: xuelin.t...@qkmtech.com Date: 2017-09-20 14:45 To: Sebastian Huber; users@rtems.org Subject: Re: Re: pthread_getattr_np does not work I need to get thread attributes through this function. ********************************************************************** #define __GNU_VISIBLE #include <pthread.h> void test_thread (guint8 **staddr, size_t *stsize) { pthread_attr_t attr; uint8_t **staddr = NULL; size_t *stsize = 0; int res = 0; res = pthread_getattr_np (pthread_self(), &attr); pthread_attr_getstack (&attr, (void**)staddr, stsize); pthread_attr_destroy (&attr); } ************************************************************************ I check the return value is 0 which means pthread_getattr_np goes well. But all values in attr structure are either 0 or 1. And I can not get staddr and stsize value either. So, I think there may be something wrong with this function. Best wishes, xuelin.t...@qkmtech.com From: Sebastian Huber Date: 2017-09-20 13:00 To: xuelin.t...@qkmtech.com; users@rtems.org Subject: Re: pthread_getattr_np does not work On 20/09/17 05:43, xuelin.t...@qkmtech.com wrote: > Dear all, > I tried to use pthread_getattr_np function to extract attrributes of > thread in rtems, but it does not work. Has anyone used this function > before? What do you mean with doesn't work? -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
_______________________________________________ users mailing list users@rtems.org http://lists.rtems.org/mailman/listinfo/users