|
|
ce426f |
commit 2868e0703d5b8c8e60c6f60de13e876c4d85daa0
|
|
|
ce426f |
Author: Andreas Schwab <schwab@suse.de>
|
|
|
ce426f |
Date: Mon Aug 11 11:18:26 2014 +0200
|
|
|
ce426f |
|
|
|
ce426f |
Filter out PTHREAD_MUTEX_NO_ELISION_NP bit in pthread_mutexattr_gettype (BZ #15790)
|
|
|
ce426f |
|
|
|
ce426f |
pthread_mutexattr_settype adds PTHREAD_MUTEX_NO_ELISION_NP to kind,
|
|
|
ce426f |
which is an internal flag that pthread_mutexattr_gettype shouldn't
|
|
|
ce426f |
expose, since pthread_mutexattr_settype wouldn't accept it.
|
|
|
ce426f |
Index: glibc-2.17-c758a686/nptl/Makefile
|
|
|
ce426f |
===================================================================
|
|
|
ce426f |
--- glibc-2.17-c758a686.orig/nptl/Makefile
|
|
|
ce426f |
+++ glibc-2.17-c758a686/nptl/Makefile
|
|
|
ce426f |
@@ -252,6 +252,7 @@ tests = tst-typesizes \
|
|
|
ce426f |
tst-exit1 tst-exit2 tst-exit3 \
|
|
|
ce426f |
tst-stdio1 tst-stdio2 \
|
|
|
ce426f |
tst-stack1 tst-stack2 tst-stack3 tst-stack4 tst-pthread-getattr \
|
|
|
ce426f |
+ tst-pthread-mutexattr \
|
|
|
ce426f |
tst-unload \
|
|
|
ce426f |
tst-dlsym1 \
|
|
|
ce426f |
tst-sysconf \
|
|
|
ce426f |
Index: glibc-2.17-c758a686/nptl/pthread_mutexattr_gettype.c
|
|
|
ce426f |
===================================================================
|
|
|
ce426f |
--- glibc-2.17-c758a686.orig/nptl/pthread_mutexattr_gettype.c
|
|
|
ce426f |
+++ glibc-2.17-c758a686/nptl/pthread_mutexattr_gettype.c
|
|
|
ce426f |
@@ -28,7 +28,8 @@ pthread_mutexattr_gettype (attr, kind)
|
|
|
ce426f |
|
|
|
ce426f |
iattr = (const struct pthread_mutexattr *) attr;
|
|
|
ce426f |
|
|
|
ce426f |
- *kind = iattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS;
|
|
|
ce426f |
+ *kind = (iattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS
|
|
|
ce426f |
+ & ~PTHREAD_MUTEX_NO_ELISION_NP);
|
|
|
ce426f |
|
|
|
ce426f |
return 0;
|
|
|
ce426f |
}
|
|
|
ce426f |
Index: glibc-2.17-c758a686/nptl/tst-pthread-mutexattr.c
|
|
|
ce426f |
===================================================================
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ glibc-2.17-c758a686/nptl/tst-pthread-mutexattr.c
|
|
|
ce426f |
@@ -0,0 +1,60 @@
|
|
|
ce426f |
+/* Make sure that pthread_mutexattr_gettype returns a valid kind.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#include <stdio.h>
|
|
|
ce426f |
+#include <string.h>
|
|
|
ce426f |
+#include <pthread.h>
|
|
|
ce426f |
+
|
|
|
ce426f |
+static int
|
|
|
ce426f |
+do_test (void)
|
|
|
ce426f |
+{
|
|
|
ce426f |
+ pthread_mutexattr_t attr;
|
|
|
ce426f |
+ int kind;
|
|
|
ce426f |
+ int error;
|
|
|
ce426f |
+
|
|
|
ce426f |
+ error = pthread_mutexattr_init (&attr);
|
|
|
ce426f |
+ if (error)
|
|
|
ce426f |
+ {
|
|
|
ce426f |
+ printf ("pthread_mutexattr_init: %s\n", strerror (error));
|
|
|
ce426f |
+ return 1;
|
|
|
ce426f |
+ }
|
|
|
ce426f |
+ error = pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_DEFAULT);
|
|
|
ce426f |
+ if (error)
|
|
|
ce426f |
+ {
|
|
|
ce426f |
+ printf ("pthread_mutexattr_settype (1): %s\n", strerror (error));
|
|
|
ce426f |
+ return 1;
|
|
|
ce426f |
+ }
|
|
|
ce426f |
+ error = pthread_mutexattr_gettype (&attr, &kind);
|
|
|
ce426f |
+ if (error)
|
|
|
ce426f |
+ {
|
|
|
ce426f |
+ printf ("pthread_mutexattr_gettype: %s\n", strerror (error));
|
|
|
ce426f |
+ return 1;
|
|
|
ce426f |
+ }
|
|
|
ce426f |
+ error = pthread_mutexattr_settype (&attr, kind);
|
|
|
ce426f |
+ if (error)
|
|
|
ce426f |
+ {
|
|
|
ce426f |
+ printf ("pthread_mutexattr_settype (2): %s\n", strerror (error));
|
|
|
ce426f |
+ return 1;
|
|
|
ce426f |
+ }
|
|
|
ce426f |
+ return 0;
|
|
|
ce426f |
+}
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+#define TEST_FUNCTION do_test ()
|
|
|
ce426f |
+#include "../test-skeleton.c"
|