Module: xenomai-2.5
Branch: master
Commit: e8e4e5d958bc07014b240c5967ab6546db529dbe
URL:    
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=e8e4e5d958bc07014b240c5967ab6546db529dbe

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Jun 24 12:09:55 2010 +0200

switchtest: bail out upon sem_wait() error

When CONFIG_FUTEX is disabled for the target kernel, we rightfully get
ENOSYS from the sem_wait() call on futex-enabled glibc. Check the
sem_wait() return as we should to spot the issue, so that we don't run
into subtle races due to incorrect synchronization.

---

 src/testsuite/switchtest/switchtest.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/testsuite/switchtest/switchtest.c 
b/src/testsuite/switchtest/switchtest.c
index 7114a9f..31b840d 100644
--- a/src/testsuite/switchtest/switchtest.c
+++ b/src/testsuite/switchtest/switchtest.c
@@ -273,6 +273,7 @@ static void *sleeper_switcher(void *cookie)
        cpu_set_t cpu_set;
        unsigned i = 1;         /* Start at 1 to avoid returning to a
                                   non-existing task. */
+       int ret;
 
        CPU_ZERO(&cpu_set);
        CPU_SET(param->cpu->index, &cpu_set);
@@ -287,7 +288,12 @@ static void *sleeper_switcher(void *cookie)
        ts.tv_sec = 0;
        ts.tv_nsec = 1000000;
 
-       __real_sem_wait(&sleeper_start);
+       ret = __real_sem_wait(&sleeper_start);
+       if (ret) {
+               fprintf(stderr, "sem_wait FAILED (%d)\n", errno);
+               fflush(stderr);
+               exit(77);
+       }
 
        clock_gettime(CLOCK_REALTIME, &last);
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to