[comp.unix.internals] Checking a PID's existance reguardless of uid/euid

dave@dptechno.uucp (Dave Lee) (09/06/90)

I saw this hashed around a bunch a while back, but I did not see 
a definate answer.   

Will the following function always determine if the supplied process
id (pid) is currently running *** reguardless *** of the effective
and actual id's of the calling process and the supplied process ?

It does work with HP-UX 7.0 in all cases I could try.
Is this different for BSD versions and  SYS V ? 
What does POSIX and SVID2 have to say about this? 


#include <errno.h>
IsAlive( pid )
int  pid;
{
        int ret;
        extern int errno;
        errno = 0;
        ret = kill( pid , 0 );
        return( ret == 0 || errno == EPERM );
}


Email or post at your convience.
Thanks a bunch ...

-- 
Dave Lee
uunet!dptechno!dave