pthread_mutex_getprioceiling should return EINVAl when mutex's protocol is PTHREAD_PRIO_NONE.
PATCH 1/1 pthread_mutex_getprioceiling should return EINVAl when mutex's protocol is PTHREAD_PRIO_NONE.
The default value of the mutex's protocol shall be PTHREAD_PRIO_NONE, so pthread_mutex_getprioceiling should return EINVAL.
--- .../interfaces/pthread_mutex_getprioceiling/1-1.c | 30 ++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c +30 -0
@@ -18,6 +18,7 @@#include <pthread.h> #include <stdio.h> #include <sched.h> +#include <errno.h> #include "posixtest.h" int main ()
@@ -29,6 +30,7 @@ int main()return PTS_UNRESOLVED; #endif */ +pthread_mutexattr_t mattr;pthread_mutex_t mutex;int prioceiling, max_prio, min_prio;
@@ -40,6 +42,34 @@ int main() }/* Get the prioceiling of the mutex. */ +if (pthread_mutex_getprioceiling (&mutex, &prioceiling) !=EINVAL ) + { +printf ("Test FAILED: Default, the protocol attribute of mutex " +"is PTHREAD_PRIO_NONE, so pthread_mutex_getprioceiling " +"should return EINVAL\n" ); +return PTS_FAIL ; + } + +if (pthread_mutexattr_init (&mattr) !=0 ) + { +perror ("Error at pthread_mutexattr_init()\n" ); +return PTS_UNRESOLVED ; + } + +if (pthread_mutexattr_setprotocol (&mattr,PTHREAD_PRIO_PROTECT ) !=0 ) + { +perror ("Error at pthread_mutexattr_setprotocol()\n" ); +return PTS_UNRESOLVED ; + } + +/* Initialize a mutex object */ +if (pthread_mutex_init (&mutex, &mattr) !=0 ) + { +perror ("Error at pthread_mutex_init()\n" ); +return PTS_UNRESOLVED ; + } + +/* Get the prioceiling of the mutex. */ if (pthread_mutex_getprioceiling (&mutex, &prioceiling) !=0 ) {printf ("Test FAILED: Error obtaining the priority ceiling\n" );
Signature · 19 lines
1.7.0.4 -- Regards Bian Naimeng ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 54 lines · Bian Naimeng
The default value of the mutex's protocol shall be
PTHREAD_PRIO_NONE, sopthread_mutex_getprioceilingshould return EINVAL.Signed-off-by Bian Naimeng <[email protected]>---
.../interfaces/pthread_mutex_getprioceiling/1-1.c | 30 ++++++++++++++++++++1 files changed, 30 insertions(+), 0 deletions(-)testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c +23
-0@@ -18,6 +18,7 @@ #include <pthread.h> #include <stdio.h> #include <sched.h> +#include <errno.h> #include "posixtest.h" int main()@@ -29,6 +30,7 @@ int main()return PTS_UNRESOLVED; #endif */ + pthread_mutexattr_t mattr; pthread_mutex_t mutex; int prioceiling, max_prio, min_prio;@@ -40,6 +42,34 @@ int main() } /* Get the prioceiling of the mutex. */ + if(pthread_mutex_getprioceiling(&mutex, &prioceiling) != EINVAL) + { + printf("Test FAILED: Default, the protocol attribute of mutex " + "is PTHREAD_PRIO_NONE, so pthread_mutex_getprioceiling " + "should return EINVAL\n"); + return PTS_FAIL; + } + + if (pthread_mutexattr_init(&mattr) != 0) + { + perror("Error at pthread_mutexattr_init()\n"); + return PTS_UNRESOLVED; + } + + if (pthread_mutexattr_setprotocol(&mattr, PTHREAD_PRIO_PROTECT) != 0) + { + perror("Error at pthread_mutexattr_setprotocol()\n"); + return PTS_UNRESOLVED; + } + + /* Initialize a mutex object */
testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c int main() · line 75
Quoted 10 lines
testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c +7
-0+ if(pthread_mutex_init(&mutex, &mattr) != 0) + { + perror("Error at pthread_mutex_init()\n"); + return PTS_UNRESOLVED; + } + + /* Get the prioceiling of the mutex. */ if(pthread_mutex_getprioceiling(&mutex, &prioceiling) != 0) { printf("Test FAILED: Error obtaining the priority ceiling\n");
A patch similar to this will be committed soon. The above patch
has several correctness issues with perror (you have to capture the error and play it back via strerror), and the original test author accidentally mixed up one of the requirements between pthread_mutex_getprioceiling and pthread_mutexattr_getprioceiling as well by accident. This helped unroot a requirements issue on FreeBSD with PTHREAD_PRIO_INHERIT, and it might so similar on Linux.
Partial credit will be `awarded' for having keen eyes on this
issue though :).
Thanks,
-Garrett
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 28 lines · Garrett Cooper
Quoted 27 lines · Bian Naimeng
The default value of the mutex's protocol shall be
PTHREAD_PRIO_NONE, sopthread_mutex_getprioceilingshould return EINVAL.Signed-off-by Bian Naimeng <[email protected]>--- .../interfaces/pthread_mutex_getprioceiling/1-1.c | 30 ++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-)testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c +2
-0@@ -18,6 +18,7 @@#include <pthread.h> #include <stdio.h> #include <sched.h> +#include <errno.h> #include "posixtest.h" int main ()@@ -29,6 +30,7 @@ int main()return PTS_UNRESOLVED; #endif */ +pthread_mutexattr_t mattr;pthread_mutex_t mutex;
... snip ...
Quoted 6 lines
testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c int main() · line 75
Quoted 5 lines
testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c +2
-0+ +/* Get the prioceiling of the mutex. */ if (pthread_mutex_getprioceiling (&mutex, &prioceiling) !=0 ) {printf ("Test FAILED: Error obtaining the priority ceiling\n" );
Quoted 7 lines
A patch similar to this will be committed soon. The above patch
has several correctness issues with perror (you have to capture the error and play it back via strerror), and the original test author accidentally mixed up one of the requirements betweenpthread_mutex_getprioceilingandpthread_mutexattr_getprioceilingas well by accident. This helped unroot a requirements issue on FreeBSD withPTHREAD_PRIO_INHERIT, and it might so similar on Linux.
OK. I think it's better if you can send your patch at this thread. ^_^
Quoted 2 lines
Partial credit will be `awarded' for having keen eyes on this
issue though :).
Thanks very much. ^_^
Quoted 4 lines
Thanks,
-Garrett
Signature · 14 lines
Regards Bian Naimeng ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
2010/11/8 Bian Naimeng <[email protected]>:
Quoted 48 lines
Quoted 28 lines · Garrett Cooper
Quoted 27 lines · Bian Naimeng
The default value of the mutex's protocol shall be
PTHREAD_PRIO_NONE, sopthread_mutex_getprioceilingshould return EINVAL.Signed-off-by Bian Naimeng <[email protected]>---
.../interfaces/pthread_mutex_getprioceiling/1-1.c | 30 ++++++++++++++++++++1 files changed, 30 insertions(+), 0 deletions(-)testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c +2
-0@@ -18,6 +18,7 @@ #include <pthread.h> #include <stdio.h> #include <sched.h> +#include <errno.h> #include "posixtest.h" int main()@@ -29,6 +30,7 @@ int main()return PTS_UNRESOLVED; #endif */ + pthread_mutexattr_t mattr; pthread_mutex_t mutex;... snip ...
Quoted 6 lines
Quoted 5 lines
+
+ /* Get the prioceiling of the mutex. */if(pthread_mutex_getprioceiling(&mutex, &prioceiling) != 0){
printf("Test FAILED: Error obtaining the priority ceiling\n");Quoted 7 lines
A patch similar to this will be committed soon. The above patch has several correctness issues with perror (you have to capture the error and play it back via strerror), and the original test author accidentally mixed up one of the requirements between
pthread_mutex_getprioceilingandpthread_mutexattr_getprioceilingas well by accident. This helped unroot a requirements issue on FreeBSD withPTHREAD_PRIO_INHERIT, and it might so similar on Linux.
Quoted 1 line
OK. I think it's better if you can send your patch at this thread. ^_^
http://ltp.git.sourceforge.net/git/gitweb.cgi?p=ltp/ltp.git;a=commit;h=68332a1
Quoted 4 lines
Quoted 2 lines
Partial credit will be `awarded' for having keen eyes on this issue though :).
Thanks very much. ^_^
No problem. Here's the other commit (because I forgot to mention you in the first one ><):
http://ltp.git.sourceforge.net/git/gitweb.cgi?p=ltp/ltp.git;a=commit;h=17fb758
Cheers!
-Garrett
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list