Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.questions Subject: Re: How to tell if a process exists Message-ID: <1990Aug3.040121.16585@iwarp.intel.com> Date: 3 Aug 90 04:01:21 GMT References: <26B867F8.38BB@wilbur.coyote.trw.com> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 19 In-Reply-To: doug@ridley.coyote.trw.com (Doug Rudoff) In article <26B867F8.38BB@wilbur.coyote.trw.com>, doug@ridley (Doug Rudoff) writes: | | In a C program, how do you tell if a certain process exists? A | kill(0,pid) works only if you own the process (or you're root). It | seems like such a simple thing to request that it should be part of | the standard C libraries for unix, but I can't seem to find the right | thing to use. On a normal UNIX (although you mentioned Ultrix later, so all bets may be off), you will get success or EPERM if the process exists, and ESRCH if the process does not exist. With this sort of algorithm, it doesn't matter who you are. Just remember to check errno! Just another UNIX hacker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/