i want save the current process id on a variable.
So, i do this:
double id = 0; //Global variable
.....
id = getpid();
printf("%d %d", id, getpid()); // the result ins't the same...
Well, i expected save the current process id on a global variable.
Edit:
new_pid = fork();
//new_pid2 = fork();
switch(new_pid) {
case -1:
perror("fork failed");
exit(1);
case 0:
kill(getppid(), SIGUSR1);
signal(SIGUSR1, trata_SIGSEGV);
break;
default:
signal(SIGUSR1, trata_SIGSEGV);
kill(new_pid, SIGUSR1);
break;
}
break;