Skip to content

Commit faa6cf6

Browse files
committed
EVL: Nicer detection
1 parent a761e75 commit faa6cf6

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/rtapi/uspace_common.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -381,24 +381,28 @@ static int detect_rtai() {
381381
}
382382
#endif
383383
#ifdef USPACE_XENOMAI
384-
static int detect_xenomai_evl() {
385-
struct utsname u;
386-
uname(&u);
387-
return strcasestr (u.release, "-xenomai4") != 0; //ToDo: This is not nice
388-
}
389384
static int detect_xenomai() {
390-
struct utsname u;
391-
uname(&u);
392-
return strcasestr (u.release, "-xenomai3") != 0; //ToDo: This is not nice
385+
struct stat sb;
386+
//Running xenomai has /proc/xenomai
387+
return stat("/proc/xenomai", &sb) == 0;
393388
}
394389
#else
395-
static int detect_xenomai_evl() {
390+
static int detect_xenomai() {
396391
return 0;
397392
}
398-
static int detect_xenomai() {
393+
#endif
394+
#ifdef USPACE_XENOMAI_EVL
395+
static int detect_xenomai_evl() {
396+
struct stat sb;
397+
//Running xenomai evl has /dev/evl but no /proc/xenomai
398+
return stat("/dev/evl", &sb) == 0;
399+
}
400+
#else
401+
static int detect_xenomai_evl() {
399402
return 0;
400403
}
401404
#endif
405+
402406
static int detect_env_override() {
403407
char *p = getenv("LINUXCNC_FORCE_REALTIME");
404408
return p != NULL && atoi(p) != 0;

src/rtapi/uspace_xenomai_evl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,6 @@ pthread_key_t XenomaiApp::key;
221221
extern "C" RtapiApp *make();
222222

223223
RtapiApp *make() {
224-
rtapi_print_msg(RTAPI_MSG_ERR, "Note: Using XENOMAI4 EVL (posix-skin) realtime\n");
224+
rtapi_print_msg(RTAPI_MSG_ERR, "Note: Using XENOMAI4 EVL realtime\n");
225225
return new XenomaiApp;
226226
}

0 commit comments

Comments
 (0)