[PATCH] posix: Implement self-contained POSIX mutex
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed Oct 4 09:27:42 UTC 2017
POSIX mutexes are now available in all configurations and no longer
depend on --enable-posix.
Update #2514.
Update #3112.
---
c/src/ada-tests/mptests/mp01/config_base.h | 1 -
c/src/ada-tests/mptests/mp03/config_base.h | 1 -
c/src/ada-tests/mptests/mp04/config_base.h | 1 -
c/src/ada-tests/mptests/mp05/config_base.h | 1 -
c/src/ada-tests/mptests/mp06/config_base.h | 1 -
c/src/ada-tests/mptests/mp07/config_base.h | 1 -
c/src/ada-tests/mptests/mp08/config_base.h | 1 -
c/src/ada-tests/mptests/mp09/config_base.h | 1 -
c/src/ada-tests/mptests/mp10/config_base.h | 1 -
c/src/ada-tests/mptests/mp11/config_base.h | 1 -
c/src/ada-tests/mptests/mp12/config_base.h | 1 -
c/src/ada-tests/mptests/mp13/config_base.h | 1 -
c/src/ada-tests/mptests/mp14/config_base.h | 1 -
c/src/ada-tests/samples/base_mp/config.h | 1 -
c/src/ada-tests/samples/base_sp/config.h | 1 -
c/src/ada-tests/samples/hello/config.h | 1 -
c/src/ada-tests/samples/nsecs/config.h | 1 -
c/src/ada-tests/samples/ticker/config.h | 1 -
c/src/ada-tests/sptests/sp01/config.h | 1 -
c/src/ada-tests/sptests/sp02/config.h | 1 -
c/src/ada-tests/sptests/sp03/config.h | 1 -
c/src/ada-tests/sptests/sp04/config.h | 1 -
c/src/ada-tests/sptests/sp05/config.h | 1 -
c/src/ada-tests/sptests/sp06/config.h | 1 -
c/src/ada-tests/sptests/sp07/config.h | 1 -
c/src/ada-tests/sptests/sp08/config.h | 1 -
c/src/ada-tests/sptests/sp09/config.h | 1 -
c/src/ada-tests/sptests/sp11/config.h | 1 -
c/src/ada-tests/sptests/sp12/config.h | 1 -
c/src/ada-tests/sptests/sp13/config.h | 1 -
c/src/ada-tests/sptests/sp14/config.h | 1 -
c/src/ada-tests/sptests/sp15/config.h | 1 -
c/src/ada-tests/sptests/sp16/config.h | 1 -
c/src/ada-tests/sptests/sp17/config.h | 1 -
c/src/ada-tests/sptests/sp19/config.h | 1 -
c/src/ada-tests/sptests/sp20/config.h | 1 -
c/src/ada-tests/sptests/sp22/config.h | 1 -
c/src/ada-tests/sptests/sp23/config.h | 1 -
c/src/ada-tests/sptests/sp24/config.h | 1 -
c/src/ada-tests/sptests/sp25/config.h | 1 -
c/src/ada-tests/sptests/spname01/config.h | 1 -
c/src/ada-tests/tmtests/tm01/config.h | 1 -
c/src/ada-tests/tmtests/tm02/config.h | 1 -
c/src/ada-tests/tmtests/tm03/config.h | 1 -
c/src/ada-tests/tmtests/tm04/config.h | 1 -
c/src/ada-tests/tmtests/tm05/config.h | 1 -
c/src/ada-tests/tmtests/tm06/config.h | 1 -
c/src/ada-tests/tmtests/tm07/config.h | 1 -
c/src/ada-tests/tmtests/tm08/config.h | 1 -
c/src/ada-tests/tmtests/tm09/config.h | 1 -
c/src/ada-tests/tmtests/tm10/config.h | 1 -
c/src/ada-tests/tmtests/tm11/config.h | 1 -
c/src/ada-tests/tmtests/tm12/config.h | 1 -
c/src/ada-tests/tmtests/tm13/config.h | 1 -
c/src/ada-tests/tmtests/tm14/config.h | 1 -
c/src/ada-tests/tmtests/tm15/config.h | 1 -
c/src/ada-tests/tmtests/tm16/config.h | 1 -
c/src/ada-tests/tmtests/tm17/config.h | 1 -
c/src/ada-tests/tmtests/tm18/config.h | 1 -
c/src/ada-tests/tmtests/tm19/config.h | 1 -
c/src/ada-tests/tmtests/tm20/config.h | 1 -
c/src/ada-tests/tmtests/tm21/config.h | 1 -
c/src/ada-tests/tmtests/tm22/config.h | 1 -
c/src/ada-tests/tmtests/tm23/config.h | 1 -
c/src/ada-tests/tmtests/tm24/config.h | 1 -
c/src/ada-tests/tmtests/tm25/config.h | 1 -
c/src/ada-tests/tmtests/tm28/config.h | 1 -
c/src/ada-tests/tmtests/tm29/config.h | 1 -
c/src/ada-tests/tmtests/tmck/config.h | 1 -
c/src/ada-tests/tmtests/tmoverhd/config.h | 1 -
cpukit/libblock/src/bdbuf.c | 6 +-
cpukit/libcsupport/include/rtems/libcsupport.h | 1 -
cpukit/libcsupport/src/resource_snapshot.c | 1 -
cpukit/posix/Makefile.am | 23 +-
cpukit/posix/include/rtems/posix/config.h | 6 -
cpukit/posix/include/rtems/posix/mutex.h | 75 ----
cpukit/posix/include/rtems/posix/muteximpl.h | 454 ++++++++++++++++++---
cpukit/posix/preinstall.am | 12 +-
cpukit/posix/src/mutex.c | 75 ----
cpukit/posix/src/mutexdestroy.c | 33 +-
cpukit/posix/src/mutexget.c | 37 --
cpukit/posix/src/mutexgetprioceiling.c | 17 +-
cpukit/posix/src/mutexinit.c | 83 +++-
cpukit/posix/src/mutexlocksupp.c | 79 ++--
cpukit/posix/src/mutexsetprioceiling.c | 16 +-
cpukit/posix/src/mutexunlock.c | 75 +++-
cpukit/rtems/src/rtemsobjectgetapiclassname.c | 1 -
cpukit/sapi/include/confdefs.h | 69 +---
cpukit/sapi/src/posixapi.c | 37 ++
cpukit/score/Makefile.am | 1 +
cpukit/score/include/rtems/score/muteximpl.h | 37 ++
cpukit/score/include/rtems/score/objectimpl.h | 1 -
cpukit/score/include/rtems/sysinit.h | 1 -
cpukit/score/preinstall.am | 4 +
cpukit/score/src/mutex.c | 11 +-
testsuites/psxtests/psx05/init.c | 193 ++++++++-
testsuites/psxtests/psx05/psx05.scn | 7 +-
testsuites/psxtests/psx05/system.h | 3 +-
testsuites/psxtests/psx09/system.h | 1 -
testsuites/psxtests/psx10/system.h | 1 -
testsuites/psxtests/psxaio01/system.h | 1 -
testsuites/psxtests/psxaio02/system.h | 1 -
testsuites/psxtests/psxaio03/system.h | 1 -
testsuites/psxtests/psxautoinit01/init.c | 23 +-
.../psxtests/psxautoinit01/psxautoinit01.scn | 7 +-
testsuites/psxtests/psxautoinit02/init.c | 1 -
testsuites/psxtests/psxcleanup/system.h | 1 -
testsuites/psxtests/psxcond01/init.c | 1 -
testsuites/psxtests/psxconfig01/init.c | 13 -
testsuites/psxtests/psxkey07/init.c | 1 -
testsuites/psxtests/psxsignal06/init.c | 1 -
testsuites/psxtests/psxtimer01/system.h | 1 -
testsuites/psxtmtests/psxtmcond03/init.c | 1 -
testsuites/psxtmtests/psxtmcond04/init.c | 1 -
testsuites/psxtmtests/psxtmcond06/init.c | 1 -
testsuites/psxtmtests/psxtmcond07/init.c | 1 -
testsuites/psxtmtests/psxtmcond08/init.c | 1 -
testsuites/psxtmtests/psxtmmutex01/init.c | 1 -
testsuites/psxtmtests/psxtmmutex02/init.c | 1 -
testsuites/psxtmtests/psxtmmutex03/init.c | 1 -
testsuites/psxtmtests/psxtmmutex04/init.c | 1 -
testsuites/psxtmtests/psxtmmutex05/init.c | 1 -
testsuites/psxtmtests/psxtmmutex06/init.c | 1 -
testsuites/psxtmtests/psxtmmutex07/init.c | 1 -
testsuites/smptests/smppsxmutex01/init.c | 1 -
testsuites/sptests/spmutex01/init.c | 1 -
testsuites/sptests/spsysinit01/init.c | 15 -
testsuites/sptests/spthreadq01/init.c | 38 --
128 files changed, 886 insertions(+), 663 deletions(-)
delete mode 100644 cpukit/posix/include/rtems/posix/mutex.h
delete mode 100644 cpukit/posix/src/mutex.c
delete mode 100644 cpukit/posix/src/mutexget.c
create mode 100644 cpukit/score/include/rtems/score/muteximpl.h
diff --git a/c/src/ada-tests/mptests/mp01/config_base.h b/c/src/ada-tests/mptests/mp01/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp01/config_base.h
+++ b/c/src/ada-tests/mptests/mp01/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/mptests/mp03/config_base.h b/c/src/ada-tests/mptests/mp03/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp03/config_base.h
+++ b/c/src/ada-tests/mptests/mp03/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/mptests/mp04/config_base.h b/c/src/ada-tests/mptests/mp04/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp04/config_base.h
+++ b/c/src/ada-tests/mptests/mp04/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/mptests/mp05/config_base.h b/c/src/ada-tests/mptests/mp05/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp05/config_base.h
+++ b/c/src/ada-tests/mptests/mp05/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/mptests/mp06/config_base.h b/c/src/ada-tests/mptests/mp06/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp06/config_base.h
+++ b/c/src/ada-tests/mptests/mp06/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/mptests/mp07/config_base.h b/c/src/ada-tests/mptests/mp07/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp07/config_base.h
+++ b/c/src/ada-tests/mptests/mp07/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/mptests/mp08/config_base.h b/c/src/ada-tests/mptests/mp08/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp08/config_base.h
+++ b/c/src/ada-tests/mptests/mp08/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/mptests/mp09/config_base.h b/c/src/ada-tests/mptests/mp09/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp09/config_base.h
+++ b/c/src/ada-tests/mptests/mp09/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/mptests/mp10/config_base.h b/c/src/ada-tests/mptests/mp10/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp10/config_base.h
+++ b/c/src/ada-tests/mptests/mp10/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/mptests/mp11/config_base.h b/c/src/ada-tests/mptests/mp11/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp11/config_base.h
+++ b/c/src/ada-tests/mptests/mp11/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/mptests/mp12/config_base.h b/c/src/ada-tests/mptests/mp12/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp12/config_base.h
+++ b/c/src/ada-tests/mptests/mp12/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/mptests/mp13/config_base.h b/c/src/ada-tests/mptests/mp13/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp13/config_base.h
+++ b/c/src/ada-tests/mptests/mp13/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/mptests/mp14/config_base.h b/c/src/ada-tests/mptests/mp14/config_base.h
index d8fb72a5aa..c1b8f24e86 100644
--- a/c/src/ada-tests/mptests/mp14/config_base.h
+++ b/c/src/ada-tests/mptests/mp14/config_base.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/samples/base_mp/config.h b/c/src/ada-tests/samples/base_mp/config.h
index 5bc381d1e6..33c9288f4c 100644
--- a/c/src/ada-tests/samples/base_mp/config.h
+++ b/c/src/ada-tests/samples/base_mp/config.h
@@ -24,7 +24,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
/*
* Put the overrides of default configuration parameters here.
diff --git a/c/src/ada-tests/samples/base_sp/config.h b/c/src/ada-tests/samples/base_sp/config.h
index 99e023117b..083d52515e 100644
--- a/c/src/ada-tests/samples/base_sp/config.h
+++ b/c/src/ada-tests/samples/base_sp/config.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 2
diff --git a/c/src/ada-tests/samples/hello/config.h b/c/src/ada-tests/samples/hello/config.h
index 712c14c284..2be186cc2a 100644
--- a/c/src/ada-tests/samples/hello/config.h
+++ b/c/src/ada-tests/samples/hello/config.h
@@ -23,7 +23,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 1
diff --git a/c/src/ada-tests/samples/nsecs/config.h b/c/src/ada-tests/samples/nsecs/config.h
index c359b76651..7703e721f0 100644
--- a/c/src/ada-tests/samples/nsecs/config.h
+++ b/c/src/ada-tests/samples/nsecs/config.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 1
diff --git a/c/src/ada-tests/samples/ticker/config.h b/c/src/ada-tests/samples/ticker/config.h
index 0fb068fb32..17d957c94a 100644
--- a/c/src/ada-tests/samples/ticker/config.h
+++ b/c/src/ada-tests/samples/ticker/config.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 4
diff --git a/c/src/ada-tests/sptests/sp01/config.h b/c/src/ada-tests/sptests/sp01/config.h
index 4cc789dc1a..3a11342306 100644
--- a/c/src/ada-tests/sptests/sp01/config.h
+++ b/c/src/ada-tests/sptests/sp01/config.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 4
diff --git a/c/src/ada-tests/sptests/sp02/config.h b/c/src/ada-tests/sptests/sp02/config.h
index 0fb068fb32..17d957c94a 100644
--- a/c/src/ada-tests/sptests/sp02/config.h
+++ b/c/src/ada-tests/sptests/sp02/config.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 4
diff --git a/c/src/ada-tests/sptests/sp03/config.h b/c/src/ada-tests/sptests/sp03/config.h
index 655026e6ef..393afc4b28 100644
--- a/c/src/ada-tests/sptests/sp03/config.h
+++ b/c/src/ada-tests/sptests/sp03/config.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 3
diff --git a/c/src/ada-tests/sptests/sp04/config.h b/c/src/ada-tests/sptests/sp04/config.h
index a7b928fd4a..45fc324df8 100644
--- a/c/src/ada-tests/sptests/sp04/config.h
+++ b/c/src/ada-tests/sptests/sp04/config.h
@@ -25,7 +25,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 4
diff --git a/c/src/ada-tests/sptests/sp05/config.h b/c/src/ada-tests/sptests/sp05/config.h
index b72a42bcd1..d85c77e62b 100644
--- a/c/src/ada-tests/sptests/sp05/config.h
+++ b/c/src/ada-tests/sptests/sp05/config.h
@@ -24,7 +24,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 4
diff --git a/c/src/ada-tests/sptests/sp06/config.h b/c/src/ada-tests/sptests/sp06/config.h
index b72a42bcd1..d85c77e62b 100644
--- a/c/src/ada-tests/sptests/sp06/config.h
+++ b/c/src/ada-tests/sptests/sp06/config.h
@@ -24,7 +24,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 4
diff --git a/c/src/ada-tests/sptests/sp07/config.h b/c/src/ada-tests/sptests/sp07/config.h
index afc6b2f676..2aa307a46c 100644
--- a/c/src/ada-tests/sptests/sp07/config.h
+++ b/c/src/ada-tests/sptests/sp07/config.h
@@ -25,7 +25,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 5
diff --git a/c/src/ada-tests/sptests/sp08/config.h b/c/src/ada-tests/sptests/sp08/config.h
index 380883768d..6ada011600 100644
--- a/c/src/ada-tests/sptests/sp08/config.h
+++ b/c/src/ada-tests/sptests/sp08/config.h
@@ -24,7 +24,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 2
diff --git a/c/src/ada-tests/sptests/sp09/config.h b/c/src/ada-tests/sptests/sp09/config.h
index 861180e438..a94c222fa1 100644
--- a/c/src/ada-tests/sptests/sp09/config.h
+++ b/c/src/ada-tests/sptests/sp09/config.h
@@ -32,7 +32,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/sp11/config.h b/c/src/ada-tests/sptests/sp11/config.h
index f4ef59ede9..41506d08ee 100644
--- a/c/src/ada-tests/sptests/sp11/config.h
+++ b/c/src/ada-tests/sptests/sp11/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/sp12/config.h b/c/src/ada-tests/sptests/sp12/config.h
index 2be58dbdcf..cd574e737f 100644
--- a/c/src/ada-tests/sptests/sp12/config.h
+++ b/c/src/ada-tests/sptests/sp12/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/sp13/config.h b/c/src/ada-tests/sptests/sp13/config.h
index 448cea9ffd..8e7821e061 100644
--- a/c/src/ada-tests/sptests/sp13/config.h
+++ b/c/src/ada-tests/sptests/sp13/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/sp14/config.h b/c/src/ada-tests/sptests/sp14/config.h
index 89071c3388..2c046d6db3 100644
--- a/c/src/ada-tests/sptests/sp14/config.h
+++ b/c/src/ada-tests/sptests/sp14/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/sp15/config.h b/c/src/ada-tests/sptests/sp15/config.h
index 8db00f3616..7774f3563c 100644
--- a/c/src/ada-tests/sptests/sp15/config.h
+++ b/c/src/ada-tests/sptests/sp15/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/sp16/config.h b/c/src/ada-tests/sptests/sp16/config.h
index 63bdd592bd..087a4c5a49 100644
--- a/c/src/ada-tests/sptests/sp16/config.h
+++ b/c/src/ada-tests/sptests/sp16/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/sp17/config.h b/c/src/ada-tests/sptests/sp17/config.h
index ce8ea3728f..0ceab6f736 100644
--- a/c/src/ada-tests/sptests/sp17/config.h
+++ b/c/src/ada-tests/sptests/sp17/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/sp19/config.h b/c/src/ada-tests/sptests/sp19/config.h
index 9264b83be4..278aaf69b0 100644
--- a/c/src/ada-tests/sptests/sp19/config.h
+++ b/c/src/ada-tests/sptests/sp19/config.h
@@ -22,7 +22,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 7
diff --git a/c/src/ada-tests/sptests/sp20/config.h b/c/src/ada-tests/sptests/sp20/config.h
index ccbd3e6a0b..daf598bf4c 100644
--- a/c/src/ada-tests/sptests/sp20/config.h
+++ b/c/src/ada-tests/sptests/sp20/config.h
@@ -25,7 +25,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/sp22/config.h b/c/src/ada-tests/sptests/sp22/config.h
index 36a984ab80..b8ed5c97d0 100644
--- a/c/src/ada-tests/sptests/sp22/config.h
+++ b/c/src/ada-tests/sptests/sp22/config.h
@@ -25,7 +25,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/sp23/config.h b/c/src/ada-tests/sptests/sp23/config.h
index de87c32e45..277e38b708 100644
--- a/c/src/ada-tests/sptests/sp23/config.h
+++ b/c/src/ada-tests/sptests/sp23/config.h
@@ -25,7 +25,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/sp24/config.h b/c/src/ada-tests/sptests/sp24/config.h
index bfd5f1ee30..a72dd35dac 100644
--- a/c/src/ada-tests/sptests/sp24/config.h
+++ b/c/src/ada-tests/sptests/sp24/config.h
@@ -25,7 +25,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/sp25/config.h b/c/src/ada-tests/sptests/sp25/config.h
index ab5b7356ad..aa74afdd45 100644
--- a/c/src/ada-tests/sptests/sp25/config.h
+++ b/c/src/ada-tests/sptests/sp25/config.h
@@ -25,7 +25,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/sptests/spname01/config.h b/c/src/ada-tests/sptests/spname01/config.h
index 712c14c284..2be186cc2a 100644
--- a/c/src/ada-tests/sptests/spname01/config.h
+++ b/c/src/ada-tests/sptests/spname01/config.h
@@ -23,7 +23,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#define CONFIGURE_MAXIMUM_TASKS 1
diff --git a/c/src/ada-tests/tmtests/tm01/config.h b/c/src/ada-tests/tmtests/tm01/config.h
index 2a720540a9..7730385b3c 100644
--- a/c/src/ada-tests/tmtests/tm01/config.h
+++ b/c/src/ada-tests/tmtests/tm01/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm02/config.h b/c/src/ada-tests/tmtests/tm02/config.h
index bd25a5b7c5..b03802dcc5 100644
--- a/c/src/ada-tests/tmtests/tm02/config.h
+++ b/c/src/ada-tests/tmtests/tm02/config.h
@@ -27,7 +27,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm03/config.h b/c/src/ada-tests/tmtests/tm03/config.h
index bd25a5b7c5..b03802dcc5 100644
--- a/c/src/ada-tests/tmtests/tm03/config.h
+++ b/c/src/ada-tests/tmtests/tm03/config.h
@@ -27,7 +27,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm04/config.h b/c/src/ada-tests/tmtests/tm04/config.h
index d861fe9621..700438ceae 100644
--- a/c/src/ada-tests/tmtests/tm04/config.h
+++ b/c/src/ada-tests/tmtests/tm04/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm05/config.h b/c/src/ada-tests/tmtests/tm05/config.h
index bd25a5b7c5..b03802dcc5 100644
--- a/c/src/ada-tests/tmtests/tm05/config.h
+++ b/c/src/ada-tests/tmtests/tm05/config.h
@@ -27,7 +27,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm06/config.h b/c/src/ada-tests/tmtests/tm06/config.h
index bd25a5b7c5..b03802dcc5 100644
--- a/c/src/ada-tests/tmtests/tm06/config.h
+++ b/c/src/ada-tests/tmtests/tm06/config.h
@@ -27,7 +27,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm07/config.h b/c/src/ada-tests/tmtests/tm07/config.h
index bd25a5b7c5..b03802dcc5 100644
--- a/c/src/ada-tests/tmtests/tm07/config.h
+++ b/c/src/ada-tests/tmtests/tm07/config.h
@@ -27,7 +27,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm08/config.h b/c/src/ada-tests/tmtests/tm08/config.h
index bd25a5b7c5..b03802dcc5 100644
--- a/c/src/ada-tests/tmtests/tm08/config.h
+++ b/c/src/ada-tests/tmtests/tm08/config.h
@@ -27,7 +27,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm09/config.h b/c/src/ada-tests/tmtests/tm09/config.h
index 60c467cbf0..56b5b2848e 100644
--- a/c/src/ada-tests/tmtests/tm09/config.h
+++ b/c/src/ada-tests/tmtests/tm09/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm10/config.h b/c/src/ada-tests/tmtests/tm10/config.h
index df3eb123bf..ee201258aa 100644
--- a/c/src/ada-tests/tmtests/tm10/config.h
+++ b/c/src/ada-tests/tmtests/tm10/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm11/config.h b/c/src/ada-tests/tmtests/tm11/config.h
index 43726419af..a5064b6e92 100644
--- a/c/src/ada-tests/tmtests/tm11/config.h
+++ b/c/src/ada-tests/tmtests/tm11/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm12/config.h b/c/src/ada-tests/tmtests/tm12/config.h
index 43726419af..a5064b6e92 100644
--- a/c/src/ada-tests/tmtests/tm12/config.h
+++ b/c/src/ada-tests/tmtests/tm12/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm13/config.h b/c/src/ada-tests/tmtests/tm13/config.h
index 43726419af..a5064b6e92 100644
--- a/c/src/ada-tests/tmtests/tm13/config.h
+++ b/c/src/ada-tests/tmtests/tm13/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm14/config.h b/c/src/ada-tests/tmtests/tm14/config.h
index 43726419af..a5064b6e92 100644
--- a/c/src/ada-tests/tmtests/tm14/config.h
+++ b/c/src/ada-tests/tmtests/tm14/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm15/config.h b/c/src/ada-tests/tmtests/tm15/config.h
index 43726419af..a5064b6e92 100644
--- a/c/src/ada-tests/tmtests/tm15/config.h
+++ b/c/src/ada-tests/tmtests/tm15/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm16/config.h b/c/src/ada-tests/tmtests/tm16/config.h
index 43726419af..a5064b6e92 100644
--- a/c/src/ada-tests/tmtests/tm16/config.h
+++ b/c/src/ada-tests/tmtests/tm16/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm17/config.h b/c/src/ada-tests/tmtests/tm17/config.h
index 43726419af..a5064b6e92 100644
--- a/c/src/ada-tests/tmtests/tm17/config.h
+++ b/c/src/ada-tests/tmtests/tm17/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm18/config.h b/c/src/ada-tests/tmtests/tm18/config.h
index 43726419af..a5064b6e92 100644
--- a/c/src/ada-tests/tmtests/tm18/config.h
+++ b/c/src/ada-tests/tmtests/tm18/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm19/config.h b/c/src/ada-tests/tmtests/tm19/config.h
index 43726419af..a5064b6e92 100644
--- a/c/src/ada-tests/tmtests/tm19/config.h
+++ b/c/src/ada-tests/tmtests/tm19/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm20/config.h b/c/src/ada-tests/tmtests/tm20/config.h
index c2ea25d0f8..30b26944d9 100644
--- a/c/src/ada-tests/tmtests/tm20/config.h
+++ b/c/src/ada-tests/tmtests/tm20/config.h
@@ -27,7 +27,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm21/config.h b/c/src/ada-tests/tmtests/tm21/config.h
index b397ebc521..d4b8bc5054 100644
--- a/c/src/ada-tests/tmtests/tm21/config.h
+++ b/c/src/ada-tests/tmtests/tm21/config.h
@@ -32,7 +32,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm22/config.h b/c/src/ada-tests/tmtests/tm22/config.h
index 7e2efe1743..c1585c7ef4 100644
--- a/c/src/ada-tests/tmtests/tm22/config.h
+++ b/c/src/ada-tests/tmtests/tm22/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm23/config.h b/c/src/ada-tests/tmtests/tm23/config.h
index da5214bb1c..15e3e1ccf6 100644
--- a/c/src/ada-tests/tmtests/tm23/config.h
+++ b/c/src/ada-tests/tmtests/tm23/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm24/config.h b/c/src/ada-tests/tmtests/tm24/config.h
index 13e936bb03..85640d92a9 100644
--- a/c/src/ada-tests/tmtests/tm24/config.h
+++ b/c/src/ada-tests/tmtests/tm24/config.h
@@ -25,7 +25,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm25/config.h b/c/src/ada-tests/tmtests/tm25/config.h
index d861fe9621..700438ceae 100644
--- a/c/src/ada-tests/tmtests/tm25/config.h
+++ b/c/src/ada-tests/tmtests/tm25/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm28/config.h b/c/src/ada-tests/tmtests/tm28/config.h
index bf2a951908..2f73cd5acb 100644
--- a/c/src/ada-tests/tmtests/tm28/config.h
+++ b/c/src/ada-tests/tmtests/tm28/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tm29/config.h b/c/src/ada-tests/tmtests/tm29/config.h
index b81f5d11ca..e9165e59c8 100644
--- a/c/src/ada-tests/tmtests/tm29/config.h
+++ b/c/src/ada-tests/tmtests/tm29/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tmck/config.h b/c/src/ada-tests/tmtests/tmck/config.h
index 2a720540a9..7730385b3c 100644
--- a/c/src/ada-tests/tmtests/tmck/config.h
+++ b/c/src/ada-tests/tmtests/tmck/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/c/src/ada-tests/tmtests/tmoverhd/config.h b/c/src/ada-tests/tmtests/tmoverhd/config.h
index 2a720540a9..7730385b3c 100644
--- a/c/src/ada-tests/tmtests/tmoverhd/config.h
+++ b/c/src/ada-tests/tmtests/tmoverhd/config.h
@@ -26,7 +26,6 @@
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
#include <rtems/confdefs.h>
diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c
index 76f238df1c..6cdf079181 100644
--- a/cpukit/libblock/src/bdbuf.c
+++ b/cpukit/libblock/src/bdbuf.c
@@ -1514,6 +1514,7 @@ rtems_bdbuf_do_init (void)
uint8_t* buffer;
size_t b;
rtems_status_code sc;
+ bool locked;
if (rtems_bdbuf_tracer)
printf ("bdbuf:init\n");
@@ -1546,7 +1547,8 @@ rtems_bdbuf_do_init (void)
sc = rtems_bdbuf_lock_create (rtems_build_name ('B', 'D', 'C', 'l'),
&bdbuf_cache.lock);
- if (sc != RTEMS_SUCCESSFUL)
+ locked = (sc == RTEMS_SUCCESSFUL);
+ if (!locked)
goto error;
rtems_bdbuf_lock_cache ();
@@ -1729,7 +1731,7 @@ error:
rtems_bdbuf_waiter_delete (&bdbuf_cache.transfer_waiters);
rtems_bdbuf_lock_delete (&bdbuf_cache.sync_lock);
- if (bdbuf_cache.lock != 0)
+ if (locked)
{
rtems_bdbuf_unlock_cache ();
rtems_bdbuf_lock_delete (&bdbuf_cache.lock);
diff --git a/cpukit/libcsupport/include/rtems/libcsupport.h b/cpukit/libcsupport/include/rtems/libcsupport.h
index 080fee471d..51607f9ea1 100644
--- a/cpukit/libcsupport/include/rtems/libcsupport.h
+++ b/cpukit/libcsupport/include/rtems/libcsupport.h
@@ -112,7 +112,6 @@ typedef struct {
typedef struct {
uint32_t active_message_queues;
- uint32_t active_mutexes;
uint32_t active_semaphores;
uint32_t active_threads;
uint32_t active_timers;
diff --git a/cpukit/libcsupport/src/resource_snapshot.c b/cpukit/libcsupport/src/resource_snapshot.c
index 695c94867e..caa3d3ebb3 100644
--- a/cpukit/libcsupport/src/resource_snapshot.c
+++ b/cpukit/libcsupport/src/resource_snapshot.c
@@ -68,7 +68,6 @@ static const struct {
#ifdef RTEMS_POSIX_API
,
{ OBJECTS_POSIX_API, OBJECTS_POSIX_MESSAGE_QUEUES },
- { OBJECTS_POSIX_API, OBJECTS_POSIX_MUTEXES },
{ OBJECTS_POSIX_API, OBJECTS_POSIX_SEMAPHORES },
{ OBJECTS_POSIX_API, OBJECTS_POSIX_THREADS },
{ OBJECTS_POSIX_API, OBJECTS_POSIX_TIMERS }
diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am
index 3498961007..25a3b5451f 100644
--- a/cpukit/posix/Makefile.am
+++ b/cpukit/posix/Makefile.am
@@ -21,6 +21,7 @@ include_rtems_posix_HEADERS += include/rtems/posix/condimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/key.h
include_rtems_posix_HEADERS += include/rtems/posix/keyimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/config.h
+include_rtems_posix_HEADERS += include/rtems/posix/muteximpl.h
include_rtems_posix_HEADERS += include/rtems/posix/posixapi.h
include_rtems_posix_HEADERS += include/rtems/posix/priorityimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/rwlockimpl.h
@@ -38,8 +39,6 @@ include_rtems_posix_HEADERS += include/rtems/posix/aio_misc.h
include_rtems_posix_HEADERS += include/rtems/posix/mmanimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/mqueue.h
include_rtems_posix_HEADERS += include/rtems/posix/mqueueimpl.h
-include_rtems_posix_HEADERS += include/rtems/posix/mutex.h
-include_rtems_posix_HEADERS += include/rtems/posix/muteximpl.h
include_rtems_posix_HEADERS += include/rtems/posix/psignal.h
include_rtems_posix_HEADERS += include/rtems/posix/psignalimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/pthread.h
@@ -80,6 +79,16 @@ libposix_a_SOURCES += src/condattrdestroy.c \
src/condinit.c src/condsignal.c src/condsignalsupp.c \
src/condtimedwait.c src/condwait.c src/condwaitsupp.c
+## MUTEX_C_FILES
+libposix_a_SOURCES += src/mutexattrdestroy.c src/mutexattrgetprioceiling.c \
+ src/mutexattrgetprotocol.c src/mutexattrgetpshared.c \
+ src/mutexattrgettype.c src/mutexattrinit.c src/mutexattrsetprioceiling.c \
+ src/mutexattrsetprotocol.c src/mutexattrsetpshared.c \
+ src/mutexattrsettype.c src/mutexdestroy.c \
+ src/mutexgetprioceiling.c src/mutexinit.c src/mutexlock.c \
+ src/mutexlocksupp.c src/mutexsetprioceiling.c src/mutextimedlock.c \
+ src/mutextrylock.c src/mutexunlock.c
+
if HAS_PTHREADS
libposix_a_SOURCES += src/pthreadatfork.c
@@ -113,16 +122,6 @@ libposix_a_SOURCES += src/mqueue.c src/mqueueclose.c \
src/mqueuetimedsend.c \
src/mqueueunlink.c
-## MUTEX_C_FILES
-libposix_a_SOURCES += src/mutexattrdestroy.c src/mutexattrgetprioceiling.c \
- src/mutexattrgetprotocol.c src/mutexattrgetpshared.c \
- src/mutexattrgettype.c src/mutexattrinit.c src/mutexattrsetprioceiling.c \
- src/mutexattrsetprotocol.c src/mutexattrsetpshared.c \
- src/mutexattrsettype.c src/mutex.c src/mutexdestroy.c src/mutexget.c \
- src/mutexgetprioceiling.c src/mutexinit.c src/mutexlock.c \
- src/mutexlocksupp.c src/mutexsetprioceiling.c src/mutextimedlock.c \
- src/mutextrylock.c src/mutexunlock.c
-
## PTHREAD_C_FILES
libposix_a_SOURCES += src/pthreadatfork.c src/pthreadattrdestroy.c \
src/pthreadattrgetdetachstate.c src/pthreadattrgetinheritsched.c \
diff --git a/cpukit/posix/include/rtems/posix/config.h b/cpukit/posix/include/rtems/posix/config.h
index 2f5a5d7600..e90dc27011 100644
--- a/cpukit/posix/include/rtems/posix/config.h
+++ b/cpukit/posix/include/rtems/posix/config.h
@@ -64,12 +64,6 @@ typedef struct {
/**
* This field contains the maximum number of POSIX API
- * mutexes which are configured for this application.
- */
- uint32_t maximum_mutexes;
-
- /**
- * This field contains the maximum number of POSIX API
* timers which are configured for this application.
*/
uint32_t maximum_timers;
diff --git a/cpukit/posix/include/rtems/posix/mutex.h b/cpukit/posix/include/rtems/posix/mutex.h
deleted file mode 100644
index 97ab138652..0000000000
--- a/cpukit/posix/include/rtems/posix/mutex.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * @file
- *
- * @brief POSIX MUTEX Support
- *
- * This include file contains all the private support information for
- * POSIX mutex's.
- */
-
-/*
- * COPYRIGHT (c) 1989-2011.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef _RTEMS_POSIX_MUTEX_H
-#define _RTEMS_POSIX_MUTEX_H
-
-#include <rtems/score/coremutex.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup POSIX_MUTEX POSIX Mutex Support
- *
- * @ingroup POSIXAPI
- *
- * @brief Private Support Information for POSIX Mutex
- *
- */
-/**@{**/
-
-/**
- * @brief The POSIX mutex control.
- */
-typedef struct {
- /**
- * @brief The object control.
- */
- Objects_Control Object;
-
- /**
- * The most general mutex variant supported by a POSIX mutex.
- *
- * The priority inheritance or no protocol variants will use only parts of
- * this structure.
- */
- CORE_ceiling_mutex_Control Mutex;
-
- /**
- * @brief The protocol variant.
- *
- * @see POSIX_Mutex_Protocol.
- */
- unsigned int protocol : 2;
-
- /**
- * @brief Indicates if this is a non-recursive or recursive mutex.
- */
- unsigned int is_recursive : 1;
-} POSIX_Mutex_Control;
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-/* end of include file */
diff --git a/cpukit/posix/include/rtems/posix/muteximpl.h b/cpukit/posix/include/rtems/posix/muteximpl.h
index 7d19d8c40b..833938bb2d 100644
--- a/cpukit/posix/include/rtems/posix/muteximpl.h
+++ b/cpukit/posix/include/rtems/posix/muteximpl.h
@@ -18,18 +18,40 @@
#ifndef _RTEMS_POSIX_MUTEXIMPL_H
#define _RTEMS_POSIX_MUTEXIMPL_H
-#include <rtems/posix/mutex.h>
-#include <rtems/score/coremuteximpl.h>
-
#include <errno.h>
#include <pthread.h>
+#include <rtems/score/percpu.h>
+#include <rtems/score/muteximpl.h>
+#include <rtems/score/threadimpl.h>
+
#ifdef __cplusplus
extern "C" {
#endif
+typedef struct {
+ unsigned long flags;
+ Mutex_recursive_Control Recursive;
+ Priority_Node Priority_ceiling;
+ const Scheduler_Control *scheduler;
+} POSIX_Mutex_Control;
+
+#define POSIX_MUTEX_PROTOCOL_MASK 0x3UL
+
+#define POSIX_MUTEX_RECURSIVE 0x4UL
+
+#define POSIX_MUTEX_FLAGS_MASK 0x7UL
+
+#define POSIX_MUTEX_MAGIC 0x961c13b8UL
+
#define POSIX_MUTEX_NO_PROTOCOL_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
+#define POSIX_MUTEX_PRIORITY_INHERIT_TQ_OPERATIONS \
+ &_Thread_queue_Operations_priority_inherit
+
+#define POSIX_MUTEX_PRIORITY_CEILING_TQ_OPERATIONS \
+ &_Thread_queue_Operations_priority
+
/**
* @brief Supported POSIX mutex protocols.
*
@@ -42,25 +64,29 @@ typedef enum {
} POSIX_Mutex_Protocol;
/**
- * The following defines the information control block used to manage
- * this class of objects.
- */
-extern Objects_Information _POSIX_Mutex_Information;
-
-/**
* The default mutex attributes structure.
*/
extern const pthread_mutexattr_t _POSIX_Mutex_Default_attributes;
-RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Acquire_critical(
+RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Mutex_Acquire(
POSIX_Mutex_Control *the_mutex,
Thread_queue_Context *queue_context
)
{
- _CORE_mutex_Acquire_critical(
- &the_mutex->Mutex.Recursive.Mutex,
- queue_context
+ ISR_Level level;
+ Thread_Control *executing;
+
+ _Thread_queue_Context_initialize( queue_context );
+ _Thread_queue_Context_ISR_disable( queue_context, level );
+ _Thread_queue_Context_set_ISR_level( queue_context, level );
+ executing = _Thread_Executing;
+ _Thread_queue_Queue_acquire_critical(
+ &the_mutex->Recursive.Mutex.Queue.Queue,
+ &executing->Potpourri_stats,
+ &queue_context->Lock_context.Lock_context
);
+
+ return executing;
}
RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Release(
@@ -68,36 +94,359 @@ RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Release(
Thread_queue_Context *queue_context
)
{
- _CORE_mutex_Release(
- &the_mutex->Mutex.Recursive.Mutex,
+ _Thread_queue_Queue_release(
+ &the_mutex->Recursive.Mutex.Queue.Queue,
+ &queue_context->Lock_context.Lock_context
+ );
+}
+
+RTEMS_INLINE_ROUTINE POSIX_Mutex_Protocol _POSIX_Mutex_Get_protocol(
+ unsigned long flags
+)
+{
+ return flags & POSIX_MUTEX_PROTOCOL_MASK;
+}
+
+RTEMS_INLINE_ROUTINE bool _POSIX_Mutex_Is_recursive(
+ unsigned long flags
+)
+{
+ return ( flags & POSIX_MUTEX_RECURSIVE ) != 0;
+}
+
+RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Mutex_Get_owner(
+ const POSIX_Mutex_Control *the_mutex
+)
+{
+ return the_mutex->Recursive.Mutex.Queue.Queue.owner;
+}
+
+RTEMS_INLINE_ROUTINE bool _POSIX_Mutex_Is_locked(
+ const POSIX_Mutex_Control *the_mutex
+)
+{
+ return _POSIX_Mutex_Get_owner( the_mutex ) != NULL;
+}
+
+Status_Control _POSIX_Mutex_Seize_slow(
+ POSIX_Mutex_Control *the_mutex,
+ const Thread_queue_Operations *operations,
+ Thread_Control *executing,
+ bool wait,
+ Thread_queue_Context *queue_context
+);
+
+RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Set_owner(
+ POSIX_Mutex_Control *the_mutex,
+ Thread_Control *owner
+)
+{
+ the_mutex->Recursive.Mutex.Queue.Queue.owner = owner;
+}
+
+RTEMS_INLINE_ROUTINE bool _POSIX_Mutex_Is_owner(
+ const POSIX_Mutex_Control *the_mutex,
+ const Thread_Control *the_thread
+)
+{
+ return _POSIX_Mutex_Get_owner( the_mutex ) == the_thread;
+}
+
+static Status_Control _POSIX_Mutex_Lock_nested(
+ POSIX_Mutex_Control *the_mutex,
+ unsigned long flags
+)
+{
+
+ if ( _POSIX_Mutex_Is_recursive( flags ) ) {
+ ++the_mutex->Recursive.nest_level;
+ return STATUS_SUCCESSFUL;
+ } else {
+ return STATUS_NESTING_NOT_ALLOWED;
+ }
+}
+
+RTEMS_INLINE_ROUTINE Status_Control _POSIX_Mutex_Seize(
+ POSIX_Mutex_Control *the_mutex,
+ unsigned long flags,
+ const Thread_queue_Operations *operations,
+ Thread_Control *executing,
+ bool wait,
+ Thread_queue_Context *queue_context
+)
+{
+ Thread_Control *owner;
+
+ owner = _POSIX_Mutex_Get_owner( the_mutex );
+
+ if ( owner == NULL ) {
+ _POSIX_Mutex_Set_owner( the_mutex, executing );
+ _Thread_Resource_count_increment( executing );
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ return STATUS_SUCCESSFUL;
+ }
+
+ if ( owner == executing ) {
+ Status_Control status;
+
+ status = _POSIX_Mutex_Lock_nested( the_mutex, flags );
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ return status;
+ }
+
+ return _POSIX_Mutex_Seize_slow(
+ the_mutex,
+ operations,
+ executing,
+ wait,
queue_context
);
}
-/**
- * @brief POSIX Mutex Allocate
- *
- * This function allocates a mutexes control block from
- * the inactive chain of free mutexes control blocks.
- */
-RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void )
+RTEMS_INLINE_ROUTINE Status_Control _POSIX_Mutex_Surrender(
+ POSIX_Mutex_Control *the_mutex,
+ const Thread_queue_Operations *operations,
+ Thread_Control *executing,
+ Thread_queue_Context *queue_context
+)
{
- return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information );
+ unsigned int nest_level;
+ Thread_queue_Heads *heads;
+
+ if ( !_POSIX_Mutex_Is_owner( the_mutex, executing ) ) {
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ return STATUS_NOT_OWNER;
+ }
+
+ nest_level = the_mutex->Recursive.nest_level;
+
+ if ( nest_level > 0 ) {
+ the_mutex->Recursive.nest_level = nest_level - 1;
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ return STATUS_SUCCESSFUL;
+ }
+
+ _Thread_Resource_count_decrement( executing );
+ _POSIX_Mutex_Set_owner( the_mutex, NULL );
+
+ heads = the_mutex->Recursive.Mutex.Queue.Queue.heads;
+
+ if ( heads == NULL ) {
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ return STATUS_SUCCESSFUL;
+ }
+
+ _Thread_queue_Surrender(
+ &the_mutex->Recursive.Mutex.Queue.Queue,
+ heads,
+ executing,
+ queue_context,
+ operations
+ );
+ return STATUS_SUCCESSFUL;
}
-/**
- * @brief POSIX Mutex Free
- *
- * This routine frees a mutexes control block to the
- * inactive chain of free mutexes control blocks.
- */
-RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free(
- POSIX_Mutex_Control *the_mutex
+RTEMS_INLINE_ROUTINE const Scheduler_Control *_POSIX_Mutex_Get_scheduler(
+ const POSIX_Mutex_Control *the_mutex
)
{
- _Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object );
+#if defined(RTEMS_SMP)
+ return the_mutex->scheduler;
+#else
+ return &_Scheduler_Table[ 0 ];
+#endif
+}
+
+RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Set_priority(
+ POSIX_Mutex_Control *the_mutex,
+ Priority_Control priority_ceiling,
+ Thread_queue_Context *queue_context
+)
+{
+ Thread_Control *owner;
+
+ owner = _POSIX_Mutex_Get_owner( the_mutex );
+
+ if ( owner != NULL ) {
+ _Thread_Wait_acquire( owner, queue_context );
+ _Thread_Priority_change(
+ owner,
+ &the_mutex->Priority_ceiling,
+ priority_ceiling,
+ false,
+ queue_context
+ );
+ _Thread_Wait_release( owner, queue_context );
+ } else {
+ the_mutex->Priority_ceiling.priority = priority_ceiling;
+ }
+}
+
+RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Mutex_Get_priority(
+ const POSIX_Mutex_Control *the_mutex
+)
+{
+ return the_mutex->Priority_ceiling.priority;
+}
+
+RTEMS_INLINE_ROUTINE Status_Control _POSIX_Mutex_Ceiling_set_owner(
+ POSIX_Mutex_Control *the_mutex,
+ Thread_Control *owner,
+ Thread_queue_Context *queue_context
+)
+{
+ ISR_lock_Context lock_context;
+ Scheduler_Node *scheduler_node;
+ Per_CPU_Control *cpu_self;
+
+ _Thread_Wait_acquire_default_critical( owner, &lock_context );
+
+ scheduler_node = _Thread_Scheduler_get_home_node( owner );
+
+ if (
+ _Priority_Get_priority( &scheduler_node->Wait.Priority )
+ < the_mutex->Priority_ceiling.priority
+ ) {
+ _Thread_Wait_release_default_critical( owner, &lock_context );
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ return STATUS_MUTEX_CEILING_VIOLATED;
+ }
+
+ _POSIX_Mutex_Set_owner( the_mutex, owner );
+ _Thread_Resource_count_increment( owner );
+ _Thread_Priority_add(
+ owner,
+ &the_mutex->Priority_ceiling,
+ queue_context
+ );
+ _Thread_Wait_release_default_critical( owner, &lock_context );
+
+ cpu_self = _Thread_Dispatch_disable_critical(
+ &queue_context->Lock_context.Lock_context
+ );
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ _Thread_Priority_update( queue_context );
+ _Thread_Dispatch_enable( cpu_self );
+ return STATUS_SUCCESSFUL;
+}
+
+RTEMS_INLINE_ROUTINE Status_Control _POSIX_Mutex_Ceiling_seize(
+ POSIX_Mutex_Control *the_mutex,
+ unsigned long flags,
+ Thread_Control *executing,
+ bool wait,
+ Thread_queue_Context *queue_context
+)
+{
+ Thread_Control *owner;
+
+ owner = _POSIX_Mutex_Get_owner( the_mutex );
+
+ if ( owner == NULL ) {
+#if defined(RTEMS_SMP)
+ if (
+ _Thread_Scheduler_get_home( executing )
+ != _POSIX_Mutex_Get_scheduler( the_mutex )
+ ) {
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ return STATUS_NOT_DEFINED;
+ }
+#endif
+
+ _Thread_queue_Context_clear_priority_updates( queue_context );
+ return _POSIX_Mutex_Ceiling_set_owner(
+ the_mutex,
+ executing,
+ queue_context
+ );
+ }
+
+ if ( owner == executing ) {
+ Status_Control status;
+
+ status = _POSIX_Mutex_Lock_nested( the_mutex, flags );
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ return status;
+ }
+
+ return _POSIX_Mutex_Seize_slow(
+ the_mutex,
+ POSIX_MUTEX_PRIORITY_CEILING_TQ_OPERATIONS,
+ executing,
+ wait,
+ queue_context
+ );
}
+RTEMS_INLINE_ROUTINE Status_Control _POSIX_Mutex_Ceiling_surrender(
+ POSIX_Mutex_Control *the_mutex,
+ Thread_Control *executing,
+ Thread_queue_Context *queue_context
+)
+{
+ unsigned int nest_level;
+ ISR_lock_Context lock_context;
+ Per_CPU_Control *cpu_self;
+ Thread_queue_Heads *heads;
+
+ if ( !_POSIX_Mutex_Is_owner( the_mutex, executing ) ) {
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ return STATUS_NOT_OWNER;
+ }
+
+ nest_level = the_mutex->Recursive.nest_level;
+
+ if ( nest_level > 0 ) {
+ the_mutex->Recursive.nest_level = nest_level - 1;
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ return STATUS_SUCCESSFUL;
+ }
+
+ _Thread_Resource_count_decrement( executing );
+
+ _Thread_queue_Context_clear_priority_updates( queue_context );
+ _Thread_Wait_acquire_default_critical( executing, &lock_context );
+ _Thread_Priority_remove(
+ executing,
+ &the_mutex->Priority_ceiling,
+ queue_context
+ );
+ _Thread_Wait_release_default_critical( executing, &lock_context );
+
+ cpu_self = _Thread_Dispatch_disable_critical(
+ &queue_context->Lock_context.Lock_context
+ );
+
+ heads = the_mutex->Recursive.Mutex.Queue.Queue.heads;
+
+ if ( heads != NULL ) {
+ const Thread_queue_Operations *operations;
+ Thread_Control *new_owner;
+
+ operations = POSIX_MUTEX_PRIORITY_CEILING_TQ_OPERATIONS;
+ new_owner = ( *operations->first )( heads );
+ _POSIX_Mutex_Set_owner( the_mutex, new_owner );
+ _Thread_Resource_count_increment( new_owner );
+ _Thread_Priority_add(
+ new_owner,
+ &the_mutex->Priority_ceiling,
+ queue_context
+ );
+ _Thread_queue_Extract_critical(
+ &the_mutex->Recursive.Mutex.Queue.Queue,
+ operations,
+ new_owner,
+ queue_context
+ );
+ } else {
+ _POSIX_Mutex_Set_owner( the_mutex, NULL );
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ }
+
+ _Thread_Priority_update( queue_context );
+ _Thread_Dispatch_enable( cpu_self );
+ return STATUS_SUCCESSFUL;
+}
/**
* @brief POSIX Mutex Lock Support Method
@@ -111,29 +460,32 @@ int _POSIX_Mutex_Lock_support(
Watchdog_Interval timeout
);
-/**
- * @brief POSIX Mutex Get (Interrupt Disable)
- *
- * A support routine which translates the mutex id into a local pointer.
- * As a side-effect, it may create the mutex.
- *
- * @note: This version of the method uses an interrupt critical section.
- */
-POSIX_Mutex_Control *_POSIX_Mutex_Get(
- pthread_mutex_t *mutex,
- Thread_queue_Context *queue_context
-);
-
-RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Get_no_protection(
- const pthread_mutex_t *mutex
+static inline POSIX_Mutex_Control *_POSIX_Mutex_Get(
+ pthread_mutex_t *mutex
)
{
- return (POSIX_Mutex_Control *) _Objects_Get_no_protection(
- (Objects_Id) *mutex,
- &_POSIX_Mutex_Information
- );
+ return (POSIX_Mutex_Control *) mutex;
}
+bool _POSIX_Mutex_Auto_initialization( POSIX_Mutex_Control *the_mutex );
+
+#define POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags ) \
+ do { \
+ if ( ( the_mutex ) == NULL ) { \
+ return EINVAL; \
+ } \
+ flags = ( the_mutex )->flags; \
+ if ( \
+ ( ( (uintptr_t) ( the_mutex ) ^ POSIX_MUTEX_MAGIC ) \
+ & ~POSIX_MUTEX_FLAGS_MASK ) \
+ != ( flags & ~POSIX_MUTEX_FLAGS_MASK ) \
+ ) { \
+ if ( !_POSIX_Mutex_Auto_initialization( the_mutex ) ) { \
+ return EINVAL; \
+ } \
+ } \
+ } while ( 0 )
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/posix/preinstall.am b/cpukit/posix/preinstall.am
index 285999360f..c3ce5e5aa9 100644
--- a/cpukit/posix/preinstall.am
+++ b/cpukit/posix/preinstall.am
@@ -47,6 +47,10 @@ $(PROJECT_INCLUDE)/rtems/posix/config.h: include/rtems/posix/config.h $(PROJECT_
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/config.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/config.h
+$(PROJECT_INCLUDE)/rtems/posix/muteximpl.h: include/rtems/posix/muteximpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/muteximpl.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/muteximpl.h
+
$(PROJECT_INCLUDE)/rtems/posix/posixapi.h: include/rtems/posix/posixapi.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/posixapi.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/posixapi.h
@@ -96,14 +100,6 @@ $(PROJECT_INCLUDE)/rtems/posix/mqueueimpl.h: include/rtems/posix/mqueueimpl.h $(
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/mqueueimpl.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/mqueueimpl.h
-$(PROJECT_INCLUDE)/rtems/posix/mutex.h: include/rtems/posix/mutex.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/mutex.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/mutex.h
-
-$(PROJECT_INCLUDE)/rtems/posix/muteximpl.h: include/rtems/posix/muteximpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/muteximpl.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/muteximpl.h
-
$(PROJECT_INCLUDE)/rtems/posix/psignal.h: include/rtems/posix/psignal.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/psignal.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/psignal.h
diff --git a/cpukit/posix/src/mutex.c b/cpukit/posix/src/mutex.c
deleted file mode 100644
index 3e34dffb3d..0000000000
--- a/cpukit/posix/src/mutex.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * @file
- *
- * @brief POSIX Mutex Manager Initialization
- * @ingroup POSIX_MUTEX POSIX Mutex Support
- */
-
-/*
- * COPYRIGHT (c) 1989-2008.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <limits.h>
-
-#include <rtems/config.h>
-#include <rtems/sysinit.h>
-#include <rtems/posix/muteximpl.h>
-#include <rtems/score/objectimpl.h>
-
-Objects_Information _POSIX_Mutex_Information;
-
-const pthread_mutexattr_t _POSIX_Mutex_Default_attributes = {
-#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
- .type = PTHREAD_MUTEX_DEFAULT,
-#endif
- .is_initialized = true,
- .process_shared = PTHREAD_PROCESS_PRIVATE,
- .prio_ceiling = INT_MAX,
- .protocol = PTHREAD_PRIO_NONE,
- .recursive = false
-};
-
-/*
- * _POSIX_Mutex_Manager_initialization
- *
- * This routine initializes all mutex manager related data structures.
- *
- * Input parameters:
- * maximum_mutexes - maximum configured mutexes
- *
- * Output parameters: NONE
- */
-
-static void _POSIX_Mutex_Manager_initialization(void)
-{
- /*
- * Initialize the POSIX mutex object class information structure.
- */
- _Objects_Initialize_information(
- &_POSIX_Mutex_Information, /* object information table */
- OBJECTS_POSIX_API, /* object API */
- OBJECTS_POSIX_MUTEXES, /* object class */
- Configuration_POSIX_API.maximum_mutexes,
- /* maximum objects of this class */
- sizeof( POSIX_Mutex_Control ),
- /* size of this object's control block */
- true, /* true if names for this object are strings */
- _POSIX_PATH_MAX, /* maximum length of each object's name */
- NULL /* Proxy extraction support callout */
- );
-}
-
-RTEMS_SYSINIT_ITEM(
- _POSIX_Mutex_Manager_initialization,
- RTEMS_SYSINIT_POSIX_MUTEX,
- RTEMS_SYSINIT_ORDER_MIDDLE
-);
diff --git a/cpukit/posix/src/mutexdestroy.c b/cpukit/posix/src/mutexdestroy.c
index 57e63937a9..193f3391bc 100644
--- a/cpukit/posix/src/mutexdestroy.c
+++ b/cpukit/posix/src/mutexdestroy.c
@@ -29,37 +29,22 @@ int pthread_mutex_destroy(
)
{
POSIX_Mutex_Control *the_mutex;
+ unsigned long flags;
Thread_queue_Context queue_context;
int eno;
- _Objects_Allocator_lock();
+ the_mutex = _POSIX_Mutex_Get( mutex );
+ POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags );
- the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
+ _POSIX_Mutex_Acquire( the_mutex, &queue_context );
- if ( the_mutex != NULL ) {
- _POSIX_Mutex_Acquire_critical( the_mutex, &queue_context );
-
- /*
- * XXX: There is an error for the mutex being locked
- * or being in use by a condition variable.
- */
-
- if (
- !_CORE_mutex_Is_locked( &the_mutex->Mutex.Recursive.Mutex )
- ) {
- _Objects_Close( &_POSIX_Mutex_Information, &the_mutex->Object );
- _POSIX_Mutex_Release( the_mutex, &queue_context );
- _CORE_mutex_Destroy( &the_mutex->Mutex.Recursive.Mutex );
- _POSIX_Mutex_Free( the_mutex );
- eno = 0;
- } else {
- _POSIX_Mutex_Release( the_mutex, &queue_context );
- eno = EBUSY;
- }
+ if ( _POSIX_Mutex_Get_owner( the_mutex ) == NULL ) {
+ the_mutex->flags = ~the_mutex->flags;
+ eno = 0;
} else {
- eno = EINVAL;
+ eno = EBUSY;
}
- _Objects_Allocator_unlock();
+ _POSIX_Mutex_Release( the_mutex, &queue_context );
return eno;
}
diff --git a/cpukit/posix/src/mutexget.c b/cpukit/posix/src/mutexget.c
deleted file mode 100644
index e90c41c3a2..0000000000
--- a/cpukit/posix/src/mutexget.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @file
- *
- * @brief Convert POSIX Mutex ID to local object pointer
- * @ingroup POSIXAPI
- */
-
-/*
- * COPYRIGHT (c) 1989-2007.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/posix/muteximpl.h>
-#include <rtems/posix/posixapi.h>
-
-POSIX_Mutex_Control *_POSIX_Mutex_Get(
- pthread_mutex_t *mutex,
- Thread_queue_Context *queue_context
-)
-{
- _POSIX_Get_object_body(
- POSIX_Mutex_Control,
- mutex,
- queue_context,
- &_POSIX_Mutex_Information,
- PTHREAD_MUTEX_INITIALIZER,
- pthread_mutex_init
- );
-}
diff --git a/cpukit/posix/src/mutexgetprioceiling.c b/cpukit/posix/src/mutexgetprioceiling.c
index dfff98f9b7..544c8fbf33 100644
--- a/cpukit/posix/src/mutexgetprioceiling.c
+++ b/cpukit/posix/src/mutexgetprioceiling.c
@@ -31,30 +31,27 @@ int pthread_mutex_getprioceiling(
)
{
POSIX_Mutex_Control *the_mutex;
+ unsigned long flags;
Thread_queue_Context queue_context;
if ( prioceiling == NULL ) {
return EINVAL;
}
- the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
+ the_mutex = _POSIX_Mutex_Get( mutex );
+ POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags );
- if ( the_mutex == NULL ) {
- return EINVAL;
- }
+ _POSIX_Mutex_Acquire( the_mutex, &queue_context );
- _POSIX_Mutex_Acquire_critical( the_mutex, &queue_context );
-
- if ( the_mutex->protocol == POSIX_MUTEX_PRIORITY_CEILING ) {
+ if ( _POSIX_Mutex_Get_protocol( flags ) == POSIX_MUTEX_PRIORITY_CEILING ) {
*prioceiling = _POSIX_Priority_From_core(
- _CORE_ceiling_mutex_Get_scheduler( &the_mutex->Mutex ),
- _CORE_ceiling_mutex_Get_priority( &the_mutex->Mutex )
+ _POSIX_Mutex_Get_scheduler( the_mutex ),
+ _POSIX_Mutex_Get_priority( the_mutex )
);
} else {
*prioceiling = 0;
}
_POSIX_Mutex_Release( the_mutex, &queue_context );
-
return 0;
}
diff --git a/cpukit/posix/src/mutexinit.c b/cpukit/posix/src/mutexinit.c
index c7161b0daf..86b3bd0e96 100644
--- a/cpukit/posix/src/mutexinit.c
+++ b/cpukit/posix/src/mutexinit.c
@@ -23,6 +23,46 @@
#include <rtems/posix/priorityimpl.h>
#include <rtems/score/schedulerimpl.h>
+RTEMS_STATIC_ASSERT(
+ offsetof( POSIX_Mutex_Control, flags )
+ == offsetof( pthread_mutex_t, _flags ),
+ POSIX_MUTEX_CONTROL_FLAGS
+);
+
+RTEMS_STATIC_ASSERT(
+ offsetof( POSIX_Mutex_Control, Recursive )
+ == offsetof( pthread_mutex_t, _Recursive ),
+ POSIX_MUTEX_CONTROL_RECURSIVE
+);
+
+RTEMS_STATIC_ASSERT(
+ offsetof( POSIX_Mutex_Control, Priority_ceiling )
+ == offsetof( pthread_mutex_t, _Priority_ceiling ),
+ POSIX_MUTEX_CONTROL_SCHEDULER
+);
+
+RTEMS_STATIC_ASSERT(
+ offsetof( POSIX_Mutex_Control, scheduler )
+ == offsetof( pthread_mutex_t, _scheduler ),
+ POSIX_MUTEX_CONTROL_SCHEDULER
+);
+
+RTEMS_STATIC_ASSERT(
+ sizeof( POSIX_Mutex_Control ) == sizeof( pthread_mutex_t ),
+ POSIX_MUTEX_CONTROL_SIZE
+);
+
+const pthread_mutexattr_t _POSIX_Mutex_Default_attributes = {
+#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
+ .type = PTHREAD_MUTEX_DEFAULT,
+#endif
+ .is_initialized = true,
+ .process_shared = PTHREAD_PROCESS_PRIVATE,
+ .prio_ceiling = INT_MAX,
+ .protocol = PTHREAD_PRIO_NONE,
+ .recursive = false
+};
+
/**
* 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
*
@@ -38,6 +78,8 @@ int pthread_mutex_init(
POSIX_Mutex_Control *the_mutex;
const pthread_mutexattr_t *the_attr;
POSIX_Mutex_Protocol protocol;
+ unsigned long flags;
+ Priority_Control priority;
const Scheduler_Control *scheduler;
if ( attr ) the_attr = attr;
@@ -101,20 +143,21 @@ int pthread_mutex_init(
}
#endif
- the_mutex = _POSIX_Mutex_Allocate();
+ the_mutex = _POSIX_Mutex_Get( mutex );
- if ( !the_mutex ) {
- _Objects_Allocator_unlock();
- return EAGAIN;
+ flags = (uintptr_t) the_mutex ^ POSIX_MUTEX_MAGIC;
+ flags &= ~POSIX_MUTEX_FLAGS_MASK;
+ flags |= protocol;
+
+ if ( the_attr->type == PTHREAD_MUTEX_RECURSIVE ) {
+ flags |= POSIX_MUTEX_RECURSIVE;
}
- the_mutex->protocol = protocol;
- the_mutex->is_recursive = ( the_attr->type == PTHREAD_MUTEX_RECURSIVE );
+ the_mutex->flags = flags;
if ( protocol == POSIX_MUTEX_PRIORITY_CEILING ) {
- int prio_ceiling;
- bool valid;
- Priority_Control priority;
+ int prio_ceiling;
+ bool valid;
scheduler = _Thread_Scheduler_get_home( _Thread_Get_executing() );
prio_ceiling = the_attr->prio_ceiling;
@@ -125,23 +168,19 @@ int pthread_mutex_init(
priority = _POSIX_Priority_To_core( scheduler, prio_ceiling, &valid );
if ( !valid ) {
- _POSIX_Mutex_Free(the_mutex);
- _Objects_Allocator_unlock();
return EINVAL;
}
- _CORE_ceiling_mutex_Initialize( &the_mutex->Mutex, scheduler, priority );
} else {
- _Assert(
- the_mutex->protocol == POSIX_MUTEX_NO_PROTOCOL
- || the_mutex->protocol == POSIX_MUTEX_PRIORITY_INHERIT
- );
- _CORE_recursive_mutex_Initialize( &the_mutex->Mutex.Recursive );
+ priority = 0;
+ scheduler = NULL;
}
- _Objects_Open_u32( &_POSIX_Mutex_Information, &the_mutex->Object, 0 );
-
- *mutex = the_mutex->Object.id;
-
- _Objects_Allocator_unlock();
+ _Thread_queue_Queue_initialize(
+ &the_mutex->Recursive.Mutex.Queue.Queue,
+ NULL
+ );
+ the_mutex->Recursive.nest_level = 0;
+ _Priority_Node_initialize( &the_mutex->Priority_ceiling, priority );
+ the_mutex->scheduler = scheduler;
return 0;
}
diff --git a/cpukit/posix/src/mutexlocksupp.c b/cpukit/posix/src/mutexlocksupp.c
index ea4c4e3eab..507d667164 100644
--- a/cpukit/posix/src/mutexlocksupp.c
+++ b/cpukit/posix/src/mutexlocksupp.c
@@ -21,27 +21,34 @@
#include <rtems/posix/muteximpl.h>
#include <rtems/posix/posixapi.h>
-THREAD_QUEUE_OBJECT_ASSERT(
- POSIX_Mutex_Control,
- Mutex.Recursive.Mutex.Wait_queue
-);
-
-static Status_Control _POSIX_Mutex_Lock_nested(
- CORE_recursive_mutex_Control *the_recursive_mutex
+Status_Control _POSIX_Mutex_Seize_slow(
+ POSIX_Mutex_Control *the_mutex,
+ const Thread_queue_Operations *operations,
+ Thread_Control *executing,
+ bool wait,
+ Thread_queue_Context *queue_context
)
{
- POSIX_Mutex_Control *the_mutex;
-
- the_mutex = RTEMS_CONTAINER_OF(
- the_recursive_mutex,
- POSIX_Mutex_Control,
- Mutex.Recursive
- );
-
- if ( the_mutex->is_recursive ) {
- return _CORE_recursive_mutex_Seize_nested( the_recursive_mutex );
+ if ( wait ) {
+ _Thread_queue_Context_set_thread_state(
+ queue_context,
+ STATES_WAITING_FOR_MUTEX
+ );
+ _Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
+ _Thread_queue_Context_set_deadlock_callout(
+ queue_context,
+ _Thread_queue_Deadlock_status
+ );
+ _Thread_queue_Enqueue(
+ &the_mutex->Recursive.Mutex.Queue.Queue,
+ operations,
+ executing,
+ queue_context
+ );
+ return _Thread_Wait_get_status( executing );
} else {
- return STATUS_NESTING_NOT_ALLOWED;
+ _POSIX_Mutex_Release( the_mutex, queue_context );
+ return STATUS_UNAVAILABLE;
}
}
@@ -52,47 +59,47 @@ int _POSIX_Mutex_Lock_support(
)
{
POSIX_Mutex_Control *the_mutex;
+ unsigned long flags;
Thread_queue_Context queue_context;
Thread_Control *executing;
Status_Control status;
- the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
+ the_mutex = _POSIX_Mutex_Get( mutex );
+ POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags );
- if ( the_mutex == NULL ) {
- return EINVAL;
- }
-
- executing = _Thread_Executing;
+ executing = _POSIX_Mutex_Acquire( the_mutex, &queue_context );
_Thread_queue_Context_set_relative_timeout( &queue_context, timeout );
- switch ( the_mutex->protocol ) {
+ switch ( _POSIX_Mutex_Get_protocol( flags ) ) {
case POSIX_MUTEX_PRIORITY_CEILING:
- status = _CORE_ceiling_mutex_Seize(
- &the_mutex->Mutex,
+ status = _POSIX_Mutex_Ceiling_seize(
+ the_mutex,
+ flags,
executing,
wait,
- _POSIX_Mutex_Lock_nested,
&queue_context
);
break;
case POSIX_MUTEX_NO_PROTOCOL:
- status = _CORE_recursive_mutex_Seize(
- &the_mutex->Mutex.Recursive,
+ status = _POSIX_Mutex_Seize(
+ the_mutex,
+ flags,
POSIX_MUTEX_NO_PROTOCOL_TQ_OPERATIONS,
executing,
wait,
- _POSIX_Mutex_Lock_nested,
&queue_context
);
break;
default:
- _Assert( the_mutex->protocol == POSIX_MUTEX_PRIORITY_INHERIT );
- status = _CORE_recursive_mutex_Seize(
- &the_mutex->Mutex.Recursive,
- CORE_MUTEX_TQ_PRIORITY_INHERIT_OPERATIONS,
+ _Assert(
+ _POSIX_Mutex_Get_protocol( flags ) == POSIX_MUTEX_PRIORITY_INHERIT
+ );
+ status = _POSIX_Mutex_Seize(
+ the_mutex,
+ flags,
+ POSIX_MUTEX_PRIORITY_INHERIT_TQ_OPERATIONS,
executing,
wait,
- _POSIX_Mutex_Lock_nested,
&queue_context
);
break;
diff --git a/cpukit/posix/src/mutexsetprioceiling.c b/cpukit/posix/src/mutexsetprioceiling.c
index 9288ffd828..87d9ba46f3 100644
--- a/cpukit/posix/src/mutexsetprioceiling.c
+++ b/cpukit/posix/src/mutexsetprioceiling.c
@@ -49,17 +49,19 @@ int pthread_mutex_setprioceiling(
return EINVAL;
}
- the_mutex = _POSIX_Mutex_Get_no_protection( mutex );
- _Assert( the_mutex != NULL );
+ the_mutex = _POSIX_Mutex_Get( mutex );
- if ( the_mutex->protocol == POSIX_MUTEX_PRIORITY_CEILING ) {
+ if (
+ _POSIX_Mutex_Get_protocol( the_mutex->flags )
+ == POSIX_MUTEX_PRIORITY_CEILING
+ ) {
const Scheduler_Control *scheduler;
bool valid;
Priority_Control new_priority;
Priority_Control old_priority;
- scheduler = _CORE_ceiling_mutex_Get_scheduler( &the_mutex->Mutex );
- old_priority = _CORE_ceiling_mutex_Get_priority( &the_mutex->Mutex );
+ scheduler = _POSIX_Mutex_Get_scheduler( the_mutex );
+ old_priority = _POSIX_Mutex_Get_priority( the_mutex );
*old_ceiling = _POSIX_Priority_From_core( scheduler, old_priority );
new_priority = _POSIX_Priority_To_core( scheduler, prioceiling, &valid );
@@ -69,8 +71,8 @@ int pthread_mutex_setprioceiling(
_Thread_queue_Context_initialize( &queue_context );
_Thread_queue_Context_clear_priority_updates( &queue_context );
- _CORE_ceiling_mutex_Set_priority(
- &the_mutex->Mutex,
+ _POSIX_Mutex_Set_priority(
+ the_mutex,
new_priority,
&queue_context
);
diff --git a/cpukit/posix/src/mutexunlock.c b/cpukit/posix/src/mutexunlock.c
index c15f7e6ad2..ead3109812 100644
--- a/cpukit/posix/src/mutexunlock.c
+++ b/cpukit/posix/src/mutexunlock.c
@@ -21,6 +21,51 @@
#include <rtems/posix/muteximpl.h>
#include <rtems/posix/posixapi.h>
+#include <string.h>
+
+bool _POSIX_Mutex_Auto_initialization( POSIX_Mutex_Control *the_mutex )
+{
+ unsigned long zero;
+ unsigned long flags;
+
+ /* We cannot use memset() and memcmp() due to structure internal padding */
+ zero = 0;
+ zero |= the_mutex->flags;
+#if defined(RTEMS_SMP)
+ zero |= _Atomic_Load_uint(
+ &the_mutex->Recursive.Mutex.Queue.Queue.Lock.next_ticket,
+ ATOMIC_ORDER_RELAXED
+ );
+ zero |= _Atomic_Load_uint(
+ &the_mutex->Recursive.Mutex.Queue.Queue.Lock.now_serving,
+ ATOMIC_ORDER_RELAXED
+ );
+#else
+ zero |= the_mutex->Recursive.Mutex.Queue.reserved[ 0 ];
+ zero |= the_mutex->Recursive.Mutex.Queue.reserved[ 1 ];
+#endif
+ zero |= (unsigned long) the_mutex->Recursive.Mutex.Queue.Queue.heads;
+ zero |= (unsigned long) the_mutex->Recursive.Mutex.Queue.Queue.owner;
+ zero |= (unsigned long) the_mutex->Recursive.Mutex.Queue.Queue.name;
+ zero |= the_mutex->Recursive.nest_level;
+ zero |= (unsigned long) the_mutex->Priority_ceiling.Node.RBTree.Node.rbe_left;
+ zero |= (unsigned long) the_mutex->Priority_ceiling.Node.RBTree.Node.rbe_right;
+ zero |= (unsigned long) the_mutex->Priority_ceiling.Node.RBTree.Node.rbe_parent;
+ zero |= (unsigned long) the_mutex->Priority_ceiling.Node.RBTree.Node.rbe_color;
+ zero |= (unsigned long) the_mutex->Priority_ceiling.priority;
+ zero |= (unsigned long) (the_mutex->Priority_ceiling.priority >> 32);
+ zero |= (unsigned long) the_mutex->scheduler;
+
+ if ( zero != 0 ) {
+ return false;
+ }
+
+ flags = (uintptr_t) the_mutex ^ POSIX_MUTEX_MAGIC;
+ flags &= ~POSIX_MUTEX_FLAGS_MASK;
+ the_mutex->flags = flags;
+ return true;
+}
+
/*
* 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
*
@@ -32,39 +77,39 @@ int pthread_mutex_unlock(
)
{
POSIX_Mutex_Control *the_mutex;
+ unsigned long flags;
Thread_queue_Context queue_context;
Thread_Control *executing;
Status_Control status;
- the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
+ the_mutex = _POSIX_Mutex_Get( mutex );
+ POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags );
- if ( the_mutex == NULL ) {
- return EINVAL;
- }
-
- executing = _Thread_Executing;
+ executing = _POSIX_Mutex_Acquire( the_mutex, &queue_context );
- switch ( the_mutex->protocol ) {
+ switch ( _POSIX_Mutex_Get_protocol( flags ) ) {
case POSIX_MUTEX_PRIORITY_CEILING:
- status = _CORE_ceiling_mutex_Surrender(
- &the_mutex->Mutex,
+ status = _POSIX_Mutex_Ceiling_surrender(
+ the_mutex,
executing,
&queue_context
);
break;
case POSIX_MUTEX_NO_PROTOCOL:
- status = _CORE_recursive_mutex_Surrender(
- &the_mutex->Mutex.Recursive,
+ status = _POSIX_Mutex_Surrender(
+ the_mutex,
POSIX_MUTEX_NO_PROTOCOL_TQ_OPERATIONS,
executing,
&queue_context
);
break;
default:
- _Assert( the_mutex->protocol == POSIX_MUTEX_PRIORITY_INHERIT );
- status = _CORE_recursive_mutex_Surrender(
- &the_mutex->Mutex.Recursive,
- CORE_MUTEX_TQ_PRIORITY_INHERIT_OPERATIONS,
+ _Assert(
+ _POSIX_Mutex_Get_protocol( flags ) == POSIX_MUTEX_PRIORITY_INHERIT
+ );
+ status = _POSIX_Mutex_Surrender(
+ the_mutex,
+ POSIX_MUTEX_PRIORITY_INHERIT_TQ_OPERATIONS,
executing,
&queue_context
);
diff --git a/cpukit/rtems/src/rtemsobjectgetapiclassname.c b/cpukit/rtems/src/rtemsobjectgetapiclassname.c
index 00f0de894a..73f6a3d022 100644
--- a/cpukit/rtems/src/rtemsobjectgetapiclassname.c
+++ b/cpukit/rtems/src/rtemsobjectgetapiclassname.c
@@ -49,7 +49,6 @@ static const rtems_assoc_t rtems_object_api_posix_assoc[] = {
{ "Key", OBJECTS_POSIX_KEYS, 0},
{ "Interrupt", OBJECTS_POSIX_INTERRUPTS, 0},
{ "Message Queue", OBJECTS_POSIX_MESSAGE_QUEUES, 0},
- { "Mutex", OBJECTS_POSIX_MUTEXES, 0},
{ "Semaphore", OBJECTS_POSIX_SEMAPHORES, 0},
{ "Timer", OBJECTS_POSIX_TIMERS, 0},
{ "Shared Memory", OBJECTS_POSIX_SHMS, 0},
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 402a467762..0902bd43cc 100755
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -1834,13 +1834,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
* o disk lock
*/
#define _CONFIGURE_LIBBLOCK_SEMAPHORES 1
-
- /*
- * POSIX Mutexes:
- * o bdbuf lock
- * o bdbuf sync lock
- */
- #define _CONFIGURE_LIBBLOCK_POSIX_MUTEXES 2
#else
/*
* Semaphores:
@@ -1852,8 +1845,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
* o bdbuf buffer condition
*/
#define _CONFIGURE_LIBBLOCK_SEMAPHORES 6
-
- #define _CONFIGURE_LIBBLOCK_POSIX_MUTEXES 0
#endif
#if defined(CONFIGURE_HAS_OWN_BDBUF_TABLE) || \
@@ -1869,7 +1860,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
/** This specifies the number of Classic API semaphores needed by libblock. */
#define _CONFIGURE_LIBBLOCK_SEMAPHORES 0
/** This specifies the number of POSIX Mutexes needed by libblock. */
- #define _CONFIGURE_LIBBLOCK_POSIX_MUTEXES 0
#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
/**@}*/
@@ -2041,10 +2031,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#define CONFIGURE_MAXIMUM_POSIX_THREADS \
rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
#endif
- #if !defined(CONFIGURE_MAXIMUM_POSIX_MUTEXES)
- #define CONFIGURE_MAXIMUM_POSIX_MUTEXES \
- rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
- #endif
#if !defined(CONFIGURE_MAXIMUM_POSIX_TIMERS)
#define CONFIGURE_MAXIMUM_POSIX_TIMERS \
rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
@@ -2423,7 +2409,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#include <limits.h>
#include <mqueue.h>
#include <rtems/posix/mqueue.h>
- #include <rtems/posix/mutex.h>
#include <rtems/posix/psignal.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/semaphore.h>
@@ -2450,21 +2435,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
/**
* This configuration parameter specifies the maximum number of
- * POSIX API mutexes.
- */
- #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
- #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 0
- #endif
-
- /*
- * This macro is calculated to specify the memory required for
- * POSIX API mutexes.
- */
- #define _CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) \
- _Configure_Object_RAM(_mutexes, sizeof(POSIX_Mutex_Control) )
-
- /**
- * This configuration parameter specifies the maximum number of
* POSIX API timers.
*/
#ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
@@ -2624,13 +2594,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
*/
/**@{*/
#ifdef CONFIGURE_GNAT_RTEMS
-
- /**
- * The GNAT run-time needs something less than (10) POSIX mutexes.
- * We may be able to get by with less but why bother.
- */
- #define _CONFIGURE_GNAT_MUTEXES 10
-
/**
* This is the maximum number of Ada tasks which can be concurrently
* in existence. Twenty (20) are required to run all tests in the
@@ -2646,10 +2609,8 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#ifndef CONFIGURE_MAXIMUM_FAKE_ADA_TASKS
#define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
#endif
-
#else
/** This defines he number of POSIX mutexes GNAT needs. */
- #define _CONFIGURE_GNAT_MUTEXES 0
/** This defines he number of Ada tasks needed by the application. */
#define CONFIGURE_MAXIMUM_ADA_TASKS 0
/**
@@ -2674,11 +2635,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
#endif
- #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
- #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
- #endif
-
- #define _CONFIGURE_GO_INIT_MUTEXES 77
#ifndef CONFIGURE_MAXIMUM_GOROUTINES
#define CONFIGURE_MAXIMUM_GOROUTINES 400
@@ -2689,12 +2645,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#endif
#else
- /*
- * This specifies the number of mutexes required by the Go run-time
- * for its own use.
- */
- #define _CONFIGURE_GO_INIT_MUTEXES 0
-
/** This specifies the maximum number of Go co-routines. */
#define CONFIGURE_MAXIMUM_GOROUTINES 0
@@ -2720,25 +2670,12 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
CONFIGURE_MAXIMUM_GOROUTINES)
#ifdef RTEMS_POSIX_API
- /**
- * This macro provides summation of the POSIX Mutexes.
- */
- #define _CONFIGURE_POSIX_MUTEXES \
- (CONFIGURE_MAXIMUM_POSIX_MUTEXES + \
- _CONFIGURE_LIBBLOCK_POSIX_MUTEXES + \
- _CONFIGURE_GNAT_MUTEXES + \
- CONFIGURE_MAXIMUM_ADA_TASKS + \
- CONFIGURE_MAXIMUM_FAKE_ADA_TASKS + \
- _CONFIGURE_GO_INIT_MUTEXES + \
- CONFIGURE_MAXIMUM_GO_CHANNELS)
-
/*
* This macro is calculated to specify the memory required for
* the POSIX API in its entirety.
*/
#define _CONFIGURE_MEMORY_FOR_POSIX \
- (_CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_CONFIGURE_POSIX_MUTEXES) + \
- _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
+ (_CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) + \
_CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \
@@ -3189,7 +3126,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
*/
posix_api_configuration_table Configuration_POSIX_API = {
_CONFIGURE_POSIX_THREADS,
- _CONFIGURE_POSIX_MUTEXES,
CONFIGURE_MAXIMUM_POSIX_TIMERS,
CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES,
@@ -3402,7 +3338,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#ifdef RTEMS_POSIX_API
/* POSIX API Pieces */
- uint32_t POSIX_MUTEXES;
uint32_t POSIX_TIMERS;
uint32_t POSIX_QUEUED_SIGNALS;
uint32_t POSIX_MESSAGE_QUEUES;
@@ -3451,7 +3386,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#ifdef RTEMS_POSIX_API
/* POSIX API Pieces */
- _CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( _CONFIGURE_POSIX_MUTEXES ),
_CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
_CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(
@@ -3521,7 +3455,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
*/
#if !defined(RTEMS_POSIX_API)
#if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \
- (CONFIGURE_MAXIMUM_POSIX_MUTEXES != 0) || \
(CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
(CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \
diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c
index 86fdf12a38..4d2f8f4f97 100644
--- a/cpukit/sapi/src/posixapi.c
+++ b/cpukit/sapi/src/posixapi.c
@@ -22,6 +22,7 @@
#include <rtems/posix/posixapi.h>
#include <rtems/posix/barrierimpl.h>
#include <rtems/posix/condimpl.h>
+#include <rtems/posix/muteximpl.h>
#include <rtems/posix/rwlockimpl.h>
#include <rtems/posix/semaphoreimpl.h>
#include <rtems/score/heap.h>
@@ -107,6 +108,26 @@ RTEMS_STATIC_ASSERT(
POSIX_CONDITION_VARIABLES_MAGIC != HEAP_FREE_PATTERN,
POSIX_CONDITION_VARIABLES_MAGIC_4
);
+RTEMS_STATIC_ASSERT(
+ POSIX_MUTEX_MAGIC != HEAP_BEGIN_PROTECTOR_0,
+ POSIX_MUTEX_MAGIC_0
+);
+RTEMS_STATIC_ASSERT(
+ POSIX_MUTEX_MAGIC != HEAP_BEGIN_PROTECTOR_1,
+ POSIX_MUTEX_MAGIC_1
+);
+RTEMS_STATIC_ASSERT(
+ POSIX_MUTEX_MAGIC != HEAP_END_PROTECTOR_0,
+ POSIX_MUTEX_MAGIC_2
+);
+RTEMS_STATIC_ASSERT(
+ POSIX_MUTEX_MAGIC != HEAP_END_PROTECTOR_1,
+ POSIX_MUTEX_MAGIC_3
+);
+RTEMS_STATIC_ASSERT(
+ POSIX_MUTEX_MAGIC != HEAP_FREE_PATTERN,
+ POSIX_MUTEX_MAGIC_4
+);
#endif
RTEMS_STATIC_ASSERT(
@@ -122,6 +143,10 @@ RTEMS_STATIC_ASSERT(
POSIX_SEMAPHORE_MAGIC_7
);
RTEMS_STATIC_ASSERT(
+ POSIX_SEMAPHORE_MAGIC != POSIX_MUTEX_MAGIC,
+ POSIX_SEMAPHORE_MAGIC_8
+);
+RTEMS_STATIC_ASSERT(
POSIX_BARRIER_MAGIC != POSIX_RWLOCK_MAGIC,
POSIX_BARRIER_MAGIC_5
);
@@ -130,9 +155,21 @@ RTEMS_STATIC_ASSERT(
POSIX_BARRIER_MAGIC_6
);
RTEMS_STATIC_ASSERT(
+ POSIX_BARRIER_MAGIC != POSIX_MUTEX_MAGIC,
+ POSIX_BARRIER_MAGIC_7
+);
+RTEMS_STATIC_ASSERT(
POSIX_RWLOCK_MAGIC != POSIX_CONDITION_VARIABLES_MAGIC,
POSIX_RWLOCK_MAGIC_5
);
+RTEMS_STATIC_ASSERT(
+ POSIX_RWLOCK_MAGIC != POSIX_MUTEX_MAGIC,
+ POSIX_RWLOCK_MAGIC_6
+);
+RTEMS_STATIC_ASSERT(
+ POSIX_CONDITION_VARIABLES_MAGIC != POSIX_MUTEX_MAGIC,
+ POSIX_CONDITION_VARIABLES_MAGIC_5
+);
void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno )
{
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 86af199ec3..7a200707b2 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -54,6 +54,7 @@ include_rtems_score_HEADERS += include/rtems/score/isrlock.h
include_rtems_score_HEADERS += include/rtems/score/freechain.h
include_rtems_score_HEADERS += include/rtems/score/mrsp.h
include_rtems_score_HEADERS += include/rtems/score/mrspimpl.h
+include_rtems_score_HEADERS += include/rtems/score/muteximpl.h
include_rtems_score_HEADERS += include/rtems/score/object.h
include_rtems_score_HEADERS += include/rtems/score/objectimpl.h
include_rtems_score_HEADERS += include/rtems/score/onceimpl.h
diff --git a/cpukit/score/include/rtems/score/muteximpl.h b/cpukit/score/include/rtems/score/muteximpl.h
new file mode 100644
index 0000000000..5fd4f5e8be
--- /dev/null
+++ b/cpukit/score/include/rtems/score/muteximpl.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015, 2017 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef _RTEMS_SCORE_MUTEXIMPL_H
+#define _RTEMS_SCORE_MUTEXIMPL_H
+
+#include <rtems/score/threadqimpl.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef struct {
+ Thread_queue_Syslock_queue Queue;
+} Mutex_Control;
+
+typedef struct {
+ Mutex_Control Mutex;
+ unsigned int nest_level;
+} Mutex_recursive_Control;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _RTEMS_SCORE_MUTEXIMPL_H */
diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h
index 435e82cc45..0338a481ea 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -87,7 +87,6 @@ typedef enum {
OBJECTS_POSIX_KEYS = 2,
OBJECTS_POSIX_INTERRUPTS = 3,
OBJECTS_POSIX_MESSAGE_QUEUES = 5,
- OBJECTS_POSIX_MUTEXES = 6,
OBJECTS_POSIX_SEMAPHORES = 7,
OBJECTS_POSIX_TIMERS = 9,
OBJECTS_POSIX_SHMS = 12
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index 595629fd04..7ab3d0b631 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -47,7 +47,6 @@ extern "C" {
#define RTEMS_SYSINIT_CLASSIC_BARRIER 00034a
#define RTEMS_SYSINIT_POSIX_SIGNALS 000360
#define RTEMS_SYSINIT_POSIX_THREADS 000361
-#define RTEMS_SYSINIT_POSIX_MUTEX 000363
#define RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE 000364
#define RTEMS_SYSINIT_POSIX_SEMAPHORE 000365
#define RTEMS_SYSINIT_POSIX_TIMER 000366
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index 0e05b5548e..2d7d5a2859 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -184,6 +184,10 @@ $(PROJECT_INCLUDE)/rtems/score/mrspimpl.h: include/rtems/score/mrspimpl.h $(PROJ
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/mrspimpl.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/mrspimpl.h
+$(PROJECT_INCLUDE)/rtems/score/muteximpl.h: include/rtems/score/muteximpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/muteximpl.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/muteximpl.h
+
$(PROJECT_INCLUDE)/rtems/score/object.h: include/rtems/score/object.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/object.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/object.h
diff --git a/cpukit/score/src/mutex.c b/cpukit/score/src/mutex.c
index 5916119f02..2a116c4602 100644
--- a/cpukit/score/src/mutex.c
+++ b/cpukit/score/src/mutex.c
@@ -20,16 +20,12 @@
#include <errno.h>
#include <rtems/score/assert.h>
+#include <rtems/score/muteximpl.h>
#include <rtems/score/threadimpl.h>
-#include <rtems/score/threadqimpl.h>
#include <rtems/score/todimpl.h>
#define MUTEX_TQ_OPERATIONS &_Thread_queue_Operations_priority_inherit
-typedef struct {
- Thread_queue_Syslock_queue Queue;
-} Mutex_Control;
-
RTEMS_STATIC_ASSERT(
offsetof( Mutex_Control, Queue )
== offsetof( struct _Mutex_Control, _Queue ),
@@ -41,11 +37,6 @@ RTEMS_STATIC_ASSERT(
MUTEX_CONTROL_SIZE
);
-typedef struct {
- Mutex_Control Mutex;
- unsigned int nest_level;
-} Mutex_recursive_Control;
-
RTEMS_STATIC_ASSERT(
offsetof( Mutex_recursive_Control, Mutex )
== offsetof( struct _Mutex_recursive_Control, _Mutex ),
diff --git a/testsuites/psxtests/psx05/init.c b/testsuites/psxtests/psx05/init.c
index e524d6f96f..4da2673857 100644
--- a/testsuites/psxtests/psx05/init.c
+++ b/testsuites/psxtests/psx05/init.c
@@ -239,6 +239,173 @@ static void test_errors_pthread_setschedprio( void )
rtems_test_assert( status == 0 );
}
+static void test_mutex_pshared_init(void)
+{
+ pthread_mutex_t mutex;
+ pthread_mutexattr_t attr;
+ int eno;
+
+ eno = pthread_mutexattr_init(&attr);
+ rtems_test_assert(eno == 0);
+
+ eno = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE);
+ rtems_test_assert(eno == 0);
+
+ eno = pthread_mutex_init(&mutex, &attr);
+ rtems_test_assert(eno == 0);
+
+ eno = pthread_mutex_destroy(&mutex);
+ rtems_test_assert(eno == 0);
+
+ eno = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+ rtems_test_assert(eno == 0);
+
+ eno = pthread_mutex_init(&mutex, &attr);
+ rtems_test_assert(eno == 0);
+
+ eno = pthread_mutex_destroy(&mutex);
+ rtems_test_assert(eno == 0);
+
+ attr.process_shared = -1;
+
+ eno = pthread_mutex_init(&mutex, &attr);
+ rtems_test_assert(eno == EINVAL);
+
+ eno = pthread_mutexattr_destroy(&attr);
+ rtems_test_assert(eno == 0);
+}
+
+static void test_mutex_null( void )
+{
+ struct timespec to;
+ int eno;
+
+ eno = pthread_mutex_destroy( NULL );
+ rtems_test_assert( eno == EINVAL );
+
+ eno = pthread_mutex_init( NULL, NULL );
+ rtems_test_assert( eno == EINVAL );
+
+ eno = pthread_mutex_lock( NULL );
+ rtems_test_assert( eno == EINVAL );
+
+ to.tv_sec = 1;
+ to.tv_nsec = 1;
+ eno = pthread_mutex_timedlock( NULL, &to );
+ rtems_test_assert( eno == EINVAL );
+
+ eno = pthread_mutex_trylock( NULL );
+ rtems_test_assert( eno == EINVAL );
+
+ eno = pthread_mutex_unlock( NULL );
+ rtems_test_assert( eno == EINVAL );
+}
+
+static void test_mutex_not_initialized( void )
+{
+ pthread_mutex_t mutex;
+ struct timespec to;
+ int eno;
+
+ memset( &mutex, 0xff, sizeof( mutex ) );
+
+ eno = pthread_mutex_destroy( &mutex );
+ rtems_test_assert( eno == EINVAL );
+
+ eno = pthread_mutex_lock( &mutex );
+ rtems_test_assert( eno == EINVAL );
+
+ to.tv_sec = 1;
+ to.tv_nsec = 1;
+ eno = pthread_mutex_timedlock( &mutex, &to );
+ rtems_test_assert( eno == EINVAL );
+
+ eno = pthread_mutex_trylock( &mutex );
+ rtems_test_assert( eno == EINVAL );
+
+ eno = pthread_mutex_unlock( &mutex );
+ rtems_test_assert( eno == EINVAL );
+}
+
+static void test_mutex_invalid_copy( void )
+{
+ pthread_mutex_t mutex;
+ pthread_mutex_t mutex2;
+ struct timespec to;
+ int eno;
+
+ eno = pthread_mutex_init( &mutex, NULL );
+ rtems_test_assert( eno == 0 );
+
+ memcpy( &mutex2, &mutex, sizeof( mutex2 ) );
+
+ eno = pthread_mutex_destroy( &mutex2 );
+ rtems_test_assert( eno == EINVAL );
+
+ eno = pthread_mutex_lock( &mutex2 );
+ rtems_test_assert( eno == EINVAL );
+
+ to.tv_sec = 1;
+ to.tv_nsec = 1;
+ eno = pthread_mutex_timedlock( &mutex2, &to );
+ rtems_test_assert( eno == EINVAL );
+
+ eno = pthread_mutex_trylock( &mutex2 );
+ rtems_test_assert( eno == EINVAL );
+
+ eno = pthread_mutex_unlock( &mutex2 );
+ rtems_test_assert( eno == EINVAL );
+
+ eno = pthread_mutex_destroy( &mutex );
+ rtems_test_assert( eno == 0 );
+}
+
+static void test_mutex_auto_initialization( void )
+{
+ struct timespec to;
+ int eno;
+
+ {
+ pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+ eno = pthread_mutex_destroy( &mutex );
+ rtems_test_assert( eno == 0 );
+
+ eno = pthread_mutex_destroy( &mutex );
+ rtems_test_assert( eno == EINVAL );
+ }
+
+ {
+ pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+ eno = pthread_mutex_lock( &mutex );
+ rtems_test_assert( eno == 0 );
+ }
+
+ {
+ pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+ to.tv_sec = 1;
+ to.tv_nsec = 1;
+ eno = pthread_mutex_timedlock( &mutex, &to );
+ rtems_test_assert( eno == 0 );
+ }
+
+ {
+ pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+ eno = pthread_mutex_trylock( &mutex );
+ rtems_test_assert( eno == 0 );
+ }
+
+ {
+ pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+ eno = pthread_mutex_unlock( &mutex );
+ rtems_test_assert( eno == EPERM );
+ }
+}
+
void *POSIX_Init(
void *argument
)
@@ -255,11 +422,15 @@ void *POSIX_Init(
int old_ceiling;
int priority;
- rtems_test_assert( MUTEX_BAD_ID != PTHREAD_MUTEX_INITIALIZER );
- Mutex_bad_id = MUTEX_BAD_ID;
+ Mutex_bad_id = NULL;
TEST_BEGIN();
+ test_mutex_pshared_init();
+ test_mutex_null();
+ test_mutex_not_initialized();
+ test_mutex_invalid_copy();
+ test_mutex_auto_initialization();
test_get_priority();
test_set_priority();
test_errors_pthread_setschedprio();
@@ -504,7 +675,7 @@ void *POSIX_Init(
#endif
puts( "Init: pthread_mutex_trylock - EINVAL (illegal ID)" );
- status = pthread_mutex_trylock( &Mutex_bad_id );
+ status = pthread_mutex_trylock( Mutex_bad_id );
if ( status != EINVAL )
printf( "status = %d\n", status );
rtems_test_assert( status == EINVAL );
@@ -546,7 +717,7 @@ void *POSIX_Init(
/* switch to task 1 */
puts( "Init: pthread_mutex_unlock - EINVAL (invalid id)" );
- status = pthread_mutex_unlock( &Mutex_bad_id );
+ status = pthread_mutex_unlock( Mutex_bad_id );
if ( status != EINVAL )
printf( "status = %d\n", status );
rtems_test_assert( status == EINVAL );
@@ -593,20 +764,24 @@ void *POSIX_Init(
printf( "status = %d\n", status );
rtems_test_assert( !status );
- puts( "Init: pthread_mutex_init - EAGAIN (too many)" );
+ puts( "Init: pthread_mutex_init - SUCCESSFUL" );
status = pthread_mutex_init( &Mutex3_id, &attr );
- rtems_test_assert( status == EAGAIN );
+ rtems_test_assert( !status );
puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" );
status = pthread_mutexattr_destroy( &attr );
rtems_test_assert( !status );
puts( "Init: pthread_mutex_destroy - SUCCESSFUL" );
+ status = pthread_mutex_destroy( &Mutex3_id );
+ rtems_test_assert( !status );
+
+ puts( "Init: pthread_mutex_destroy - SUCCESSFUL" );
status = pthread_mutex_destroy( &Mutex2_id );
rtems_test_assert( !status );
puts( "Init: pthread_mutex_destroy - EINVAL (invalid id)" );
- status = pthread_mutex_destroy( &Mutex_bad_id );
+ status = pthread_mutex_destroy( Mutex_bad_id );
rtems_test_assert( status == EINVAL );
/* destroy a busy mutex */
@@ -713,7 +888,7 @@ void *POSIX_Init(
rtems_test_assert( !status );
puts( "Init: pthread_mutex_getprioceiling - EINVAL (invalid id)" );
- status = pthread_mutex_getprioceiling( &Mutex_bad_id, &ceiling );
+ status = pthread_mutex_getprioceiling( Mutex_bad_id, &ceiling );
rtems_test_assert( status == EINVAL );
puts( "Init: pthread_mutex_getprioceiling - EINVAL (NULL ceiling)" );
@@ -725,7 +900,7 @@ void *POSIX_Init(
printf( "Init: pthread_mutex_getprioceiling - %d\n", ceiling );
puts( "Init: pthread_mutex_setprioceiling - EINVAL (invalid id)" );
- status = pthread_mutex_setprioceiling( &Mutex_bad_id, 200, &old_ceiling );
+ status = pthread_mutex_setprioceiling( Mutex_bad_id, 200, &old_ceiling );
rtems_test_assert( status == EINVAL );
puts( "Init: pthread_mutex_setprioceiling - EINVAL (illegal priority)" );
diff --git a/testsuites/psxtests/psx05/psx05.scn b/testsuites/psxtests/psx05/psx05.scn
index 0315eee562..700f3bfb4f 100644
--- a/testsuites/psxtests/psx05/psx05.scn
+++ b/testsuites/psxtests/psx05/psx05.scn
@@ -3,7 +3,7 @@ Init's ID is 0x0b010001
Init: pthread_mutexattr_init - EINVAL (NULL attr)
Init: pthread_mutexattr_init - SUCCESSFUL
Init: mutex protocol is (0) -- PTHREAD_PRIO_NONE
-Init: mutex priority ceiling is 254
+Init: mutex priority ceiling is 2147483647
Init: mutex process shared is (0) -- PTHREAD_PROCESS_PRIVATE
Init: pthread_mutexattr_destroy - SUCCESSFUL
Init: pthread_mutexattr_destroy - EINVAL (NULL attr)
@@ -67,9 +67,10 @@ Init: pthread_mutex_timedlock - time out in the past
Init: pthread_mutex_timedlock - EAGAIN (timeout)
Init: pthread_mutex_init - SUCCESSFUL
-Init: pthread_mutex_init - EAGAIN (too many)
+Init: pthread_mutex_init - SUCCESSFUL
Init: pthread_mutexattr_destroy - SUCCESSFUL
Init: pthread_mutex_destroy - SUCCESSFUL
+Init: pthread_mutex_destroy - SUCCESSFUL
Init: pthread_mutex_destroy - EINVAL (invalid id)
Init: pthread_mutexattr_init - SUCCESSFUL
@@ -113,8 +114,6 @@ Task 3: pthread_mutex_lock unavailable (inherit case)
Init: pthread_mutex_unlock - SUCCESSFUL
Task 3: mutex acquired
Task 3: unlock Mutex 2
-Task 3: pthread_getschedparam priority = 199
-Task 3: exit
Init: pthread_mutex_getprioceiling- ceiling = 200
Init: pthread_setschedparam - set Init priority to highest
Init: pthread_mutex_lock - EINVAL (priority ceiling violation)
diff --git a/testsuites/psxtests/psx05/system.h b/testsuites/psxtests/psx05/system.h
index a3615d49c3..a4d128d6f6 100644
--- a/testsuites/psxtests/psx05/system.h
+++ b/testsuites/psxtests/psx05/system.h
@@ -39,7 +39,6 @@ void *Task_3(
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_MAXIMUM_POSIX_THREADS 4
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
@@ -62,6 +61,6 @@ TEST_EXTERN pthread_t Task3_id;
TEST_EXTERN pthread_mutex_t Mutex_id;
TEST_EXTERN pthread_mutex_t Mutex2_id;
TEST_EXTERN pthread_mutex_t Mutex3_id;
-TEST_EXTERN pthread_mutex_t Mutex_bad_id;
+TEST_EXTERN pthread_mutex_t *Mutex_bad_id;
/* end of include file */
diff --git a/testsuites/psxtests/psx09/system.h b/testsuites/psxtests/psx09/system.h
index a5aabeb82d..2a86aa25fd 100644
--- a/testsuites/psxtests/psx09/system.h
+++ b/testsuites/psxtests/psx09/system.h
@@ -36,7 +36,6 @@ void *Task_2(
#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 10
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
diff --git a/testsuites/psxtests/psx10/system.h b/testsuites/psxtests/psx10/system.h
index ee7e9c4dcf..93ed9ff075 100644
--- a/testsuites/psxtests/psx10/system.h
+++ b/testsuites/psxtests/psx10/system.h
@@ -41,7 +41,6 @@ void *Task_3(
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_MAXIMUM_POSIX_THREADS 4
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
diff --git a/testsuites/psxtests/psxaio01/system.h b/testsuites/psxtests/psxaio01/system.h
index e17f7cab6d..1bedd7328a 100644
--- a/testsuites/psxtests/psxaio01/system.h
+++ b/testsuites/psxtests/psxaio01/system.h
@@ -28,7 +28,6 @@ void *POSIX_Init (void *argument);
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
diff --git a/testsuites/psxtests/psxaio02/system.h b/testsuites/psxtests/psxaio02/system.h
index e3e1333964..4f2f08a7b1 100644
--- a/testsuites/psxtests/psxaio02/system.h
+++ b/testsuites/psxtests/psxaio02/system.h
@@ -28,7 +28,6 @@ void *POSIX_Init (void *argument);
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
diff --git a/testsuites/psxtests/psxaio03/system.h b/testsuites/psxtests/psxaio03/system.h
index c809bc7045..68bf3046eb 100644
--- a/testsuites/psxtests/psxaio03/system.h
+++ b/testsuites/psxtests/psxaio03/system.h
@@ -29,7 +29,6 @@ void *POSIX_Init (void *argument);
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_MAXIMUM_POSIX_THREADS 30
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 30
#define CONFIGURE_MAXIMUM_POSIX_KEYS 30
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
diff --git a/testsuites/psxtests/psxautoinit01/init.c b/testsuites/psxtests/psxautoinit01/init.c
index f22cb1dc9d..9001de2306 100644
--- a/testsuites/psxtests/psxautoinit01/init.c
+++ b/testsuites/psxtests/psxautoinit01/init.c
@@ -25,23 +25,17 @@ void *POSIX_Init(
)
{
int sc;
- pthread_mutex_t mutex1;
- pthread_mutex_t mutex2;
+ pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
int prioceiling;
TEST_BEGIN();
/* path using mutex get with interrupts disabled */
- mutex1 = PTHREAD_MUTEX_INITIALIZER;
- mutex2 = PTHREAD_MUTEX_INITIALIZER;
puts( "Init - pthread_mutex_lock - auto initialize - OK" );
sc = pthread_mutex_lock( &mutex1 );
fatal_posix_service_status( sc, 0, "mutex lock OK" );
- puts( "Init - pthread_mutex_lock - auto initialize - EINVAL" );
- sc = pthread_mutex_lock( &mutex2 );
- fatal_posix_service_status( sc, EINVAL, "mutex lock EINVAL" );
-
puts( "Init - pthread_mutex_unlock - OK" );
sc = pthread_mutex_unlock( &mutex1 );
fatal_posix_service_status( sc, 0, "mutex unlock OK" );
@@ -51,22 +45,14 @@ void *POSIX_Init(
fatal_posix_service_status( sc, 0, "mutex destroy OK" );
/* path using mutex get with dispatching disabled */
- mutex1 = PTHREAD_MUTEX_INITIALIZER;
- mutex2 = PTHREAD_MUTEX_INITIALIZER;
puts( "Init - pthread_mutex_getprioceiling - auto initialize - OK" );
prioceiling = 1;
- sc = pthread_mutex_getprioceiling( &mutex1, &prioceiling );
+ sc = pthread_mutex_getprioceiling( &mutex2, &prioceiling );
fatal_posix_service_status( sc, 0, "mutex getprioceiling OK" );
rtems_test_assert( prioceiling == 0 );
- puts( "Init - pthread_mutex_getprioceiling - auto initialize - EINVAL" );
- prioceiling = 1;
- sc = pthread_mutex_getprioceiling( &mutex2, &prioceiling );
- fatal_posix_service_status( sc, EINVAL, "mutex getprioceiling EINVAL" );
- rtems_test_assert( prioceiling == 1 );
-
puts( "Init - pthread_mutex_destroy - OK" );
- sc = pthread_mutex_destroy( &mutex1 );
+ sc = pthread_mutex_destroy( &mutex2 );
fatal_posix_service_status( sc, 0, "mutex destroy OK" );
TEST_END();
@@ -81,7 +67,6 @@ void *POSIX_Init(
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
diff --git a/testsuites/psxtests/psxautoinit01/psxautoinit01.scn b/testsuites/psxtests/psxautoinit01/psxautoinit01.scn
index 9293acc626..3638ac4e94 100644
--- a/testsuites/psxtests/psxautoinit01/psxautoinit01.scn
+++ b/testsuites/psxtests/psxautoinit01/psxautoinit01.scn
@@ -1,10 +1,7 @@
-*** POSIX TEST -- AUTOMATIC INITIALIZAITON 01 ***
+*** BEGIN OF TEST PSXAUTOINIT 1 ***
Init - pthread_mutex_lock - auto initialize - OK
-Init - pthread_mutex_lock - auto initialize - EINVAL
Init - pthread_mutex_unlock - OK
Init - pthread_mutex_destroy - OK
Init - pthread_mutex_getprioceiling - auto initialize - OK
-Init - pthread_mutex_getprioceiling - auto initialize - EINVAL
Init - pthread_mutex_destroy - OK
-*** END OF POSIX TEST AUTOMATIC INITIALIZATION 01 ***
-
+*** END OF TEST PSXAUTOINIT 1 ***
diff --git a/testsuites/psxtests/psxautoinit02/init.c b/testsuites/psxtests/psxautoinit02/init.c
index bba4e24ea4..5d652f7467 100644
--- a/testsuites/psxtests/psxautoinit02/init.c
+++ b/testsuites/psxtests/psxautoinit02/init.c
@@ -101,7 +101,6 @@ void *POSIX_Init(
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
diff --git a/testsuites/psxtests/psxcleanup/system.h b/testsuites/psxtests/psxcleanup/system.h
index 2111c9fab5..04ea60394a 100644
--- a/testsuites/psxtests/psxcleanup/system.h
+++ b/testsuites/psxtests/psxcleanup/system.h
@@ -44,7 +44,6 @@ void *task_c(
#define CONFIGURE_MAXIMUM_POSIX_THREADS 4
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 4
#define CONFIGURE_MAXIMUM_TIMERS 4
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxcond01/init.c b/testsuites/psxtests/psxcond01/init.c
index 37fd4fdbb4..574769659a 100644
--- a/testsuites/psxtests/psxcond01/init.c
+++ b/testsuites/psxtests/psxcond01/init.c
@@ -95,7 +95,6 @@ void *POSIX_Init(
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
diff --git a/testsuites/psxtests/psxconfig01/init.c b/testsuites/psxtests/psxconfig01/init.c
index f62c2d5508..a1dc4c618f 100644
--- a/testsuites/psxtests/psxconfig01/init.c
+++ b/testsuites/psxtests/psxconfig01/init.c
@@ -61,7 +61,6 @@ const char rtems_test_name[] = "PSXCONFIG 1";
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 17
#define POSIX_MQ_COUNT 5
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 19
#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 7
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 41
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
@@ -447,18 +446,6 @@ static rtems_task Init(rtems_task_argument argument)
);
#endif
-#ifdef CONFIGURE_MAXIMUM_POSIX_MUTEXES
- for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_MUTEXES; ++i) {
- pthread_mutex_t mutex;
- eno = pthread_mutex_init(&mutex, NULL);
- rtems_test_assert(eno == 0);
- }
- rtems_resource_snapshot_take(&snapshot);
- rtems_test_assert(
- snapshot.posix_api.active_mutexes == CONFIGURE_MAXIMUM_POSIX_MUTEXES
- );
-#endif
-
#ifdef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; ++i) {
int oflag = O_RDWR | O_CREAT | O_EXCL;
diff --git a/testsuites/psxtests/psxkey07/init.c b/testsuites/psxtests/psxkey07/init.c
index 3790ea36aa..91cc7ea4ea 100644
--- a/testsuites/psxtests/psxkey07/init.c
+++ b/testsuites/psxtests/psxkey07/init.c
@@ -196,7 +196,6 @@ rtems_task Init(rtems_task_argument argument)
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(10)
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
#define CONFIGURE_UNIFIED_WORK_AREAS
diff --git a/testsuites/psxtests/psxsignal06/init.c b/testsuites/psxtests/psxsignal06/init.c
index 0177a2acea..cb34bb6bc8 100644
--- a/testsuites/psxtests/psxsignal06/init.c
+++ b/testsuites/psxtests/psxsignal06/init.c
@@ -126,7 +126,6 @@ void *POSIX_Init(void *argument)
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
diff --git a/testsuites/psxtests/psxtimer01/system.h b/testsuites/psxtests/psxtimer01/system.h
index 3fb71cadae..3ca39e41bc 100644
--- a/testsuites/psxtests/psxtimer01/system.h
+++ b/testsuites/psxtests/psxtimer01/system.h
@@ -44,7 +44,6 @@ void *task_c(
#define CONFIGURE_MAXIMUM_POSIX_THREADS 5
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 5
#define CONFIGURE_MAXIMUM_TIMERS 4
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
#include <rtems/confdefs.h>
diff --git a/testsuites/psxtmtests/psxtmcond03/init.c b/testsuites/psxtmtests/psxtmcond03/init.c
index 782782a23d..4a829bd55e 100644
--- a/testsuites/psxtmtests/psxtmcond03/init.c
+++ b/testsuites/psxtmtests/psxtmcond03/init.c
@@ -106,7 +106,6 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/psxtmtests/psxtmcond04/init.c b/testsuites/psxtmtests/psxtmcond04/init.c
index 9ed2ae61b4..1a40f23e53 100644
--- a/testsuites/psxtmtests/psxtmcond04/init.c
+++ b/testsuites/psxtmtests/psxtmcond04/init.c
@@ -99,7 +99,6 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/psxtmtests/psxtmcond06/init.c b/testsuites/psxtmtests/psxtmcond06/init.c
index 630641d31d..ec87ccd45c 100644
--- a/testsuites/psxtmtests/psxtmcond06/init.c
+++ b/testsuites/psxtmtests/psxtmcond06/init.c
@@ -123,7 +123,6 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS 2 + N
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/psxtmtests/psxtmcond07/init.c b/testsuites/psxtmtests/psxtmcond07/init.c
index 20952e5542..218fccccd4 100644
--- a/testsuites/psxtmtests/psxtmcond07/init.c
+++ b/testsuites/psxtmtests/psxtmcond07/init.c
@@ -119,7 +119,6 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS 2 + N
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/psxtmtests/psxtmcond08/init.c b/testsuites/psxtmtests/psxtmcond08/init.c
index 6f11b9e619..377b09948d 100644
--- a/testsuites/psxtmtests/psxtmcond08/init.c
+++ b/testsuites/psxtmtests/psxtmcond08/init.c
@@ -170,7 +170,6 @@ void *POSIX_Init(
#define CONFIGURE_MAXIMUM_POSIX_THREADS OPERATION_COUNT + 2
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
#define CONFIGURE_INIT
diff --git a/testsuites/psxtmtests/psxtmmutex01/init.c b/testsuites/psxtmtests/psxtmmutex01/init.c
index c8f6054c65..7a020f917d 100644
--- a/testsuites/psxtmtests/psxtmmutex01/init.c
+++ b/testsuites/psxtmtests/psxtmmutex01/init.c
@@ -83,7 +83,6 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/psxtmtests/psxtmmutex02/init.c b/testsuites/psxtmtests/psxtmmutex02/init.c
index 3ae6276dbc..b71e21f35f 100644
--- a/testsuites/psxtmtests/psxtmmutex02/init.c
+++ b/testsuites/psxtmtests/psxtmmutex02/init.c
@@ -124,7 +124,6 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS OPERATION_COUNT + 2
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/psxtmtests/psxtmmutex03/init.c b/testsuites/psxtmtests/psxtmmutex03/init.c
index bad1f278ea..6a29230520 100644
--- a/testsuites/psxtmtests/psxtmmutex03/init.c
+++ b/testsuites/psxtmtests/psxtmmutex03/init.c
@@ -173,7 +173,6 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/psxtmtests/psxtmmutex04/init.c b/testsuites/psxtmtests/psxtmmutex04/init.c
index e4227638ac..6513c59223 100644
--- a/testsuites/psxtmtests/psxtmmutex04/init.c
+++ b/testsuites/psxtmtests/psxtmmutex04/init.c
@@ -124,7 +124,6 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS OPERATION_COUNT + 2
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/psxtmtests/psxtmmutex05/init.c b/testsuites/psxtmtests/psxtmmutex05/init.c
index 712b5cc56d..d274fc5257 100644
--- a/testsuites/psxtmtests/psxtmmutex05/init.c
+++ b/testsuites/psxtmtests/psxtmmutex05/init.c
@@ -96,7 +96,6 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/psxtmtests/psxtmmutex06/init.c b/testsuites/psxtmtests/psxtmmutex06/init.c
index 2e8b82de80..c2bd0011c7 100644
--- a/testsuites/psxtmtests/psxtmmutex06/init.c
+++ b/testsuites/psxtmtests/psxtmmutex06/init.c
@@ -150,7 +150,6 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS OPERATION_COUNT + 2
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/psxtmtests/psxtmmutex07/init.c b/testsuites/psxtmtests/psxtmmutex07/init.c
index 299f87d714..9f087e5465 100644
--- a/testsuites/psxtmtests/psxtmmutex07/init.c
+++ b/testsuites/psxtmtests/psxtmmutex07/init.c
@@ -97,7 +97,6 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/smptests/smppsxmutex01/init.c b/testsuites/smptests/smppsxmutex01/init.c
index 3ed22b107e..aeed75c6d1 100644
--- a/testsuites/smptests/smppsxmutex01/init.c
+++ b/testsuites/smptests/smppsxmutex01/init.c
@@ -157,7 +157,6 @@ static void *POSIX_Init(void *arg)
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
#define CONFIGURE_MAXIMUM_PROCESSORS 2
diff --git a/testsuites/sptests/spmutex01/init.c b/testsuites/sptests/spmutex01/init.c
index 0c216a3901..b9d4a05f73 100644
--- a/testsuites/sptests/spmutex01/init.c
+++ b/testsuites/sptests/spmutex01/init.c
@@ -713,7 +713,6 @@ static void fatal_extension(
#define CONFIGURE_MAXIMUM_SEMAPHORES 3
#ifdef RTEMS_POSIX_API
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#endif
#define CONFIGURE_INITIAL_EXTENSIONS \
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index 902d6abe03..f6fa1ddaf4 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -103,8 +103,6 @@ typedef enum {
POSIX_SIGNALS_POST,
POSIX_THREADS_PRE,
POSIX_THREADS_POST,
- POSIX_MUTEX_PRE,
- POSIX_MUTEX_POST,
POSIX_MESSAGE_QUEUE_PRE,
POSIX_MESSAGE_QUEUE_POST,
POSIX_SEMAPHORE_PRE,
@@ -438,18 +436,6 @@ LAST(RTEMS_SYSINIT_POSIX_THREADS)
next_step(POSIX_THREADS_POST);
}
-FIRST(RTEMS_SYSINIT_POSIX_MUTEX)
-{
- assert(_POSIX_Mutex_Information.maximum == 0);
- next_step(POSIX_MUTEX_PRE);
-}
-
-LAST(RTEMS_SYSINIT_POSIX_MUTEX)
-{
- assert(_POSIX_Mutex_Information.maximum != 0);
- next_step(POSIX_MUTEX_POST);
-}
-
FIRST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE)
{
assert(_POSIX_Message_queue_Information.maximum == 0);
@@ -716,7 +702,6 @@ static void *POSIX_Init(void *arg)
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1
diff --git a/testsuites/sptests/spthreadq01/init.c b/testsuites/sptests/spthreadq01/init.c
index 473db6d05a..5ec03fdddc 100644
--- a/testsuites/sptests/spthreadq01/init.c
+++ b/testsuites/sptests/spthreadq01/init.c
@@ -40,8 +40,6 @@ typedef struct {
rtems_id mq;
rtems_id br;
#if defined(RTEMS_POSIX_API)
- pthread_mutex_t pmtx;
- pthread_cond_t pcv;
mqd_t pmq;
#endif
} test_context;
@@ -118,24 +116,6 @@ static void posix_worker(test_context *ctx)
int eno;
char buf[1];
- eno = pthread_mutex_lock(&ctx->pmtx);
- rtems_test_assert(eno == 0);
-
- wake_up_master(ctx);
- rtems_test_assert(get_wait_id(ctx) == ctx->pmtx);
-
- eno = pthread_mutex_unlock(&ctx->pmtx);
- rtems_test_assert(eno == 0);
-
- eno = pthread_mutex_lock(&ctx->pmtx);
- rtems_test_assert(eno == 0);
-
- eno = pthread_cond_signal(&ctx->pcv);
- rtems_test_assert(eno == 0);
-
- eno = pthread_mutex_unlock(&ctx->pmtx);
- rtems_test_assert(eno == 0);
-
wake_up_master(ctx);
rtems_test_assert(get_wait_id(ctx) == ctx->pmq);
@@ -201,12 +181,6 @@ static void test_posix_init(test_context *ctx)
int eno;
struct mq_attr attr;
- eno = pthread_mutex_init(&ctx->pmtx, NULL);
- rtems_test_assert(eno == 0);
-
- eno = pthread_cond_init(&ctx->pcv, NULL);
- rtems_test_assert(eno == 0);
-
memset(&attr, 0, sizeof(attr));
attr.mq_maxmsg = 1;
attr.mq_msgsize = sizeof(char);
@@ -287,17 +261,6 @@ static void test_posix_obj(test_context *ctx)
wait_for_worker(ctx);
- eno = pthread_mutex_lock(&ctx->pmtx);
- rtems_test_assert(eno == 0);
-
- eno = pthread_cond_wait(&ctx->pcv, &ctx->pmtx);
- rtems_test_assert(eno == 0);
-
- eno = pthread_mutex_unlock(&ctx->pmtx);
- rtems_test_assert(eno == 0);
-
- wait_for_worker(ctx);
-
buf[0] = 'y';
prio = 1;
n = mq_receive(ctx->pmq, &buf[0], sizeof(buf), &prio);
@@ -340,7 +303,6 @@ static rtems_task Init(
#define CONFIGURE_MAXIMUM_BARRIERS 1
#if defined(RTEMS_POSIX_API)
- #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1
#define CONFIGURE_MESSAGE_BUFFER_MEMORY \
(2 * CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(1, 1))
--
2.12.3
More information about the devel
mailing list