getppid question for BSD users
hi There,
I was just curious to know why getppid works differently on two
different machines.
The manpage for getppid says that it returns the process ID of the parent of the calling process.
if( fork() == 0) // child proc
{
cout<<"Child id "<<getpid()<<endl<<"Parentid "<<getppid()<<endl;
return 0;
}
cout<<"Main : "<<getpid()<<endl;
came up with
>Main : 91555
Child id 91556
Parentid 1 <-- This should have been 91555
I was wondering if the output is similar on your machines.
ON my other machine, it worked just fine. It gave right answer.
Any clues why it is not working on BSD?
|