refactor skin bind headers
PATCH 1/1 refactor skin bind headers
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
ChangeLog +6 -0
@@ -1,3 +1,9 @@ +2006-08-15 Jan Kiszka <[email protected]> + + * 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 <[email protected]> * ksrc/drivers/{serial,Kconfig,Config.in,Makefile},
skins/rtai/init.c +2 -0
@@ -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 ;
skins/posix/init.c +2 -0
@@ -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 ;
skins/vxworks/init.c +2 -0
@@ -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;
skins/vrtx/init.c +2 -0
@@ -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;
skins/native/init.c +2 -0
@@ -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;
skins/rtdm/init.c +1 -0
@@ -21,6 +21,7 @@#include <stdlib.h> #include <string.h> #include <rtdm/syscall.h> +#include <asm-generic/bits/bind.h> int __rtdm_muxid =-1 ;
vxworks/syscall.h +0 -4
@@ -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 */
native/syscall.h +0 -4
@@ -143,10 +143,6 @@ void __native_syscall_cleanup(void); }#endif -#elif !defined(__XENO_SIM__) - -#include <nucleus/bind.h> -#endif /* __KERNEL__ */ #endif /* _NATIVE_SYSCALL_H */
asm-generic/bits/Makefile.in +7 -1
@@ -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:
asm-generic/bits/bind.h +4 -28
@@ -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 */
asm-generic/bits/mlock_alert.h +35 -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 */
asm-generic/bits/Makefile.am +6 -1
@@ -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
rtai/syscall.h +0 -4
@@ -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 */
posix/syscall.h +0 -4
@@ -114,10 +114,6 @@ void pse51_syscall_cleanup(void); }#endif -#elif !defined(__XENO_SIM__) - -#include <nucleus/bind.h> -#endif /* __KERNEL__ */ #endif /* _POSIX_SYSCALL_H */
vrtx/syscall.h +0 -4
@@ -103,10 +103,6 @@ void vrtxsys_cleanup(void); }#endif -#elif !defined(__XENO_SIM__) - -#include <nucleus/bind.h> -#endif /* __KERNEL__ */ #endif /* _XENO_VRTX_SYSCALL_H */
rtdm/syscall.h +0 -4
@@ -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 */
nucleus/Makefile.in +0 -1
@@ -219,7 +219,6 @@ target_vendor = @target_vendor@ include_HEADERS = \ assert.h \ bheap.h \ - bind.h \ compiler.h \ core.h \ heap.h \
nucleus/bind.h +0 -135
135 lines not on this page · raw message
nucleus/Makefile.am +0 -1
@@ -3,7 +3,6 @@ includedir = $(prefix)/include/nucleus include_HEADERS = \ assert.h \ bheap.h \ - bind.h \ compiler.h \ core.h \ heap.h \
Philippe Gerum
AppliedQuoted 6 lines · Jan Kiszka
As discussed in the buildbot thread, here comes a second try to refactor the skin binding headers. Basically,
nucleus/bind.his 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.
Merged, thanks.
Quoted 472 lines
Jan
plain text document attachment (refactor-skin-bind-headers.patch)
Index: ChangeLog
===================================================================ChangeLog +6
-0@@ -1,3 +1,9 @@ +2006-08-15 Jan Kiszka <[email protected]> + + * 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 <[email protected]> * ksrc/drivers/{serial,Kconfig,Config.in,Makefile},Index:
src/skins/rtai/init.c
===================================================================skins/rtai/init.c +2
-0@@ -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
===================================================================skins/posix/init.c +2
-0@@ -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
===================================================================skins/vxworks/init.c +2
-0@@ -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
===================================================================skins/vrtx/init.c +2
-0@@ -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
===================================================================skins/native/init.c +2
-0@@ -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
===================================================================skins/rtdm/init.c +1
-0@@ -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
===================================================================vxworks/syscall.h +0
-4@@ -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
===================================================================native/syscall.h +0
-4@@ -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
===================================================================asm-generic/bits/Makefile.in +7
-1@@ -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
===================================================================asm-generic/bits/bind.h +4
-28@@ -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
===================================================================asm-generic/bits/mlock_alert.h +35
-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
===================================================================asm-generic/bits/Makefile.am +6
-1@@ -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.hIndex:
include/rtai/syscall.h
===================================================================rtai/syscall.h +0
-4@@ -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
===================================================================posix/syscall.h +0
-4@@ -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
===================================================================vrtx/syscall.h +0
-4@@ -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
===================================================================rtdm/syscall.h +0
-4@@ -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
===================================================================nucleus/Makefile.in +0
-1@@ -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
===================================================================nucleus/bind.h +0
-135@@ -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
===================================================================nucleus/Makefile.am +0
-1@@ -3,7 +3,6 @@ includedir = $(prefix)/include/nucleus include_HEADERS = \ assert.h \ bheap.h \ - bind.h \ compiler.h \ core.h \ heap.h \
Signature · 1 line
Philippe.