“Adam Mallory” <amallory@qnx.com> wrote in message
news:a1cdms$hiq$1@nntp.qnx.com…
“zhz_zhang” <> zhz_zhang@263.net> > wrote in message
news:a1c1m5$49v$> 1@inn.qnx.com> …
In one term, I use 'on to start a detached process,the process(named
“example”) is never exit.
so I use the shell command.
#on -d ./example
when I press a enter key to run the process as above,the term can never
receive any key again as if the term window is dead .
Then I open another term ,use "ps -A "command ,there is no example
process
in running.
I think there is no problem in this “example”,because I only use a
simple
while(1) circle.
What is in your while(1) loop? Do you do a sleep(1) etc inside of it so
that the program itself isn’t running ready most of the time? Instead of
ps, use pidin to see a list of processes and their state (more information
then ps). Any reason why using ./example & to put it into the background
isn’t an option?
Cheers,
Adam
QNX Software Systems Ltd.
[ > amallory@qnx.com > ]
With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <> pschon@baste.magibox.net
\
Today I use it again ,below is my simple source.I just want to start a
"detached " process.
#include <stdio.h>
int main()
{
while(1)
{
printf("hello ");
sleep(1);
}
//never get here
return 0;
}
all the work below is finished in a term shell.
I program it in the directory “/tmp/exp/example.c
I use the command " cc -o example example.c” to compile and link the
program.
in the directory ,in order to run the program ,I have to use “./example” to
run the program,other wise
the system tell me they can’t find the "example " program.
First ,I use"./example" to run the program.It is ok,because in another term
I can see the process through “pidin”.
then,I stop the process through "Ctrl+c"in the term it running .
Second,I want to use “on " utilities to start it as a detached
process,because the program in the term is never exit
and I want to do other things in the term.
So I use the shell command " on -d ./example”,but the term I run the program
never receive any key again even if I use
“Ctrl+c”.the term is dead? I don’t know why?
I use "pidin "command as you say in another term,there is no process named
“./example” or “example”.I use “slay” utility
“slay example”,the system tell me "slay: unable to find process ‘example’
why?
Is there anything wrong with my operation,or a bug in “on” utility. I really
want to know how to validly start a detached process.
Any help wellcome.
Hongzhi Zhang