pthread_getattr_np does not work

xuelin.tian at qkmtech.com xuelin.tian at qkmtech.com
Fri Sep 22 08:43:37 UTC 2017


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

The return value of pthread_getattr_np is correct, I double checked it. But the values of element in attr structure are not correct, like stack_addr and stack_size.

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

Yes, I know this. I just do not know how to do this. The implementation of pthread_getattr_np of 4.11 and 4.12 are different, I just do not know where do I start from...



Best wishes,
xuelin.tian at qkmtech.com
 
From: Sebastian Huber
Date: 2017-09-22 16:33
To: xuelin.tian at qkmtech.com; users at rtems.org
Subject: Re: pthread_getattr_np does not work
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20170922/993b33d3/attachment-0002.html>


More information about the users mailing list