All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: jay@domain.hid
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] cannot make system() calls anymore
Date: Fri, 11 Jan 2008 19:22:19 +0100	[thread overview]
Message-ID: <4787B3DB.5010507@domain.hid> (raw)
In-Reply-To: <d3623eab0801110806y75b51c1kc31efe7d357de522@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 3189 bytes --]

Jerome Pasquero wrote:
> Hi,
> 
> I recently upgraded from xenomai 2.3.0 under linux 2.6.17.14 to the latest
> stable version of xenomai 2.4.1 under linux 2.6.23.12.
> Everything seems to be working just fine, except that I seem to  no longer
> be able to make system calls inside a real-time task. It simply freezes
> everything and I need to restart my computer.
> I don't know if it was just a fluke that it was working with 2.3.0 and that
> I am not supposed to do that at all. Could it be that I forgot to include an
> option when recompiling the kernel?

A system freeze is not a valid reaction of Xenomai on invalid user 
activity - unless that freeze just means one of your high-prio tasks 
decided to enter an endless loop. Have you already tried to enable the 
Xenomai watchdog?

> 
> Note that I have no problem making system calls from outside a real time
> task (for instance, right before a rt_task_shadow() call).
> Also, it seems that the problem only occurs when other libraries are used.
> For instance, if one compiles the code below with no other libraries than
> the xenomai libs (and stdc++), it works just fine:
> gcc  `/usr/xenomai/bin/xeno-config --xeno-cflags`
> `/usr/xenomai/bin/xeno-config --xeno-ldflags` -lstdc++ -lnative main.cpp
> 
> However, as soon as I add the libxml2 library, it crashes:
> gcc  -D_GNU_SOURCE -D_REENTRANT -D__XENO__  -I/usr/include/libxml2
> -I/usr/xenomai-2.4.1/include  -L/usr/local/lib -L/usr/xenomai-2.4.1/lib
> -lxml2 -lnative -lpthread `/usr/xenomai/bin/xeno-config --xeno-cflags`
> `/usr/xenomai/bin/xeno-config --xeno-ldflags` -lstdc++ -lnative main.cp
> 
> This is true with other libraries as well (e.g. gsl lib) but not of all
> libraries (for instance, it seems to work with the math library i.e. -lm)
> 
> Am I doing something wrong?
> In case you were wondering, I want to be able to make system calls from
> inside real time threads cause I want to load/unload realtime modules
> directly from my application. In the code snippet below, I am simply trying
> to do a  'ls'  command to keep it as simple as possible.

Thanks for the demo. This one already bricks your box? But only when 
linked against libxml?

> 
> Thanks for your help in advance.
> 
> 
> #include <iostream>
> #include <sys/mman.h>
> #include <signal.h>
> #include <native/mutex.h>
> #include <native/timer.h>
> #include <native/task.h>
> 
> void cleanup(int unused)
> {
>     // delete current task
>     rt_task_delete(NULL);
> }
> 
> int main(int argc, char *argv[])
> {
>     signal(SIGABRT, cleanup);
>     signal(SIGKILL, cleanup);
>     signal(SIGINT, cleanup);
>     signal(SIGTERM, cleanup);
>     signal(SIGHUP, cleanup);
>     signal(SIGALRM, cleanup);
> 
> 
>     RT_TASK mainTask;
> 
>     mlockall(MCL_CURRENT | MCL_FUTURE);
>     rt_task_shadow(&mainTask, "gui", 50, T_FPU);
> 
>     rt_task_sleep((RTIME) 1E9);
> 
>     system("ls"); // this is what causes the problem...

Ah, you mean "system" with system call - or actually any call of 
Standard-Linux kernel services?

In any case, let's first check for runaway threads with the watchdog.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2008-01-11 18:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d3623eab0801110744y63764ba2sb122db96a85bde80@domain.hid>
2008-01-11 16:06 ` [Xenomai-help] cannot make system() calls anymore Jerome Pasquero
2008-01-11 18:22   ` Jan Kiszka [this message]
2008-01-11 18:29     ` Gilles Chanteperdrix
2008-01-12 13:20       ` Jan Kiszka
2008-01-12 16:25         ` Philippe Gerum
2008-01-11 22:33     ` Jerome Pasquero

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=4787B3DB.5010507@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=jay@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.