system call

Discussion in 'C Programming' started by qilin, Jun 7, 2007.

  1. qilin

    qilin Guest

    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
     
    qilin, Jun 7, 2007
    #1
    1. Advertising

  2. In article <>,
    qilin <> wrote:

    >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"? ;) ]

    --
    Programming is what happens while you're busy making other plans.
     
    Walter Roberson, Jun 7, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bill sandner
    Replies:
    1
    Views:
    887
    iksrazal
    Jul 1, 2004
  2. system call and library call

    , Aug 22, 2005, in forum: C Programming
    Replies:
    7
    Views:
    3,032
    Jonathan Bartlett
    Aug 23, 2005
  3. leoman730

    System call and library call

    leoman730, May 3, 2007, in forum: C++
    Replies:
    6
    Views:
    930
    Jim Langston
    May 6, 2007
  4. David Pratt
    Replies:
    0
    Views:
    270
    David Pratt
    Apr 7, 2008
  5. David Pratt
    Replies:
    0
    Views:
    410
    David Pratt
    Apr 7, 2008
Loading...

Share This Page