Forking child processes form parent to exec commands

This is a discussion on Forking child processes form parent to exec commands within the C Programming forums, part of the General Programming Boards category; I ask this question again in hope it is not responded to by someone with less intelligence than a rodent. ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    178

    Forking child processes form parent to exec commands

    I ask this question again in hope it is not responded to by someone with less intelligence than a rodent.

    I understand process execution, forking, and termination. Right now my program is able to fork one child, exec ls -lai, then dies. I have been trying to understand why this happens.

    I have used waitpid and wait() in general but I think I am lacking a clear point of understanding with regard to processes in UNIX. I read the FAQ but it entirely all but clear on process execution under UNIX.

    Any help is appreciated but if you would like to share how I should not know this because you feel I am in danger of learning how to execute denial-of-service attacks or want to be a general .............., leave now please.

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    but if you would like to share how I should not know this because you feel I am in danger of learning how to execute denial-of-service attacks or want to be a general .............., leave now please.
    Bear in mind that the most helpful people on this board have been here for years, and have thousands and thousands of posts. They have seen a lot of people register who know very little about programming, and immediately start asking how to write malicious software. They have good reason to chase away script kiddies. I'm not suggesting that you are coding a DoS attack, but you'll find you recieve much more help if you focus on changing your own attitude rather than someone else, right or wrong. If you're writing code that might be confused with something malicious, be open about it - tell us more about what you're doing and maybe even post your code. Everyone who's here is here because they like helping people who are here to learn.

    Right now my program is able to fork one child, exec ls -lai, then dies. I have been trying to understand why this happens.

    I have used waitpid and wait()...
    I'm a little confused about which process is doing what - you'll probably need to post your code so we can see what's going on. It sounds like a loop of some sort might be messed up?

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    178
    Don't concern yourself, the problem was solved by me already.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,794
    Quote Originally Posted by Imanuel
    Don't concern yourself, the problem was solved by me already.
    Good to hear that.

    *thread closed*
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 05-01-2011, 11:06 AM
  2. Why isn't the execlp() function doing anything?
    By jsrig88 in forum C Programming
    Replies: 5
    Last Post: 10-12-2009, 10:09 AM
  3. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  4. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21