linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Check if a process exists?
@ 2005-03-01  8:17 Hareesh Nagarajan
  2005-03-01  8:35 ` Holger Kiehl
  0 siblings, 1 reply; 2+ messages in thread
From: Hareesh Nagarajan @ 2005-03-01  8:17 UTC (permalink / raw)
  To: linux-c-programming

Hi,

Can a process check if a given PID exists or not? In other words can a
process check if an unrelated process is alive? Is there any system
call that does this?

I can think of a (few) work arounds to this:

1. open("/proc/pid_in_question") will return true if the process with
pid = pid_in_question is alive.

2. lock a file called ``pid_in_question". Test the lock from the other
process.  If the process is dead then there is no lock on the file
``pid_in_question".

Any ideas/comments?

Thanks,

Hareesh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-01  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-01  8:17 Check if a process exists? Hareesh Nagarajan
2005-03-01  8:35 ` Holger Kiehl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).