sigchld - Can't ignore signal CHLD, forcing to default -


 #include <sys/types.h>  #include <stddef.h>  #include <stdlib.h>  #include <sys/wait.h>  #include <signal.h>  #include <iostream>  #include <unistd.h>  int main(){           signal(sigchld,sig_ign );         pid_t pid  = vfork();         if(pid <0){             std::cout<< "error: fork failed @ main!!!";             exit(1);         }else if (0 == pid){               char * cmd[] ={(char*)"../work/c++11/prj_largefile/script/logger.pl",null};             //char * cmd[] = {(char*)"pwd",null};             //char * cmd[] = {(char*)"/usr/bin/perl",(char*)"../work/c++11/prj_largefile/script/logger.pl",null};              execvp(cmd[0],cmd);                _exit(0);         } } 

i want have orphan child process run perl script in backgroud , want parent process completed without waiting on child. hence have used signal(sigchld,sig_ign ) @ beginning ignore child signal on completion , avoid zombies. when running code giving me error can't ignore signal chld, forcing default. . on other when running commented lines instead running desired signal. reason of that?


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -