First of all hello,i'm new to this forum!
I have a prob with the fork function(or i think that i have) and i am confused.
I have this program
For is stupid in my prog but i use that to test what is going on when a create proccesses with fork multiple times(in this code is only one). The results of my prog are not the same every time i run it, not because the pid changing but look at this
void bypass_sigint(int sig_no)
printf("child(%d) finished with code:%d\n",pid,status);
int main(int args,char**array)
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = &bypass_sigint;
}//end child proccess
}//end parent proccess
1)first time i get:
child(17046) finished with code:0
and it goes like this, nothing standard.
this example is simple, i'm making a server for file sharing and now i'm in fork stage of programming.when a client is connected a new proccess is created and server keeps new pid just to control it. The problem was that my signal function prints more pids than i created. Maybe my fork creates more pids but i don't know what i did wrong. I decided to make a simple program like the above and i see that something is wrong! please if you have any ideas help me! i'm confused