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

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Fri Oct 25 21:34:27 2013 +0200

cobalt: avoid calling prefault in case of syscall failure

---

 lib/cobalt/cond.c  |   11 ++++++-----
 lib/cobalt/mutex.c |    2 ++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/cobalt/cond.c b/lib/cobalt/cond.c
index a65aef7..fdd90e5 100644
--- a/lib/cobalt/cond.c
+++ b/lib/cobalt/cond.c
@@ -87,17 +87,18 @@ COBALT_IMPL(int, pthread_cond_init, (pthread_cond_t *cond,
        unsigned long *pending_signalsp;
        int err;
 
-       err = XENOMAI_SKINCALL2(__cobalt_muxid, sc_cobalt_cond_init, _cnd, 
attr);
-       if (!err && !_cnd->attr.pshared) {
+       err = -XENOMAI_SKINCALL2(__cobalt_muxid, sc_cobalt_cond_init, _cnd, 
attr);
+       if (err)
+               return err;
+       
+       if (!_cnd->attr.pshared) {
                pending_signalsp = (unsigned long *)
                        (cobalt_sem_heap[0] + _cnd->pending_signals_offset);
                _cnd->pending_signals = pending_signalsp;
        } else
                pending_signalsp = cond_get_signalsp(_cnd);
 
-       __cobalt_prefault(pending_signalsp);
-
-       return -err;
+       return 0;
 }
 
 COBALT_IMPL(int, pthread_cond_destroy, (pthread_cond_t *cond))
diff --git a/lib/cobalt/mutex.c b/lib/cobalt/mutex.c
index 0d0c4b2..9655eca 100644
--- a/lib/cobalt/mutex.c
+++ b/lib/cobalt/mutex.c
@@ -90,6 +90,8 @@ COBALT_IMPL(int, pthread_mutex_init, (pthread_mutex_t *mutex,
        }
 
        err = 
-XENOMAI_SKINCALL2(__cobalt_muxid,sc_cobalt_mutex_init,_mutex,attr);
+       if (err)
+               return err;
 
        if (!_mutex->attr.pshared) {
                datp = (struct mutex_dat *)


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

Reply via email to