Find the answer to your Linux question:
Results 1 to 5 of 5
I am working on arm-linux targetting strongarm processor. I am using multithreading programming. Whenever I use any system call ( for eg. system("ls -l /pos/bin"); ) in any of the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2005
    Posts
    2

    System call does not seem to work


    I am working on arm-linux targetting strongarm processor. I am using multithreading programming. Whenever I use any system call ( for eg. system("ls -l /pos/bin"); ) in any of the threads I create the entire program hangs without the system call being executed. Any idea why this might be happening.

    Appreciate any input with regards to this.

    Thanks

    Raghu

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Well for one, doing system(ls anything) is very inefficient. I'd just use file descriptors instead, but htat's just my two cents.

  3. #3
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    I don't think system(3) makes use of the PATH variable (but I could be wrong) so you need to full-path the program you want to run:
    Code:
        system("/bin/ls /pos/bin");
    I agree with lakerdonald, however, that system(3) isn't very efficient.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Enthusiast
    Join Date
    Jan 2005
    Posts
    575
    According to the manual system(string) is like calling /bin/sh -c string
    and that does use PATH so it must be something else.

  6. #5
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Oh yes, so it does. Sorry for the misinformation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •