* Re: [Xenomai-core] system() question
2007-02-07 16:09 [Xenomai-core] system() question Stéphane ANCELOT
@ 2007-02-07 15:40 ` Gilles Chanteperdrix
2007-02-08 8:39 ` Stéphane ANCELOT
0 siblings, 1 reply; 7+ messages in thread
From: Gilles Chanteperdrix @ 2007-02-07 15:40 UTC (permalink / raw)
To: Stéphane ANCELOT; +Cc: xenomai-core
Stéphane ANCELOT wrote:
> Is there a way to launch my realtime task from another linux program
> using system() C call ?
>
> I have tried it , but when system call dies my rt task dies too ...
> any idea ?
Why does the system call die ? Do you observe the same behaviour with
non xenomai applications ?
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Xenomai-core] system() question
@ 2007-02-07 16:09 Stéphane ANCELOT
2007-02-07 15:40 ` Gilles Chanteperdrix
0 siblings, 1 reply; 7+ messages in thread
From: Stéphane ANCELOT @ 2007-02-07 16:09 UTC (permalink / raw)
To: xenomai-core
Is there a way to launch my realtime task from another linux program
using system() C call ?
I have tried it , but when system call dies my rt task dies too ...
any idea ?
steph
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-core] system() question
2007-02-08 8:39 ` Stéphane ANCELOT
@ 2007-02-08 8:18 ` Gilles Chanteperdrix
2007-02-09 14:50 ` Stéphane ANCELOT
0 siblings, 1 reply; 7+ messages in thread
From: Gilles Chanteperdrix @ 2007-02-08 8:18 UTC (permalink / raw)
To: Stéphane ANCELOT; +Cc: xenomai-core
Stéphane ANCELOT wrote:
> my linux user task uses a system() call in order to call a bash script
> to restart the realtime task as follow :
>
> user interface C call :
> system("restart_task.sh");
> give back hand to user interface
> ....
>
>
>
>
> bash script restart_task.sh :
> killall -15 mytask
> sleep 2
> mytask &
>
>
> system call dies because sh script has been launched
Try calling daemon(0,0) in mytask instead of using "&" to make it run in
the background.
--
Gilles Chanteperdrix.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-core] system() question
2007-02-07 15:40 ` Gilles Chanteperdrix
@ 2007-02-08 8:39 ` Stéphane ANCELOT
2007-02-08 8:18 ` Gilles Chanteperdrix
0 siblings, 1 reply; 7+ messages in thread
From: Stéphane ANCELOT @ 2007-02-08 8:39 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai-core
my linux user task uses a system() call in order to call a bash script
to restart the realtime task as follow :
user interface C call :
system("restart_task.sh");
give back hand to user interface
....
bash script restart_task.sh :
killall -15 mytask
sleep 2
mytask &
system call dies because sh script has been launched
Gilles Chanteperdrix wrote:
> Stéphane ANCELOT wrote:
>> Is there a way to launch my realtime task from another linux program
>> using system() C call ?
>>
>> I have tried it , but when system call dies my rt task dies too ...
>> any idea ?
>
> Why does the system call die ? Do you observe the same behaviour with
> non xenomai applications ?
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-core] system() question
2007-02-09 14:50 ` Stéphane ANCELOT
@ 2007-02-09 13:59 ` Gilles Chanteperdrix
2007-02-09 14:33 ` Gilles Chanteperdrix
0 siblings, 1 reply; 7+ messages in thread
From: Gilles Chanteperdrix @ 2007-02-09 13:59 UTC (permalink / raw)
To: Stéphane ANCELOT; +Cc: xenomai-core
Stéphane ANCELOT wrote:
> I tried it, but did not help, I manged to do the trick using
> start-stop-daemon
If I understand correctly the problem you have, it is not related at all
with Xenomai. What you want is to make your application a real daemon.
The easy way to do this is to call the glibc function named "daemon" the
hard way is to call fork twice, call setsid and setpgrp.
start-stop-daemon will not do the trick.
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-core] system() question
2007-02-09 13:59 ` Gilles Chanteperdrix
@ 2007-02-09 14:33 ` Gilles Chanteperdrix
0 siblings, 0 replies; 7+ messages in thread
From: Gilles Chanteperdrix @ 2007-02-09 14:33 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai-core
Gilles Chanteperdrix wrote:
> Stéphane ANCELOT wrote:
>
>>I tried it, but did not help, I manged to do the trick using
>>start-stop-daemon
>
>
> If I understand correctly the problem you have, it is not related at all
> with Xenomai. What you want is to make your application a real daemon.
> The easy way to do this is to call the glibc function named "daemon" the
> hard way is to call fork twice, call setsid and setpgrp.
> start-stop-daemon will not do the trick.
>
It is enough to fork only once, to call setsid in the child and call
_exit in the father. That is what the daemon function does. Anyway, this
is basic unix knowledge, for which you will get more acurate details at
other places.
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-core] system() question
2007-02-08 8:18 ` Gilles Chanteperdrix
@ 2007-02-09 14:50 ` Stéphane ANCELOT
2007-02-09 13:59 ` Gilles Chanteperdrix
0 siblings, 1 reply; 7+ messages in thread
From: Stéphane ANCELOT @ 2007-02-09 14:50 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai-core
I tried it, but did not help, I manged to do the trick using
start-stop-daemon
Gilles Chanteperdrix wrote:
> Stéphane ANCELOT wrote:
> > my linux user task uses a system() call in order to call a bash script
> > to restart the realtime task as follow :
> >
> > user interface C call :
> > system("restart_task.sh");
> > give back hand to user interface
> > ....
> >
> >
> >
> >
> > bash script restart_task.sh :
> > killall -15 mytask
> > sleep 2
> > mytask &
> >
> >
> > system call dies because sh script has been launched
>
> Try calling daemon(0,0) in mytask instead of using "&" to make it run in
> the background.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-02-09 14:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-07 16:09 [Xenomai-core] system() question Stéphane ANCELOT
2007-02-07 15:40 ` Gilles Chanteperdrix
2007-02-08 8:39 ` Stéphane ANCELOT
2007-02-08 8:18 ` Gilles Chanteperdrix
2007-02-09 14:50 ` Stéphane ANCELOT
2007-02-09 13:59 ` Gilles Chanteperdrix
2007-02-09 14:33 ` Gilles Chanteperdrix
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.