Daemon Processhas already been asked (and possibly answered).
Hi i am trying to create a daemon process
if (pid<0){
printf("Error creating child process ");
}
if (pid >0){
exit(0);
}
sid=setsid();
if (sid<0){
perror("Problem with the child process");
}
What i know is that i have to fork for a new process ... The new process that now runs in to background.. I also know that the daemon code should be inside a while statement so as to run continiously
while(1){
//do your job
}
I want to know if this code will consume all the cpu or not
|