This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 5/9] Support setting elision in pthread_mutexattr_settype
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Andi Kleen <andi at firstfloor dot org>
- Cc: libc-alpha at sourceware dot org, Andi Kleen <ak at linux dot intel dot com>
- Date: Tue, 14 May 2013 10:29:10 -0400
- Subject: Re: [PATCH 5/9] Support setting elision in pthread_mutexattr_settype
- References: <1368225725-14283-1-git-send-email-andi at firstfloor dot org> <1368225725-14283-6-git-send-email-andi at firstfloor dot org>
On 05/10/2013 06:42 PM, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> 2013-05-02 Andi Kleen <ak@linux.intel.com>
>
> * pthread_mutexattr_settype.c (__pthread_mutexattr_settype):
> Support elision flags.
> ---
> nptl/pthread_mutexattr_settype.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/nptl/pthread_mutexattr_settype.c b/nptl/pthread_mutexattr_settype.c
> index 7b476e9..cd4cec8 100644
> --- a/nptl/pthread_mutexattr_settype.c
> +++ b/nptl/pthread_mutexattr_settype.c
> @@ -26,8 +26,11 @@ __pthread_mutexattr_settype (attr, kind)
> int kind;
> {
> struct pthread_mutexattr *iattr;
> + int mkind = kind & ~PTHREAD_MUTEX_ELISION_FLAGS_NP;
>
> - if (kind < PTHREAD_MUTEX_NORMAL || kind > PTHREAD_MUTEX_ADAPTIVE_NP)
> + if (mkind < PTHREAD_MUTEX_NORMAL || mkind > PTHREAD_MUTEX_ADAPTIVE_NP)
> + return EINVAL;
> + if ((kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == PTHREAD_MUTEX_ELISION_FLAGS_NP)
> return EINVAL;
Why is this invalid?
>
> iattr = (struct pthread_mutexattr *) attr;
>
Cheers,
Carlos.