How to tell if a process is active?

John Cowan cowan at marob.masa.com
Sat Jun 17 04:20:54 AEST 1989


In article <4608 at ncrcae.Columbia.NCR.COM> wescott at ncrcae.Columbia.NCR.COM (Mike Wescott) writes:
>In article <2727 at infocenter.UUCP> mhoffman at infocenter.UUCP (Mike Hoffman) writes:
>> 
>> I have an application in which I need to check to see if a process
>> is currently active. 
>
>Try:
>
>isactive(pid)
>	if(kill(pid,0)==0 || errno == EPERM)
>		return(process is active)
>	else 
>		return(process is not active)
>
>see kill(2).
>
>-- 
>	-Mike Wescott
>	 mike.wescott at ncrcae.Columbia.NCR.COM


That doesn't work on all flavors of Unix.  Xenix supports it, so does
SVR2, but definitely not in V7.  I don't know about BSD.

Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
Fascist inews!
-- 
John Cowan <cowan at marob.masa.com> or <cowan at magpie.masa.com>
UUCP mailers:  ...!uunet!hombre!{marob,magpie}!cowan
Fidonet (last resort): 1:107/711
Aiya elenion ancalima!



More information about the Comp.unix.questions mailing list