[fpc-pascal] check if process ID is running under BSD

phoebus phoebus frphoebus at yahoo.fr
Mon Jun 6 23:02:39 CEST 2011

Hi Mattias,

I don't know if it exist a FPC function for that.

i'll do an external commad like " ps -ef | grep bash | grep -v grep | awk 
'{print $8}'".

I 'm assuming the output is:
 user1    2793  2789  0 22:52 pts/0    00:00:00 bash

and encapsulate the command is one of the following system call.

1) TProcess (http://wiki.freepascal.org/Executing_External_Programs)
2) SysUtils.ExecuteProcess 
3) fpsystem 
4) POpen (http://www.freepascal.org/docs-html/rtl/unix/popen.html)
5) Shell (http://www.freepascal.org/docs-html/rtl/unix/shell.html)
6) FpExecve (http://www.freepascal.org/docs-html/rtl/baseunix/fpexecve.html)

Choice 5 is quick to implement and you can move  to others if you want later.

Hope my update help you, if the way i'll do it. I don't think there are some 
major difference between FPC implementation on Linux and BSD.


----- Message d'origine ----
De : Mattias Gaertner <nc-gaertnma at netcologne.de>
À : FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Envoyé le : Lun 6 juin 2011, 21h 50min 06s
Objet : [fpc-pascal] check if process ID is running under BSD

Hi all,

I need to check under BSD if a PID is running and what name it has.
Is there already a function for that?

fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org

More information about the fpc-pascal mailing list