Module: xenomai-jki Branch: for-upstream Commit: 45378a6fc17ad9db375de73578b2a9e0072c6b9c URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=45378a6fc17ad9db375de73578b2a9e0072c6b9c
Author: Jan Kiszka <jan.kis...@siemens.com> Date: Tue Apr 20 01:19:08 2010 +0200 RTDM: Restrict use of rtdm_rt_capable To avoid use of this service in meaningless contexts, force the user to pass user_info that comes with handler invocations and catch calls over async contexts. Also drop the module init/cleanup as valid context from the doc. Signed-off-by: Jan Kiszka <jan.kis...@siemens.com> --- include/rtdm/rtdm_driver.h | 7 +++++-- ksrc/skins/rtdm/drvlib.c | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/rtdm/rtdm_driver.h b/include/rtdm/rtdm_driver.h index 1a4097b..600516f 100644 --- a/include/rtdm/rtdm_driver.h +++ b/include/rtdm/rtdm_driver.h @@ -1329,9 +1329,12 @@ static inline int rtdm_in_rt_context(void) return (rthal_current_domain != rthal_root_domain); } -static inline int rtdm_rt_capable(void) +static inline int rtdm_rt_capable(rtdm_user_info_t *user_info) { - return (!xnpod_root_p() || xnshadow_thread(current) != NULL); + XENO_ASSERT(RTDM, !xnpod_asynch_p(), return 0;); + + return (!xnpod_root_p() || + (user_info && xnshadow_thread(user_info) != NULL)); } #endif /* !DOXYGEN_CPP */ diff --git a/ksrc/skins/rtdm/drvlib.c b/ksrc/skins/rtdm/drvlib.c index 6e26501..68a661c 100644 --- a/ksrc/skins/rtdm/drvlib.c +++ b/ksrc/skins/rtdm/drvlib.c @@ -2344,6 +2344,9 @@ int rtdm_in_rt_context(void); /** * Test if the caller is capable of running in real-time context * + * @param[in] user_info User information pointer as passed to the invoked + * device operation handler + * * @return Non-zero is returned if the caller is able to execute in real-time * context (independent of its current execution mode), 0 otherwise. * @@ -2358,13 +2361,12 @@ int rtdm_in_rt_context(void); * * This service can be called from: * - * - Kernel module initialization/cleanup code * - Kernel-based task * - User-space task (RT, non-RT) * * Rescheduling: never. */ -int rtdm_rt_capable(void); +int rtdm_rt_capable(rtdm_user_info_t *user_info); #endif /* DOXYGEN_CPP */ _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git