aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/htl
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-01-13 01:17:07 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-01-13 01:24:43 +0100
commit196e62cbe4acdab22a95740b618c699863ed460c (patch)
tree5ef9cc8050f63da1e83683b703918f0c52931c9f /sysdeps/htl
parente404be33feaa586231fe30e3bdf6d380a79c2679 (diff)
downloadglibc-196e62cbe4acdab22a95740b618c699863ed460c.zip
glibc-196e62cbe4acdab22a95740b618c699863ed460c.tar.gz
glibc-196e62cbe4acdab22a95740b618c699863ed460c.tar.bz2
htl: Add type sizes in bits/pthreadtypes-arch.h and check them
Diffstat (limited to 'sysdeps/htl')
-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
11 files changed, 24 insertions, 0 deletions
diff --git a/sysdeps/htl/pt-attr-init.c b/sysdeps/htl/pt-attr-init.c
index 2911176..7b20204 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 f8befde..2197618 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 ddda87d..a0d0e3a 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 3ba1f11..c5330b5 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 9018490..90f5d1b 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 e20d44c..c59bd8a 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 c968186..a96e52d 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 b818ca4..0581f7b 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 d79b018..0cba076 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 721e5ec..bbc7b87 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 30e074c..af01545 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 */