From: Hareesh Nagarajan <hareesh.nagarajan@gmail.com>
To: linux-c-programming@vger.kernel.org
Subject: Check if a process exists?
Date: Tue, 1 Mar 2005 02:17:04 -0600 [thread overview]
Message-ID: <7728232c050301001710a2787@mail.gmail.com> (raw)
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
next reply other threads:[~2005-03-01 8:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-01 8:17 Hareesh Nagarajan [this message]
2005-03-01 8:35 ` Check if a process exists? Holger Kiehl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7728232c050301001710a2787@mail.gmail.com \
--to=hareesh.nagarajan@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.