You are not logged in.
Pages: 1
i want to create 03 child using the function fork ()
but how i konw the first child and the second child because
the first child must send a signal SIGUSR1 to his father
the second child must send a signal SIGUSR2 to his father
finaly thank you
Offline
Just call fork() and check the return value to distinguish
between the parent and the child process. Something like:
int create_child(int signal)
{
int pid;
pid = fork();
if (pid == 0){
/* Child code here */
kill(getppid(), signal);
exit(0);
} else if (pid < 0){
perror("Fork failed")
return 1;
}
/* Return to parent */
return 0;
}
Offline
thank you so much
Pages: 1