load librtdm without xeno_rtdm
PATCH 1/1 load librtdm without xeno_rtdm
Hi,
as suggested in an earlier mail, here is a patch that - as I think - improves the behaviour of librtdm. It will let applications start even if the kernel services of RTDM are not available. Instead, -ENODEV or -EAFNOSUPPORT will be returned in this case when the user tries to open some device or socket later - just like there is no appropriate driver loaded, which is actually true!
Please apply.
Jan
skins/rtdm/core.c +16 -9
@@ -18,6 +18,7 @@#include <stdarg.h> #include <stddef.h> +#include <errno.h> #include <xenomai/rtdm/rtdm.h> #include <xenomai/rtdm/syscall.h>
@@ -27,19 +28,25 @@int rt_dev_open (const char *path,int oflag, ...) { -return XENOMAI_SKINCALL2 ( __rtdm_muxid, - __rtdm_open, - path, - oflag); +if (__rtdm_muxid <0 ) +return -ENODEV ; + +return XENOMAI_SKINCALL2 ( __rtdm_muxid, + __rtdm_open, + path, + oflag); }int rt_dev_socket (int protocol_family,int socket_type,int protocol) { -return XENOMAI_SKINCALL3 ( __rtdm_muxid, - __rtdm_socket, - protocol_family, - socket_type, - protocol); +if (__rtdm_muxid <0 ) +return -EAFNOSUPPORT ; + +return XENOMAI_SKINCALL3 ( __rtdm_muxid, + __rtdm_socket, + protocol_family, + socket_type, + protocol); }int rt_dev_close (int fd)
skins/rtdm/init.c +3 -3
@@ -53,9 +53,9 @@case -ENOSYS :case -ESRCH : -fprintf (stderr,"Xenomai: RTDM skin or CONFIG_XENO_OPT_PERVASIVE disabled.\n" ); -fprintf (stderr,"(modprobe xeno_rtdm.ko?)\n" ); -exit (1 ); +/* we ignore this and fail later when the user tries to open +a device or socket. */ +break ;default :
Philippe Gerum
AppliedQuoted 10 lines · Jan Kiszka
Hi,
as suggested in an earlier mail, here is a patch that - as I think - improves the behaviour of librtdm. It will let applications start even if the kernel services of RTDM are not available. Instead,
-ENODEVor-EAFNOSUPPORTwill be returned in this case when the user tries to open some device or socket later - just like there is no appropriate driver loaded, which is actually true!Please apply.
Applied, thanks.
Quoted 78 lines
Jan
------------------------------------------------------------------------
Index:
src/skins/rtdm/core.c
===================================================================skins/rtdm/core.c +16
-9@@ -18,6 +18,7 @@#include <stdarg.h> #include <stddef.h> +#include <errno.h> #include <xenomai/rtdm/rtdm.h> #include <xenomai/rtdm/syscall.h> @@ -27,19 +28,25 @@int rt_dev_open (const char *path,int oflag, ...) { -return XENOMAI_SKINCALL2 ( __rtdm_muxid, - __rtdm_open, - path, - oflag); +if (__rtdm_muxid <0 ) +return -ENODEV ; + +return XENOMAI_SKINCALL2 ( __rtdm_muxid, + __rtdm_open, + path, + oflag); }int rt_dev_socket (int protocol_family,int socket_type,int protocol) { -return XENOMAI_SKINCALL3 ( __rtdm_muxid, - __rtdm_socket, - protocol_family, - socket_type, - protocol); +if (__rtdm_muxid <0 ) +return -EAFNOSUPPORT ; + +return XENOMAI_SKINCALL3 ( __rtdm_muxid, + __rtdm_socket, + protocol_family, + socket_type, + protocol); }int rt_dev_close (int fd)Index:
src/skins/rtdm/init.c
===================================================================skins/rtdm/init.c +3
-4@@ -53,9 +53,9 @@case -ENOSYS :case -ESRCH : -fprintf (stderr,"Xenomai: RTDM skin or CONFIG_XENO_OPT_PERVASIVE disabled.\n" ); -fprintf (stderr,"(modprobe xeno_rtdm.ko?)\n" ); -exit (1 ); +/* we ignore this and fail later when the user tries to open +a device or socket. */ +break ;default : ------------------------------------------------------------------------_______________________________________________
Xenomai-core mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-core
Signature · 1 line
Philippe.