11#include " config.h"
22#include " rtapi.h"
33#include " rtapi_uspace.hh"
4+
5+ #include < sched.h>
6+
7+ #include < evl/thread.h>
8+ #include < evl/timer.h>
9+ #include < evl/clock.h>
10+ #include < evl/proxy.h>
11+
12+ #include < error.h> // ToDo: Remove
13+
414#include < pthread.h>
5- #include < errno.h>
15+ #include < errno.h>
616#include < stdio.h>
717#include < cstring>
818#ifdef HAVE_SYS_IO_H
@@ -57,6 +67,10 @@ struct XenomaiApp : RtapiApp {
5767 int nprocs = sysconf ( _SC_NPROCESSORS_ONLN );
5868 CPU_SET (nprocs-1 , &cpuset); // assumes processor numbers are contiguous
5969
70+ fprintf (stderr,
71+ " Start. getuid()=%d geteuid()=%d\n " ,
72+ getuid (), geteuid ());
73+
6074 int ret;
6175 pthread_attr_t attr;
6276 if ((ret = pthread_attr_init (&attr)) != 0 )
@@ -82,6 +96,17 @@ struct XenomaiApp : RtapiApp {
8296 auto task = reinterpret_cast <RtaiTask*>(arg);
8397 pthread_setspecific (key, arg);
8498
99+ fprintf (stderr,
100+ " Wrapper. getuid()=%d geteuid()=%d\n " ,
101+ getuid (), geteuid ());
102+
103+ /* Attach to the core. */
104+ rtapi_print (" linuxcnc-thread:%d\n " , gettid ());
105+ int tfd = evl_attach_self (" linuxcnc-thread:%d" , gettid ());
106+ if (tfd < 0 ){
107+ rtapi_print (" evl_attach_self() failed ret %i errno %i\n " , tfd, errno);
108+ }
109+
85110 struct timespec now;
86111 clock_gettime (CLOCK_MONOTONIC, &now);
87112
@@ -194,6 +219,6 @@ pthread_key_t XenomaiApp::key;
194219extern " C" RtapiApp *make ();
195220
196221RtapiApp *make () {
197- rtapi_print_msg (RTAPI_MSG_ERR, " Note: Using XENOMAI (posix-skin) realtime\n " );
222+ rtapi_print_msg (RTAPI_MSG_ERR, " Note: Using XENOMAI4 EVL (posix-skin) realtime\n " );
198223 return new XenomaiApp;
199224}
0 commit comments