All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [PATCH] refactor skin bind headers
@ 2006-08-15 14:39 Jan Kiszka
  2006-08-15 15:00 ` [Xenomai-core] " Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2006-08-15 14:39 UTC (permalink / raw)
  To: Philippe Gerum, xenomai-core


[-- Attachment #1.1: Type: text/plain, Size: 271 bytes --]

As discussed in the buildbot thread, here comes a second try to refactor
the skin binding headers. Basically, nucleus/bind.h is split up and
moved to asm-generic/bits, skins are updated appropriately.

Builds fine here with both gcc-3.3 and gcc-4.1 over x86.

Jan

[-- Attachment #1.2: refactor-skin-bind-headers.patch --]
[-- Type: text/plain, Size: 13074 bytes --]

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 1440)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2006-08-15  Jan Kiszka  <jan.kiszka@domain.hid>
+
+	* include/asm-generic/bits/{bind.h,mlock_alert.h},
+	include/<skin>/syscall.h, src/skins/<skin>/init.c: Split up
+	include/nucleus/bind.h and move the fragments to asm-generic/bits.
+
 2006-08-14  Jan Kiszka  <jan.kiszka@domain.hid>
 
 	* ksrc/drivers/{serial,Kconfig,Config.in,Makefile},
Index: src/skins/rtai/init.c
===================================================================
--- src/skins/rtai/init.c	(revision 1440)
+++ src/skins/rtai/init.c	(working copy)
@@ -20,6 +20,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <rtai/syscall.h>
+#include <asm-generic/bits/bind.h>
+#include <asm-generic/bits/mlock_alert.h>
 
 int __rtai_muxid = -1;
 
Index: src/skins/posix/init.c
===================================================================
--- src/skins/posix/init.c	(revision 1440)
+++ src/skins/posix/init.c	(working copy)
@@ -26,6 +26,8 @@
 #include <posix/posix.h>
 #include <posix/syscall.h>
 #include <rtdm/syscall.h>
+#include <asm-generic/bits/bind.h>
+#include <asm-generic/bits/mlock_alert.h>
 
 int __pse51_muxid = -1;
 int __rtdm_muxid = -1;
Index: src/skins/vxworks/init.c
===================================================================
--- src/skins/vxworks/init.c	(revision 1440)
+++ src/skins/vxworks/init.c	(working copy)
@@ -23,6 +23,8 @@
 #include <stdlib.h>
 #include <pthread.h>
 #include <vxworks/vxworks.h>
+#include <asm-generic/bits/bind.h>
+#include <asm-generic/bits/mlock_alert.h>
 
 pthread_key_t __vxworks_tskey;
 
Index: src/skins/vrtx/init.c
===================================================================
--- src/skins/vrtx/init.c	(revision 1440)
+++ src/skins/vrtx/init.c	(working copy)
@@ -23,6 +23,8 @@
 #include <stdlib.h>
 #include <pthread.h>
 #include <vrtx/vrtx.h>
+#include <asm-generic/bits/bind.h>
+#include <asm-generic/bits/mlock_alert.h>
 
 pthread_key_t __vrtx_tskey;
 
Index: src/skins/native/init.c
===================================================================
--- src/skins/native/init.c	(revision 1440)
+++ src/skins/native/init.c	(working copy)
@@ -24,6 +24,8 @@
 #include <pthread.h>
 #include <native/syscall.h>
 #include <native/task.h>
+#include <asm-generic/bits/bind.h>
+#include <asm-generic/bits/mlock_alert.h>
 
 pthread_key_t __native_tskey;
 
Index: src/skins/rtdm/init.c
===================================================================
--- src/skins/rtdm/init.c	(revision 1440)
+++ src/skins/rtdm/init.c	(working copy)
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <rtdm/syscall.h>
+#include <asm-generic/bits/bind.h>
 
 int __rtdm_muxid = -1;
 
Index: include/vxworks/syscall.h
===================================================================
--- include/vxworks/syscall.h	(revision 1440)
+++ include/vxworks/syscall.h	(working copy)
@@ -91,10 +91,6 @@ void wind_syscall_cleanup(void);
 }
 #endif
 
-#elif !defined(__XENO_SIM__)
-
-#include <nucleus/bind.h>
-
 #endif /* __KERNEL__ */
 
 #endif /* _XENO_VXWORKS_SYSCALL_H */
Index: include/native/syscall.h
===================================================================
--- include/native/syscall.h	(revision 1440)
+++ include/native/syscall.h	(working copy)
@@ -143,10 +143,6 @@ void __native_syscall_cleanup(void);
 }
 #endif
 
-#elif !defined(__XENO_SIM__)
-
-#include <nucleus/bind.h>
-
 #endif /* __KERNEL__ */
 
 #endif /* _NATIVE_SYSCALL_H */
Index: include/asm-generic/bits/Makefile.in
===================================================================
--- include/asm-generic/bits/Makefile.in	(revision 1440)
+++ include/asm-generic/bits/Makefile.in	(working copy)
@@ -216,7 +216,13 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-include_HEADERS = pod.h intr.h heap.h
+include_HEADERS = \
+	bind.h \
+	heap.h \
+	intr.h \
+	mlock_alert.h \
+	pod.h
+
 all: all-am
 
 .SUFFIXES:
Index: include/asm-generic/bits/bind.h
===================================================================
--- include/asm-generic/bits/bind.h	(revision 1440)
+++ include/asm-generic/bits/bind.h	(working copy)
@@ -1,38 +1,14 @@
-#ifndef _XENO_NUCLEUS_BIND_H
-#define _XENO_NUCLEUS_BIND_H
+#ifndef _XENO_ASM_GENERIC_BITS_BIND_H
+#define _XENO_ASM_GENERIC_BITS_BIND_H
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 #include <signal.h>
-#include <pthread.h>
 #include <asm/xenomai/syscall.h>
 
-__attribute__ ((weak))
-int xeno_sigxcpu_no_mlock = 1;
-
-static void xeno_handle_mlock_alert(int sig)
-{
-	struct sigaction sa;
-
-	if (xeno_sigxcpu_no_mlock) {
-		fprintf(stderr,
-			"Xenomai: process memory not locked (missing mlockall?)\n");
-		fflush(stderr);
-		exit(4);
-	}
-
-	/* XNTRAPSW was set for the thread but no user-defined handler
-	   has been set to override our internal handler, so let's
-	   invoke the default signal action. */
-
-	sa.sa_handler = SIG_DFL;
-	sigemptyset(&sa.sa_mask);
-	sa.sa_flags = 0;
-	sigaction(SIGXCPU, &sa, NULL);
-	pthread_kill(pthread_self(), SIGXCPU);
-}
+void xeno_handle_mlock_alert(int sig);
 
 static inline int
 xeno_bind_skin(unsigned skin_magic, const char *skin, const char *module)
@@ -132,4 +108,4 @@ xeno_bind_skin_opt(unsigned skin_magic, 
 	return __xn_mux_shifted_id(muxid);
 }
 
-#endif /* _XENO_NUCLEUS_BIND_H */
+#endif /* _XENO_ASM_GENERIC_BITS_BIND_H */
Index: include/asm-generic/bits/mlock_alert.h
===================================================================
--- include/asm-generic/bits/mlock_alert.h	(revision 0)
+++ include/asm-generic/bits/mlock_alert.h	(revision 0)
@@ -0,0 +1,35 @@
+#ifndef _XENO_ASM_GENERIC_BITS_MLOCK_ALERT_H
+#define _XENO_ASM_GENERIC_BITS_MLOCK_ALERT_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <pthread.h>
+
+__attribute__ ((weak))
+int xeno_sigxcpu_no_mlock = 1;
+
+__attribute__ ((visibility ("internal")))
+void xeno_handle_mlock_alert(int sig)
+{
+	struct sigaction sa;
+
+	if (xeno_sigxcpu_no_mlock) {
+		fprintf(stderr, "Xenomai: process memory not locked "
+			"(missing mlockall?)\n");
+		fflush(stderr);
+		exit(4);
+	}
+
+	/* XNTRAPSW was set for the thread but no user-defined handler
+	   has been set to override our internal handler, so let's
+	   invoke the default signal action. */
+
+	sa.sa_handler = SIG_DFL;
+	sigemptyset(&sa.sa_mask);
+	sa.sa_flags = 0;
+	sigaction(SIGXCPU, &sa, NULL);
+	pthread_kill(pthread_self(), SIGXCPU);
+}
+
+#endif /* _XENO_ASM_GENERIC_BITS_MLOCK_ALERT_H */
Index: include/asm-generic/bits/Makefile.am
===================================================================
--- include/asm-generic/bits/Makefile.am	(revision 1440)
+++ include/asm-generic/bits/Makefile.am	(working copy)
@@ -1,3 +1,8 @@
 includedir = $(prefix)/include/asm-generic/bits
 
-include_HEADERS = pod.h intr.h heap.h
+include_HEADERS = \
+	bind.h \
+	heap.h \
+	intr.h \
+	mlock_alert.h \
+	pod.h
Index: include/rtai/syscall.h
===================================================================
--- include/rtai/syscall.h	(revision 1440)
+++ include/rtai/syscall.h	(working copy)
@@ -31,10 +31,6 @@ int __rtai_syscall_init(void);
 
 void __rtai_syscall_cleanup(void);
 
-#elif !defined(__XENO_SIM__)
-
-#include <nucleus/bind.h>
-
 #endif /* __KERNEL__ */
 
 #endif /* !_RTAI_SYSCALL_H */
Index: include/posix/syscall.h
===================================================================
--- include/posix/syscall.h	(revision 1440)
+++ include/posix/syscall.h	(working copy)
@@ -114,10 +114,6 @@ void pse51_syscall_cleanup(void);
 }
 #endif
 
-#elif !defined(__XENO_SIM__)
-
-#include <nucleus/bind.h>
-
 #endif /* __KERNEL__ */
 
 #endif /* _POSIX_SYSCALL_H */
Index: include/vrtx/syscall.h
===================================================================
--- include/vrtx/syscall.h	(revision 1440)
+++ include/vrtx/syscall.h	(working copy)
@@ -103,10 +103,6 @@ void vrtxsys_cleanup(void);
 }
 #endif
 
-#elif !defined(__XENO_SIM__)
-
-#include <nucleus/bind.h>
-
 #endif /* __KERNEL__ */
 
 #endif /* _XENO_VRTX_SYSCALL_H */
Index: include/rtdm/syscall.h
===================================================================
--- include/rtdm/syscall.h	(revision 1440)
+++ include/rtdm/syscall.h	(working copy)
@@ -55,10 +55,6 @@ static inline void rtdm_syscall_cleanup(
 }
 #endif
 
-#elif !defined(__XENO_SIM__)
-
-#include <nucleus/bind.h>
-
 #endif /* __KERNEL__ */
 
 #endif /* _RTDM_SYSCALL_H */
Index: include/nucleus/Makefile.in
===================================================================
--- include/nucleus/Makefile.in	(revision 1440)
+++ include/nucleus/Makefile.in	(working copy)
@@ -219,7 +219,6 @@ target_vendor = @target_vendor@
 include_HEADERS = \
 	assert.h \
 	bheap.h \
-	bind.h \
 	compiler.h \
 	core.h \
 	heap.h \
Index: include/nucleus/bind.h
===================================================================
--- include/nucleus/bind.h	(revision 1440)
+++ include/nucleus/bind.h	(working copy)
@@ -1,135 +0,0 @@
-#ifndef _XENO_NUCLEUS_BIND_H
-#define _XENO_NUCLEUS_BIND_H
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <signal.h>
-#include <pthread.h>
-#include <asm/xenomai/syscall.h>
-
-__attribute__ ((weak))
-int xeno_sigxcpu_no_mlock = 1;
-
-static void xeno_handle_mlock_alert(int sig)
-{
-	struct sigaction sa;
-
-	if (xeno_sigxcpu_no_mlock) {
-		fprintf(stderr,
-			"Xenomai: process memory not locked (missing mlockall?)\n");
-		fflush(stderr);
-		exit(4);
-	}
-
-	/* XNTRAPSW was set for the thread but no user-defined handler
-	   has been set to override our internal handler, so let's
-	   invoke the default signal action. */
-
-	sa.sa_handler = SIG_DFL;
-	sigemptyset(&sa.sa_mask);
-	sa.sa_flags = 0;
-	sigaction(SIGXCPU, &sa, NULL);
-	pthread_kill(pthread_self(), SIGXCPU);
-}
-
-static inline int
-xeno_bind_skin(unsigned skin_magic, const char *skin, const char *module)
-{
-	struct sigaction sa;
-	xnfeatinfo_t finfo;
-	int muxid;
-
-#ifdef xeno_arch_features_check
-	xeno_arch_features_check();
-#endif /* xeno_arch_features_check */
-
-	muxid = XENOMAI_SYSBIND(skin_magic,
-				XENOMAI_FEAT_DEP, XENOMAI_ABI_REV, &finfo);
-	switch (muxid) {
-	case -EINVAL:
-
-		fprintf(stderr, "Xenomai: incompatible feature set\n");
-		fprintf(stderr,
-			"(required=\"%s\", present=\"%s\", missing=\"%s\").\n",
-			finfo.feat_man_s, finfo.feat_all_s, finfo.feat_mis_s);
-		exit(1);
-
-	case -ENOEXEC:
-
-		fprintf(stderr, "Xenomai: incompatible ABI revision level\n");
-		fprintf(stderr, "(needed=%lu, current=%lu).\n",
-			XENOMAI_ABI_REV, finfo.abirev);
-		exit(1);
-
-	case -ENOSYS:
-	case -ESRCH:
-
-		fprintf(stderr,
-			"Xenomai: %s skin or CONFIG_XENO_OPT_PERVASIVE disabled.\n"
-			"(modprobe %s?)\n", skin, module);
-		exit(1);
-	}
-
-	if (muxid < 0) {
-		fprintf(stderr, "Xenomai: binding failed: %s.\n",
-			strerror(-muxid));
-		exit(1);
-	}
-
-	/* Install a SIGXCPU handler to intercept alerts about unlocked
-	   process memory. */
-
-	sa.sa_handler = &xeno_handle_mlock_alert;
-	sigemptyset(&sa.sa_mask);
-	sa.sa_flags = 0;
-	sigaction(SIGXCPU, &sa, NULL);
-
-	return __xn_mux_shifted_id(muxid);
-}
-
-static inline int
-xeno_bind_skin_opt(unsigned skin_magic, const char *skin, const char *module)
-{
-	xnfeatinfo_t finfo;
-	int muxid;
-
-#ifdef xeno_arch_features_check
-	xeno_arch_features_check();
-#endif /* xeno_arch_features_check */
-
-	muxid = XENOMAI_SYSBIND(skin_magic,
-				XENOMAI_FEAT_DEP, XENOMAI_ABI_REV, &finfo);
-	switch (muxid) {
-	case -EINVAL:
-
-		fprintf(stderr, "Xenomai: incompatible feature set\n");
-		fprintf(stderr,
-			"(required=\"%s\", present=\"%s\", missing=\"%s\").\n",
-			finfo.feat_man_s, finfo.feat_all_s, finfo.feat_mis_s);
-		exit(1);
-
-	case -ENOEXEC:
-
-		fprintf(stderr, "Xenomai: incompatible ABI revision level\n");
-		fprintf(stderr, "(needed=%lu, current=%lu).\n",
-			XENOMAI_ABI_REV, finfo.abirev);
-		exit(1);
-
-	case -ENOSYS:
-	case -ESRCH:
-
-		return -1;
-	}
-
-	if (muxid < 0) {
-		fprintf(stderr, "Xenomai: binding failed: %s.\n",
-			strerror(-muxid));
-		exit(1);
-	}
-
-	return __xn_mux_shifted_id(muxid);
-}
-
-#endif /* _XENO_NUCLEUS_BIND_H */
Index: include/nucleus/Makefile.am
===================================================================
--- include/nucleus/Makefile.am	(revision 1440)
+++ include/nucleus/Makefile.am	(working copy)
@@ -3,7 +3,6 @@ includedir = $(prefix)/include/nucleus
 include_HEADERS = \
 	assert.h \
 	bheap.h \
-	bind.h \
 	compiler.h \
 	core.h \
 	heap.h \

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-08-15 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-15 14:39 [Xenomai-core] [PATCH] refactor skin bind headers Jan Kiszka
2006-08-15 15:00 ` [Xenomai-core] " Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.