Module: xenomai-gch
Branch: for-forge
Commit: abccf0399f39c7968fe8db14e466c610016a161c
URL:    
http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=abccf0399f39c7968fe8db14e466c610016a161c

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sun Dec  8 20:06:20 2013 +0100

cobalt/init: check pthread_cond_t and sem_t structure sizes

---

 lib/cobalt/init.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index 101a2bd..bc32a50 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -25,6 +25,7 @@
 #include <signal.h>
 #include <limits.h>
 #include <unistd.h>
+#include <semaphore.h>
 #include <boilerplate/ancillaries.h>
 #include <cobalt/uapi/kernel/heap.h>
 #include <cobalt/uapi/rtdm/syscall.h>
@@ -173,6 +174,20 @@ void __libcobalt_init(void)
                             (int) sizeof(struct __shadow_mutex));
                exit(EXIT_FAILURE);
        }
+       if (sizeof(struct __shadow_cond) > sizeof(pthread_cond_t)) {
+               report_error("sizeof(pthread_cond_t): %d <"
+                            " sizeof(shadow_cond): %d !",
+                            (int) sizeof(pthread_cond_t),
+                            (int) sizeof(struct __shadow_cond));
+               exit(EXIT_FAILURE);
+       }
+       if (sizeof(struct __shadow_sem) > sizeof(sem_t)) {
+               report_error("sizeof(sem_t): %d <"
+                            " sizeof(shadow_sem): %d !",
+                            (int) sizeof(sem_t),
+                            (int) sizeof(struct __shadow_sem));
+               exit(EXIT_FAILURE);
+       }
 
        cobalt_print_init();
        boilerplate_init();


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to