Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    problems with fork/execv

    hello guys,

    I'm having problem using execv this is my code:

    void startAllCCCams()
       char* args[]={"/usr/local/bin/cccam1","-C","/usr/local/etc/cccam1.cfg",(char*)0};
       struct sigaction sa;
       sa.sa_handler = SIG_IGN;
       sa.sa_flags = 0;
       sigemptyset( &sa.sa_mask );
       sigaction( SIGCHLD, &sa, NULL );
       pid_t pid;
       if(( pid = fork()) < 0)
       else if( pid == 0 )
         execv( "/usr/local/bin/cccam1", args );
    When I comment the sigaction piece of code, the child process is started but marked as [defunct]. When this piece of code is uncommented I don't see any child processes.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Well, other than executing the cccaml command, I don't know what to tell you as I don't know what it does. It may just exit after starting, depending upon the arguments you passed it, in which case, the defunct state is to be expected. In any case, you have masked in the parent any SIGCHLD (death of child) signals. Normally, one issues a wait() function in the parent to wait for the child or children to terminate. That will clean up the zombie process.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3

    first of all thank you for responding. The cccam command is a software emulator for a cam( Conditional Access Module ). If I execute the command on the command line with exactly the arguments that I wrote down, it works and I can see it in the ps -ef list. This program should run indefinetly but sometimes it's not and my program should see/recognise that and start it up again. The syntax is "/usr/local/bin/cccam1 -C /usr/local/etc/cccam1.cfg" and I've checked it.

  4. $spacer_open

Posting Permissions

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