about summary refs log tree commit diff
path: root/nptl/pthread_mutexattr_getprioceiling.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/pthread_mutexattr_getprioceiling.c')
-rw-r--r--nptl/pthread_mutexattr_getprioceiling.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/nptl/pthread_mutexattr_getprioceiling.c b/nptl/pthread_mutexattr_getprioceiling.c
index da1beabf46..792e9a43d6 100644
--- a/nptl/pthread_mutexattr_getprioceiling.c
+++ b/nptl/pthread_mutexattr_getprioceiling.c
@@ -27,11 +27,22 @@ pthread_mutexattr_getprioceiling (attr, prioceiling)
      int *prioceiling;
 {
   const struct pthread_mutexattr *iattr;
+  int ceiling;
 
   iattr = (const struct pthread_mutexattr *) attr;
 
-  *prioceiling = ((iattr->mutexkind & PTHREAD_MUTEXATTR_PRIO_CEILING_MASK)
-		  >> PTHREAD_MUTEXATTR_PRIO_CEILING_SHIFT);
+  ceiling = ((iattr->mutexkind & PTHREAD_MUTEXATTR_PRIO_CEILING_MASK)
+	     >> PTHREAD_MUTEXATTR_PRIO_CEILING_SHIFT);
+
+  if (! ceiling)
+    {
+      if (__sched_fifo_min_prio == -1)
+	__init_sched_fifo_prio ();
+      if (ceiling < __sched_fifo_min_prio)
+	ceiling = __sched_fifo_min_prio;
+    }
+
+  *prioceiling = ceiling;
 
   return 0;
 }