From mboxrd@z Thu Jan 1 00:00:00 1970 From: Philippe Gerum In-Reply-To: <44E1DC94.1070908@domain.hid> References: <44E1DC94.1070908@domain.hid> Content-Type: text/plain Date: Tue, 15 Aug 2006 17:00:58 +0200 Message-Id: <1155654058.4327.42.camel@domain.hid> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Xenomai-core] Re: [PATCH] refactor skin bind headers Reply-To: rpm@xenomai.org List-Id: "Xenomai life and development \(bug reports, patches, discussions\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: xenomai-core On Tue, 2006-08-15 at 16:39 +0200, Jan Kiszka wrote: > 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. > Merged, thanks. > Jan > plain text document attachment (refactor-skin-bind-headers.patch) > Index: ChangeLog > =================================================================== > --- ChangeLog (revision 1440) > +++ ChangeLog (working copy) > @@ -1,3 +1,9 @@ > +2006-08-15 Jan Kiszka > + > + * include/asm-generic/bits/{bind.h,mlock_alert.h}, > + include//syscall.h, src/skins//init.c: Split up > + include/nucleus/bind.h and move the fragments to asm-generic/bits. > + > 2006-08-14 Jan Kiszka > > * 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 > #include > #include > +#include > +#include > > 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 > #include > #include > +#include > +#include > > 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 > #include > #include > +#include > +#include > > 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 > #include > #include > +#include > +#include > > 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 > #include > #include > +#include > +#include > > 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 > #include > #include > +#include > > 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 > - > #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 > - > #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 > #include > #include > #include > #include > -#include > #include > > -__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 > +#include > +#include > +#include > + > +__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 > - > #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 > - > #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 > - > #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 > - > #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 > -#include > -#include > -#include > -#include > -#include > -#include > - > -__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 \ -- Philippe.