Blame SOURCES/glibc-rh841653-12.patch

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