From: Bian Naimeng <biannm@cn.fujitsu.com>
To: Garrett Cooper <yanegomi@gmail.com>
Cc: ltp-list@lists.sourceforge.net
Subject: [LTP] [POSIX][PATCH]pthread_mutex_getprioceiling should return EINVAl when mutex's protocol is PTHREAD_PRIO_NONE.
Date: Tue, 02 Nov 2010 17:07:20 +0800 [thread overview]
Message-ID: <4CCFD4C8.8060007@cn.fujitsu.com> (raw)
The default value of the mutex's protocol shall be PTHREAD_PRIO_NONE,
so pthread_mutex_getprioceiling should return EINVAL.
Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
---
.../interfaces/pthread_mutex_getprioceiling/1-1.c | 30 ++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c
index d9251e6..65c8c6b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c
@@ -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");
--
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next reply other threads:[~2010-11-02 9:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-02 9:07 Bian Naimeng [this message]
2010-11-08 9:46 ` [LTP] [POSIX][PATCH]pthread_mutex_getprioceiling should return EINVAl when mutex's protocol is PTHREAD_PRIO_NONE Garrett Cooper
2010-11-08 10:55 ` Bian Naimeng
2010-11-08 11:45 ` Garrett Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CCFD4C8.8060007@cn.fujitsu.com \
--to=biannm@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=yanegomi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox