summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysdeps/htl/pt-attr-init.c2
-rw-r--r--sysdeps/htl/pt-barrier-init.c2
-rw-r--r--sysdeps/htl/pt-barrierattr-init.c2
-rw-r--r--sysdeps/htl/pt-cond-init.c2
-rw-r--r--sysdeps/htl/pt-condattr-init.c2
-rw-r--r--sysdeps/htl/pt-mutex-init.c2
-rw-r--r--sysdeps/htl/pt-mutexattr-init.c2
-rw-r--r--sysdeps/htl/pt-once.c2
-rw-r--r--sysdeps/htl/pt-rwlock-init.c2
-rw-r--r--sysdeps/htl/pt-rwlockattr-init.c2
-rw-r--r--sysdeps/htl/pthreadP.h4
-rw-r--r--sysdeps/i386/htl/bits/pthreadtypes-arch.h14
-rw-r--r--sysdeps/mach/hurd/htl/pt-mutex-init.c2
-rw-r--r--sysdeps/mach/hurd/htl/pt-mutexattr-init.c2
14 files changed, 42 insertions, 0 deletions
diff --git a/sysdeps/htl/pt-attr-init.c b/sysdeps/htl/pt-attr-init.c
index 29111763fa..7b20204cd7 100644
--- a/sysdeps/htl/pt-attr-init.c
+++ b/sysdeps/htl/pt-attr-init.c
@@ -22,6 +22,8 @@
int
__pthread_attr_init (pthread_attr_t *attr)
{
+ ASSERT_TYPE_SIZE (pthread_attr_t, __SIZEOF_PTHREAD_ATTR_T);
+
*attr = __pthread_default_attr;
return 0;
}
diff --git a/sysdeps/htl/pt-barrier-init.c b/sysdeps/htl/pt-barrier-init.c
index f8befde66d..2197618238 100644
--- a/sysdeps/htl/pt-barrier-init.c
+++ b/sysdeps/htl/pt-barrier-init.c
@@ -26,6 +26,8 @@ int
pthread_barrier_init (pthread_barrier_t *barrier,
const pthread_barrierattr_t *attr, unsigned count)
{
+ ASSERT_TYPE_SIZE (pthread_barrier_t, __SIZEOF_PTHREAD_BARRIER_T);
+
if (count == 0)
return EINVAL;
diff --git a/sysdeps/htl/pt-barrierattr-init.c b/sysdeps/htl/pt-barrierattr-init.c
index ddda87d1c8..a0d0e3a98f 100644
--- a/sysdeps/htl/pt-barrierattr-init.c
+++ b/sysdeps/htl/pt-barrierattr-init.c
@@ -22,6 +22,8 @@
int
pthread_barrierattr_init (pthread_barrierattr_t *attr)
{
+ ASSERT_TYPE_SIZE (pthread_barrierattr_t, __SIZEOF_PTHREAD_BARRIERATTR_T);
+
*attr = __pthread_default_barrierattr;
return 0;
}
diff --git a/sysdeps/htl/pt-cond-init.c b/sysdeps/htl/pt-cond-init.c
index 3ba1f11881..c5330b5931 100644
--- a/sysdeps/htl/pt-cond-init.c
+++ b/sysdeps/htl/pt-cond-init.c
@@ -25,6 +25,8 @@
int
__pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t * attr)
{
+ ASSERT_TYPE_SIZE (pthread_cond_t, __SIZEOF_PTHREAD_COND_T);
+
*cond = (pthread_cond_t) __PTHREAD_COND_INITIALIZER;
if (attr == NULL
diff --git a/sysdeps/htl/pt-condattr-init.c b/sysdeps/htl/pt-condattr-init.c
index 9018490ab0..90f5d1b6d6 100644
--- a/sysdeps/htl/pt-condattr-init.c
+++ b/sysdeps/htl/pt-condattr-init.c
@@ -22,6 +22,8 @@
int
__pthread_condattr_init (pthread_condattr_t *attr)
{
+ ASSERT_TYPE_SIZE (pthread_condattr_t, __SIZEOF_PTHREAD_CONDATTR_T);
+
*attr = __pthread_default_condattr;
return 0;
}
diff --git a/sysdeps/htl/pt-mutex-init.c b/sysdeps/htl/pt-mutex-init.c
index e20d44c64c..c59bd8a3f5 100644
--- a/sysdeps/htl/pt-mutex-init.c
+++ b/sysdeps/htl/pt-mutex-init.c
@@ -28,6 +28,8 @@ _pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
{
*mutex = (pthread_mutex_t) __PTHREAD_MUTEX_INITIALIZER;
+ ASSERT_TYPE_SIZE (pthread_mutex_t, __SIZEOF_PTHREAD_MUTEX_T);
+
if (attr == NULL
|| memcmp (attr, &__pthread_default_mutexattr, sizeof (*attr)) == 0)
/* The default attributes. */
diff --git a/sysdeps/htl/pt-mutexattr-init.c b/sysdeps/htl/pt-mutexattr-init.c
index c9681863ed..a96e52dedf 100644
--- a/sysdeps/htl/pt-mutexattr-init.c
+++ b/sysdeps/htl/pt-mutexattr-init.c
@@ -22,6 +22,8 @@
int
__pthread_mutexattr_init (pthread_mutexattr_t *attr)
{
+ ASSERT_TYPE_SIZE (pthread_mutexattr_t, __SIZEOF_PTHREAD_MUTEXATTR_T);
+
*attr = __pthread_default_mutexattr;
return 0;
}
diff --git a/sysdeps/htl/pt-once.c b/sysdeps/htl/pt-once.c
index b818ca4d24..0581f7bd6c 100644
--- a/sysdeps/htl/pt-once.c
+++ b/sysdeps/htl/pt-once.c
@@ -24,6 +24,8 @@
int
__pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
{
+ ASSERT_TYPE_SIZE (pthread_once_t, __SIZEOF_PTHREAD_ONCE_T);
+
atomic_full_barrier ();
if (once_control->__run == 0)
{
diff --git a/sysdeps/htl/pt-rwlock-init.c b/sysdeps/htl/pt-rwlock-init.c
index d79b018f3a..0cba0764be 100644
--- a/sysdeps/htl/pt-rwlock-init.c
+++ b/sysdeps/htl/pt-rwlock-init.c
@@ -24,6 +24,8 @@ int
_pthread_rwlock_init (pthread_rwlock_t *rwlock,
const pthread_rwlockattr_t *attr)
{
+ ASSERT_TYPE_SIZE (pthread_rwlock_t, __SIZEOF_PTHREAD_RWLOCK_T);
+
*rwlock = (pthread_rwlock_t) __PTHREAD_RWLOCK_INITIALIZER;
if (attr == NULL
diff --git a/sysdeps/htl/pt-rwlockattr-init.c b/sysdeps/htl/pt-rwlockattr-init.c
index 721e5ec555..bbc7b87990 100644
--- a/sysdeps/htl/pt-rwlockattr-init.c
+++ b/sysdeps/htl/pt-rwlockattr-init.c
@@ -22,6 +22,8 @@
int
pthread_rwlockattr_init (pthread_rwlockattr_t *attr)
{
+ ASSERT_TYPE_SIZE (pthread_rwlockattr_t, __SIZEOF_PTHREAD_RWLOCKATTR_T);
+
*attr = __pthread_default_rwlockattr;
return 0;
}
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index 30e074c1d0..af0154538a 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -74,4 +74,8 @@ hidden_proto (__pthread_setspecific)
hidden_proto (_pthread_mutex_init)
#endif
+#define ASSERT_TYPE_SIZE(type, size) \
+ _Static_assert (sizeof (type) == size, \
+ "sizeof (" #type ") != " #size)
+
#endif /* pthreadP.h */
diff --git a/sysdeps/i386/htl/bits/pthreadtypes-arch.h b/sysdeps/i386/htl/bits/pthreadtypes-arch.h
index 39d8ff3f8e..17568fb536 100644
--- a/sysdeps/i386/htl/bits/pthreadtypes-arch.h
+++ b/sysdeps/i386/htl/bits/pthreadtypes-arch.h
@@ -19,4 +19,18 @@
#ifndef _BITS_PTHREADTYPES_ARCH_H
#define _BITS_PTHREADTYPES_ARCH_H 1
+#define __SIZEOF_PTHREAD_MUTEX_T 32
+#define __SIZEOF_PTHREAD_ATTR_T 32
+#define __SIZEOF_PTHREAD_RWLOCK_T 28
+#define __SIZEOF_PTHREAD_BARRIER_T 24
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 16
+#define __SIZEOF_PTHREAD_COND_T 20
+#define __SIZEOF_PTHREAD_CONDATTR_T 8
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 4
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+#define __SIZEOF_PTHREAD_ONCE_T 8
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
#endif /* bits/pthreadtypes.h */
diff --git a/sysdeps/mach/hurd/htl/pt-mutex-init.c b/sysdeps/mach/hurd/htl/pt-mutex-init.c
index 4665bfaf5f..6b804116a5 100644
--- a/sysdeps/mach/hurd/htl/pt-mutex-init.c
+++ b/sysdeps/mach/hurd/htl/pt-mutex-init.c
@@ -34,6 +34,8 @@ static const pthread_mutexattr_t dfl_attr = {
int
_pthread_mutex_init (pthread_mutex_t *mtxp, const pthread_mutexattr_t *attrp)
{
+ ASSERT_TYPE_SIZE (pthread_mutex_t, __SIZEOF_PTHREAD_MUTEX_T);
+
if (attrp == NULL)
attrp = &dfl_attr;
diff --git a/sysdeps/mach/hurd/htl/pt-mutexattr-init.c b/sysdeps/mach/hurd/htl/pt-mutexattr-init.c
index f659a51c28..569ed11c9c 100644
--- a/sysdeps/mach/hurd/htl/pt-mutexattr-init.c
+++ b/sysdeps/mach/hurd/htl/pt-mutexattr-init.c
@@ -33,6 +33,8 @@ static const pthread_mutexattr_t dfl_attr = {
int
__pthread_mutexattr_init (pthread_mutexattr_t *attrp)
{
+ ASSERT_TYPE_SIZE (pthread_mutexattr_t, __SIZEOF_PTHREAD_MUTEXATTR_T);
+
*attrp = dfl_attr;
return 0;
}