system call

Q

qilin

I have perl program which use system() to call another c program
meanwhile the c program also use system() to execute a linux command
line ....but not sure why it doesn't work.

yes, the perl program can let c program execute what it wants, just
the rear part that c program is trying to execute linux command line
or go futher system call fails..

anybody has any thought about that? does it say system call can not be
nesting?

thanks
 
W

Walter Roberson

qilin said:
I have perl program which use system() to call another c program
meanwhile the c program also use system() to execute a linux command
line ....but not sure why it doesn't work.

That should, in general, be possible.

yes, the perl program can let c program execute what it wants, just
the rear part that c program is trying to execute linux command line
or go futher system call fails..
anybody has any thought about that? does it say system call can not be
nesting?

There is no restriction against nesting in the definition of system(),
but there is also no restriction that would require it to work.

*Some* systems put limits on process children, settable by the
system administrators, but the limit is very seldom set quite that low.

In my experience, when system() fails from within a program, it is
usually because the program has played with the execution environment
in some way -- by setting resource limits, by setting the
execution path so that the program cannot be found, by setting up
a secure execution environemnt that doesn't account for the
required program, by playing with the operating system shell
variables that control how the command line is parsed.

Sometimes, though, the difficulty has to do with running system() from
a very large program (one that uses a lot of memory): on -some-
operating systems, the operating system has to temporarily duplicate
the entire memory allocation while it sets up to run the new system
shell.

The ways that system() can break are ... system dependant
(Sorry, couldn't resist the pun.) Often someone with a bit of
experience on that kind of system can chase down the problem
pretty quickly, given access to the program and the system
that there is the problem on. It's the sort of thing that you
would ask your systems administrator to look at. [Or
would that be "system()s administrator"? ;) ]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top