Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!occrsh!occrsh.ATT.COM!rjd
From: rjd@occrsh.ATT.COM
Newsgroups: comp.unix.wizards
Subject: Re: Is process  alive?
Message-ID: <142700019@occrsh.ATT.COM>
Date: 11 Dec 87 18:22:00 GMT
References: <141@csd_v.UUCP>
Lines: 18
Nf-ID: #R:csd_v.UUCP:-14100:occrsh.ATT.COM:142700019:000:833
Nf-From: occrsh.ATT.COM!rjd    Dec 11 12:22:00 1987


> Is there a universal way that will work on any Unix to write a function
> 	isprocess(n)
> which returns TRUE if process n is alive, and FALSE if it isn't alive?
> 
> Note that I have said nothing about the relationship of process n (if it
> exists) to the process that is asking.  They might or might not be related.
> They might or might not have the same uid and gid.  I don't want to kill
> the process (or even upset it in any way).  I just want to know if it is
> alive.

  I don't have the base note for this, just the above.  If you have the
process number (such as saving it when it went into background) either
(in shell) a ps -p  will give you a status code, or
(in C) kill(0,) will also give you a status code.
  If you don't have a process number, it gets a little more difficult.

Randy