--posix-ldflags and rt_task_shadow() of main
Hallo,
I have a following question :
I have an executable linked linked with
xeno-config --posix-ldflags
so depends on :
libpthread_rt.so.1
If I want to turn my main function into a realtime task with rt_task_shadow like code sample below, EBUSY is returned and I get the message :
rt_task_shadow() failed: Device or resource busy.
This would mean that my main task is already a realtime task and I don't have to call rt_task_shadow anymore. Is this correct ? It seems very strange to me and I didn't find any documentation which confirms that if you link with posix-flags your main thread is automatically realtime.
I don't get this message if I link with the xeno-config --xeno-ldflags, but the reason that I want to link with the posix flags is that I also use the shm_open function in my binary.
Below a code sample.
Frederik
int main()
{
mlockall(MCL_CURRENT | MCL_FUTURE);
if ((err = rt_task_shadow(&this_task, "Model:" QUOTE(MODEL), 1, T_FPU)) != 0)
printf("rt_task_shadow() failed: %s.\n", strerror(-err));}
Quoted 16 lines · Frederik Bayart
Hallo,
I have a following question :
I have an executable linked linked with
xeno-config --posix-ldflagsso depends on :
libpthread_rt.so.1If I want to turn my main function into a realtime task with
rt_task_shadowlike code sample below, EBUSY is returned and I get the message :
rt_task_shadow()failed: Device or resource busy.
Quoted 8 lines
This would mean that my main task is already a realtime task and I don't have to call
rt_task_shadowanymore. Is this correct ? It seems very strange to me and I didn't find any documentation which confirms that if you link with posix-flags your main thread is automatically realtime.I don't get this message if I link with the xeno-config --xeno-ldflags, but the reason that I want to link with the posix flags is that I also use the
shm_openfunction in my binary.
You are correct, the main thread is automatically shadowed by the POSIX skin library. This makes things much more consistent, and simplifies the user experience: an applications using the POSIX API continues to compile and to work without further changes with Xenomai posix skin, automatically using Xenomai posix skin services when they exist.
You can disable this behaviour with the configure --enable-dlopen option.
Note that POSIX skin shared memory services are only useful to share memory between kernel and user-space using the posix API. If you want to share memory between user-space real-time applications, you can simply use the libc shared memory services.
Signature · 1 line
Gilles.