Cleanup after using the vxWorks skin?
Hi
I run a program using the vxworks skin from user space. As did hang, I typed "Ctrl-C" to end the program.
Looking at /proc/xenomai/registry/vxworks/semaphores/ I remarked however, that there were still vxworks semaphores open, which had not been deleted.
Is it up to the programmer to clean up at exit? Or is this a bug in the current Xenomai implementation?
My test program looks like this:
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "vxworks/vxworks.h"
extern "C" int root_thread_init();
extern "C" void root_thread_exit(void);
int main (int argc, char *argv[])
{
int tid;
mlockall(MCL_CURRENT|MCL_FUTURE);
atexit(&root_thread_exit);
tid = taskSpawn("root", 10, 0, 32*1024, (FUNCPTR) root_thread_init, 1,2,3,4,5,6,7,8,9,10);
if (tid > 0) pause();
return 1;
}
extern "C" void root_thread_exit(void)
{
printf("%s: task %d\n", __FUNCTION__, taskIdSelf());
}
extern "C" int root_thread_init()
{ const char* arg="";
const char* argv[2];
argv[0] = "undefined";
argv[1] = arg;
int argc = sizeof(argv) / sizeof(char*);
int semId1 = semCCreate(SEM_Q_PRIORITY, 3);
int semId3 = semMCreate(SEM_Q_PRIORITY | SEM_INVERSION_SAFE ); printf("proc %s: task %d %s \n", __FUNCTION__, taskIdSelf(), taskName(taskIdSelf()));
taskDelay(sysClkRateGet());
printf("proc %s: task %d shutting down\n", __FUNCTION__, taskIdSelf()); // return 0;
exit(0);
}
Best regards
Signature · 1 line
Niklaus Giger
Quoted 11 lines · Niklaus Giger
Hi
I run a program using the vxworks skin from user space. As did hang, I typed "Ctrl-C" to end the program.
Looking at
/proc/xenomai/registry/vxworks/semaphores/I remarked however, that there were still vxworks semaphores open, which had not been deleted.Is it up to the programmer to clean up at exit? Or is this a bug in the current Xenomai implementation?
It's not a bug, but rather a limitation. We don't currently support auto-cleanup of objects in the VxWorks skin.
Signature · 1 line
Philippe.
Am Samstag, 21. Oktober 2006 16:52 schrieb Philippe Gerum:
Quoted 10 lines · Niklaus Giger
Quoted 9 lines
Hi
I run a program using the vxworks skin from user space. As did hang, I typed "Ctrl-C" to end the program.
Looking at
/proc/xenomai/registry/vxworks/semaphores/I remarked however, that there were still vxworks semaphores open, which had not been deleted.
Quoted 5 lines
Quoted 2 lines
Is it up to the programmer to clean up at exit? Or is this a bug in the current Xenomai implementation?
It's not a bug, but rather a limitation. We don't currently support auto-cleanup of objects in the VxWorks skin.
Though what about applying a small patch like this?
txt/vxworks-skin.txt (Arbeitskopie) renamed from txt/vxworks-skin.txt (Revision 1738) +3 -0
@@ -104,6 +104,9 @@ taskDelete() which might need to wait for the deleted task to exit a safe section (taskSafe/taskUnsafe) before proceeding. +- There is currently no support for auto-cleanup of objects in the VxWorks + skin. + Module parameters =================
Best regards
Signature · 1 line
Niklaus Giger