in reply to getppid() returns cached value

Any idea how to work around this problem ?

Sorry, maybe I'm missing the point, but you haven't actually said what "problem" you are experiencing.

As wazoox said, getppid will return 1 once the original process has been killed. The orphaned child process gets "adopted" by pid 1 (init). So it all seems correct to me.

If you can explain what you actually want the script to do, and what it's doing instead, that would help a lot.


s^^unp(;75N=&9I<V@`ack(u,^;s|\(.+\`|"$`$'\"$&\"\)"|ee;/m.+h/&&print$&

Replies are listed 'Best First'.
Re^2: getppid() returns cached value
by pratik (Initiate) on May 26, 2005 at 13:32 UTC
    Oops..here is the output I am getting if I use perl 5.8.2.
    My PID is 24958 My PPID is 24958 after my parent is killed
    It is probably returning the cached value of Parent PID.

    But it works as expected if I use perl 5.6.1
    My PID is 25020 My PPID is 1 after my parent is killed

    My OS info :
    Linux version 2.4.21-4.ELsmp (bhcompile@daffy.perf.redhat.com) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-20)) #1 SMP Fri Oct 3 17:52:56 EDT 2003

    Thanks,
    Pratik