All of lore.kernel.org
 help / color / mirror / Atom feed
From: Niklaus Giger <niklaus.giger@domain.hid>
To: xenomai@xenomai.org
Subject: [Xenomai-help] Cleanup after using the vxWorks skin?
Date: Sat, 21 Oct 2006 16:28:20 +0200	[thread overview]
Message-ID: <200610211628.21249.niklaus.giger@domain.hid> (raw)

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

-- 
Niklaus Giger


             reply	other threads:[~2006-10-21 14:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-21 14:28 Niklaus Giger [this message]
2006-10-21 14:52 ` [Xenomai-help] Cleanup after using the vxWorks skin? Philippe Gerum
2006-10-21 15:08   ` Niklaus Giger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200610211628.21249.niklaus.giger@domain.hid \
    --to=niklaus.giger@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.