system() call

When I call system() (i.e. system(“ls”)), my process hangs. When I
check the state via pidin, it shows that a shell (/bin/sh) has been
created and its state is SEND and is blocked on my process.

Is it waiting for some kind of reply or something? This call worked
fine in qnx4 (I’m now in qnx6). Does this have anything to do with
channel IDs (which I’ve recently been messing around with in my porting
adventures)? Thanks.

Neville

Neville Bonwit <neville@erg.sri.com> wrote:

When I call system() (i.e. system(“ls”)), my process hangs. When I
check the state via pidin, it shows that a shell (/bin/sh) has been
created and its state is SEND and is blocked on my process.

Is it waiting for some kind of reply or something? This call worked
fine in qnx4 (I’m now in qnx6). Does this have anything to do with
channel IDs (which I’ve recently been messing around with in my porting
adventures)? Thanks.

My guess, is your application is a single thread process,
and you registed something in namespace (like /myname).

When “ls” run, it tends to stat("/myname"), and that goes
to you. Since you have nobody waiting (MsgReceive()), so
ls SEND block on you. And the 2 process just dead locked.

-xtang

Xiaodan Tang <xtang@qnx.com> wrote:

Neville Bonwit <> neville@erg.sri.com> > wrote:
When I call system() (i.e. system(“ls”)), my process hangs. When I
check the state via pidin, it shows that a shell (/bin/sh) has been
created and its state is SEND and is blocked on my process.

Is it waiting for some kind of reply or something? This call worked
fine in qnx4 (I’m now in qnx6). Does this have anything to do with
channel IDs (which I’ve recently been messing around with in my porting
adventures)? Thanks.

My guess, is your application is a single thread process,
and you registed something in namespace (like /myname).

The other option is that you have done a manual ConnectAttach() and
didn’t use _NTO_SIDE_CHANNEL as the offset. This means your connection
will be made in the “file descriptor” space. So when you call system()
it tries to dup all the connections, but your manual ConnectAttach() isn’t
created to be DUP’d.

chris

cdm@qnx.com > “The faster I go, the behinder I get.”

Chris McKillop – Lewis Carroll –
Software Engineer, QSSL
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Yes,

My app is a single-thread process and I registered the channel via
name_attach (/sri/lurch/mcon/mcon).

Is there a way to have system() execute a command without having a MsgReceive
somewhere in the system? It seems to me that this would demand another
thread, which is obviously ridiculous just to get the system() function to
work. Is there another way to register via name_attach or do some other
trick to get around this? Thanks.

Neville


Xiaodan Tang wrote:

Neville Bonwit <> neville@erg.sri.com> > wrote:
When I call system() (i.e. system(“ls”)), my process hangs. When I
check the state via pidin, it shows that a shell (/bin/sh) has been
created and its state is SEND and is blocked on my process.

Is it waiting for some kind of reply or something? This call worked
fine in qnx4 (I’m now in qnx6). Does this have anything to do with
channel IDs (which I’ve recently been messing around with in my porting
adventures)? Thanks.

My guess, is your application is a single thread process,
and you registed something in namespace (like /myname).

When “ls” run, it tends to stat("/myname"), and that goes
to you. Since you have nobody waiting (MsgReceive()), so
ls SEND block on you. And the 2 process just dead locked.

-xtang