Summary - How to tell if a process is active
Pim Zandbergen
pim at ctisbv.UUCP
Wed Jun 21 08:00:43 AEST 1989
In article <2848 at infocenter.UUCP> mhoffman at infocenter.UUCP (Mike Hoffman) writes:
>
>
>Thanks to all who answered my request for a better approach. The
>correct way to tell if a process is active is by using kill(2),
>and sending a signal of 0. This will perform error checking, but
>does not actually send a signal to the process.
>
I have a question that is related this one. Our applications
use the same style of lock-files as are used in uucp:
when a resource is claimed, a lockfile is created with a name
that reflects the claimed resource and a content that holds
the pid of the resource claiming process, so other processes
can check the validity of the claim by examing if the process
still is alive.
But as our application is mainly turnkey based, I have seen more
then once that checking the pid only is not enough. Our customers
turn on the machine, and go right away into the application.
At that time a resource is being claimed. Then there is a system crash,
the system is rebooted, and the application is restarteds,
AND IS RUNNING WITH THE EXACT SAME PID! Hence, when it finds
the lockfile, it checks for its pid and finds out it exists,
and fails to claim the resource. The second time the application
is started it will continue without failure.
So I am looking for some way to put some extra information into
the lockfile to find out if the machine has been rebooted
since the resource claim. What is the most obvious and portable
way to do this?
Thanks for any responses.
Pim.
--
--------------------+----------------------+-----------------------------------
Pim Zandbergen | phone: +31 70 542302 | CTI Software BV
pim at ctisbv.UUCP | fax : +31 70 512837 | Laan Copes van Cattenburch 70
...!uunet!mcvax!hp4nl!ctisbv!pim | 2585 GD The Hague, The Netherlands
More information about the Comp.unix.questions
mailing list