[Lazarus] RE : How to enumerate list of Linux running processes?

Marco van de Voort marcov at stack.nl
Sun Aug 14 15:04:28 CEST 2011


On Sun, Aug 14, 2011 at 10:09:48AM +0000, Mark Morgan Lloyd wrote:
> > Perhaps parsing the ps output is easier since output is already quite
> > configurable. ps is also parsing /proc.
> > As long as you stick to linux, this solution can be made portable between
> > the different flavors. Portablility with other unix's is problematic.
> 
> ps parses /proc, but some of the command-line options might vary with 
> distro and version.

> I've used it reasonably successfully on Linux and 
> Solaris, my notes from a Perl script:

On FreeBSD it will mostly work, but /proc can be turned off, and that is
commonly done on servers to reduce the attack surface. (/proc exposes stuff
for debugging like addresses that afaik can be used to attack).

Also on embedded and startup kernels it is sometims turned off.


Parsing "ps" is the best option I think.

> # For Linux, ps is normally found in /bin/ps. 

FreeBSD too.





More information about the Lazarus mailing list