• Robert Haas's avatar
    Work around unfortunate getppid() behavior on BSD-ish systems. · 24ecde77
    Robert Haas authored
    On MacOS X, and apparently also on other BSD-derived systems, attaching
    a debugger causes getppid() to return the pid of the debugging process
    rather than the actual parent PID.  As a result, debugging the
    autovacuum launcher, startup process, or WAL sender on such systems
    causes it to exit, because the previous coding of PostmasterIsAlive()
    detects postmaster death by testing whether getppid() == PostmasterPid.
    
    Work around that behavior by checking the return value of getppid()
    more carefully.  If it's PostmasterPid, the postmaster must be alive;
    if it's 1, assume the postmaster is dead.  If it's any other value,
    assume we've been debugged and fall through to the less-reliable
    kill() test.
    
    Review by Tom Lane.
    24ecde77
pmsignal.c 8.29 KB