Path: utzoo!mnetor!uunet!husc6!rutgers!ames!sdcsvax!ucsdhub!hp-sdd!hplabs!hpcea!hpfcdc!rml From: rml@hpfcdc.HP.COM (Bob Lenk) Newsgroups: comp.unix.wizards Subject: Re: Is process alive? Message-ID: <5980013@hpfcdc.HP.COM> Date: 17 Dec 87 21:46:50 GMT References: <429@minya.UUCP> Organization: HP Ft. Collins, Co. Lines: 20 > int > isprocess(n) > int n; > { > extern int errno; > > return (kill(n,0) == 0 || errno != ESRCH); > } As several people have pointed out, this approach works on System V and recent BSD systems. One important note is that the semantics are not identical on those systems. If the process in question is a zombie, System V will tell you it exists while BSD will tell you it doesn't. A couple of other points: Older systems (eg. V7) don't support signal 0. Systems meeting certain levels of security won't permit this sort of thing in any form. Bob Lenk {ihnp4, hplabs}!hpfcla!rml