Module: xenomai-forge
Branch: next
Commit: 47979b1de9d7146a37e0623db489afbd4d6ea3f6
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=47979b1de9d7146a37e0623db489afbd4d6ea3f6

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Sep 11 07:35:11 2014 +0200

lib/cobalt: cope with pthread_atfork() placeholder on MMU-less

---

 lib/cobalt/init.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index ed4cbb7..8ba9902 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -120,7 +120,6 @@ static void __init_cobalt(void);
 void __libcobalt_init(void)
 {
        struct sigaction sa;
-       int ret;
 
        low_init();
 
@@ -129,16 +128,21 @@ void __libcobalt_init(void)
        sa.sa_flags = SA_SIGINFO;
        sigaction(SIGDEBUG, &sa, &__cobalt_orig_sigdebug);
 
+#ifdef HAVE_PTHREAD_ATFORK
        /*
         * Upon fork, in case the parent required init deferral, this
         * is the forkee's responsibility to call __libcobalt_init()
-        * for bootstrapping the services the same way.
+        * for bootstrapping the services the same way. On systems
+        * with no fork() support, clients are not supposed to, well,
+        * fork in the first place, so we don't take any provision for
+        * this event.
+        *
+        * NOTE: a placeholder for pthread_atfork() may return an
+        * error status with uClibc, so we don't check the return
+        * value on purpose.
         */
-       ret = pthread_atfork(NULL, NULL, __init_cobalt);
-       if (ret) {
-               report_error("pthread_atfork: %s", strerror(ret));
-               exit(EXIT_FAILURE);
-       }
+       pthread_atfork(NULL, NULL, __init_cobalt);
+#endif
 
        if (sizeof(struct cobalt_mutex_shadow) > sizeof(pthread_mutex_t)) {
                report_error("sizeof(pthread_mutex_t): %d <"


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

Reply via email to