[fpc-pascal] Checking Linux process existence (child or not) without OS command ?
fpclist at silvermono.co.za
fpclist at silvermono.co.za
Mon Sep 21 16:36:50 CEST 2009
While scanning /proc may not be portable, the question asked is about checking
for a running Linux process. The only way I know is scanning all directories
within /proc (which as you all know are the id's of the running processes)
and checking for the process file name and the process command line. If a
match is found, you can assume that the process is acknowledged by the kernel
as running, although the process could be a zombie process. You can then
further deduce whether the latter is the case by scanning /proc/xxx/~cwd
which will be unreadable (unable to be openned) if the process is a zombie
process.
If someome has a better way, please tell.
//-------------------------------------------
On Monday 21 September 2009 14:58:20 T. Guilleminot wrote:
> Hi,
>
> Does anyone know a simple way to check if a Linux process exists/runs
> (child or not) *without* running an OS command via TProcess (or other)?
>
> Thanks.
> Tom
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list