Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: nptl/pthread_mutexattr_setpshared.c

Issue 1234673002: Clean up error returns for unsupported pthread mutex/cond attr values (Closed) Base URL: https://chromium.googlesource.com/native_client/nacl-glibc.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « nptl/pthread_condattr_setpshared.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: nptl/pthread_mutexattr_setpshared.c
diff --git a/nptl/pthread_mutexattr_setpshared.c b/nptl/pthread_mutexattr_setpshared.c
index 8e08b9e16109844e60524dc5070d8b29c2a76984..d8280a8be185cdafdcd4d138c53e461234228463 100644
--- a/nptl/pthread_mutexattr_setpshared.c
+++ b/nptl/pthread_mutexattr_setpshared.c
@@ -26,18 +26,15 @@ pthread_mutexattr_setpshared (attr, pshared)
pthread_mutexattr_t *attr;
int pshared;
{
- struct pthread_mutexattr *iattr;
+ switch (pshared)
+ {
+ case PTHREAD_PROCESS_PRIVATE: /* This is the default state. */
+ return 0;
- if (pshared != PTHREAD_PROCESS_PRIVATE
- && __builtin_expect (pshared != PTHREAD_PROCESS_SHARED, 0))
- return EINVAL;
+ case PTHREAD_PROCESS_SHARED: /* NaCl does not support this. */
+ return ENOTSUP;
- iattr = (struct pthread_mutexattr *) attr;
-
- if (pshared == PTHREAD_PROCESS_PRIVATE)
- iattr->mutexkind &= ~PTHREAD_MUTEXATTR_FLAG_PSHARED;
- else
- iattr->mutexkind |= PTHREAD_MUTEXATTR_FLAG_PSHARED;
-
- return 0;
+ default: /* Anything else is bogus. */
+ return EINVAL;
+ }
}
« no previous file with comments | « nptl/pthread_condattr_setpshared.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698