Module: xenomai-rpm
Branch: for-upstream
Commit: ec57f101c01bb7d3efa4d96452ca279470041825
URL:    
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=ec57f101c01bb7d3efa4d96452ca279470041825

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Jun 14 17:35:13 2010 +0200

common: warn early about missing /dev/rtheap

---

 include/nucleus/heap.h  |    3 +--
 src/skins/common/bind.c |    9 +++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/nucleus/heap.h b/include/nucleus/heap.h
index e837bf2..9758f5f 100644
--- a/include/nucleus/heap.h
+++ b/include/nucleus/heap.h
@@ -190,8 +190,6 @@ extern "C" {
 
 #ifdef __KERNEL__
 
-#define XNHEAP_DEV_MINOR 254
-
 int xnheap_mount(void);
 
 void xnheap_umount(void);
@@ -281,6 +279,7 @@ int xnheap_check_block(xnheap_t *heap,
 #endif /* __KERNEL__ || __XENO_SIM__ */
 
 #define XNHEAP_DEV_NAME  "/dev/rtheap"
+#define XNHEAP_DEV_MINOR 254
 
 #ifdef CONFIG_MMU
 /* XXX: 2.5.x ABI preserved for MMU-enabled only. */
diff --git a/src/skins/common/bind.c b/src/skins/common/bind.c
index d511072..fb15bf5 100644
--- a/src/skins/common/bind.c
+++ b/src/skins/common/bind.c
@@ -1,9 +1,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <signal.h>
+#include <unistd.h>
 #include <string.h>
 #include <errno.h>
 
+#include <nucleus/heap.h>
 #include <asm/xenomai/syscall.h>
 #include <asm-generic/xenomai/bits/current.h>
 #include <asm-generic/xenomai/timeconv.h>
@@ -86,6 +88,13 @@ xeno_bind_skin_opt(unsigned skin_magic, const char *skin,
        xnfeatinfo_t finfo;
        int muxid;
 
+       /* Some sanity checks first. */
+       if (access(XNHEAP_DEV_NAME, 0)) {
+               fprintf(stderr, "Xenomai: %s is missing\n(chardev, major=10 
minor=%d)\n",
+                       XNHEAP_DEV_NAME, XNHEAP_DEV_MINOR);
+               exit(EXIT_FAILURE);
+       }
+       
        old_sigill_handler = signal(SIGILL, xeno_sigill_handler);
        if (old_sigill_handler == SIG_ERR) {
                perror("signal(SIGILL)");


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

Reply via email to