pthread_getattr_np does not work

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Sep 22 08:33:07 UTC 2017


On 22/09/17 10:24, xuelin.tian at qkmtech.com wrote:

> 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...

It would be good to check the expected values with test assertions.

>
> So, how can I modify the source code in rtems to let this function 
> work? Thanks a lot.

You have to edit:

cpukit/posix/src/pthreadgetattrnp.c

-- 
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.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list