[comp.sys.ibm.pc.rt] Finding dead processes

joshua@athertn.Atherton.COM (Flame Bait) (10/27/89)

I'm trying to write a routine which will check if a process is still alive.
On real UNIX, I can use kill(2) to send a zero signal to the process.  If
the process in question is a zombie or dead, I will get an error.  On AIX, 
however, killing a zombie process does not cause an error.

I have three questions:
    How can I write a routine which will take a pid and return TRUE if the
    process is alive and well, and FALSE if it is dead or zombie?

    Isn't this a bug?  The man pages says that sending a zero signal can
    be used to "check the validity of pid."  I would think that a zombie
    process is not valid.

    Is this part of some standard I do not know about?  Does POSIX or SVID
    require this behavor?

Obviously, I can run ps and look at its output, or read kmem, but I want 
something fast and portable.  Thanks for any help.

Joshua Levy
--------                Quote: "If you haven't ported your program, it's not
Addresses:                      a portable program.  No exceptions."  
joshua@atherton.com          
{decwrl|sun|hpda}!athertn!joshua    work:(408)734-9822    home:(415)968-3718