What does it mean if(!fork())? I’m a little bit confused about it, I dont know when Im in parent and child process:
if(!fork())
{
// is it child or parent process?
}else{
// is it child or parent process?
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From the
fork(2)manpage:Since
fork()returns 0 to the child, theifclause tests if it’s a child: