[Lazarus] Process ID

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Fri Sep 14 22:06:38 CEST 2012

Marco van de Voort wrote:
> On Fri, Sep 14, 2012 at 11:55:52AM +0200, Michael Schnell wrote:
>>> Yet another approach of ransacking the whole disk.
>> /proc is not on a disk. It's a virtual file system that generates it's 
>> content only on request.
>> In Linux, "everything" is (accessible as if it were) a file (or a 
>> directory).  This is a _good_thing_.
> Yeah. Everybody doing his own parsing of system textfiles is *such* a good
> principle to build durable applications on *g*

I think it was you who made the point earlier that doing this "the Linux 
way" takes multiple syscalls to enumerate the content of directories in 
the /proc or /sys tree. That's obviously valid criticism, but at the 
same time I'm not sure there's a better way to handle a complex 
structure with version- and system-specific elements (example: 
/proc/cpuinfo is grossly architecture-specific, even for basic things 
like counting the number of CPUs).

It might, I suppose, be possible to build something like the inifiles 
unit which could parse either the registry (in the case of Windows) or 
etc+proc+sys+sysctl in the case of unix, but this would be difficult on 
account of /proc and /sys being an unstructured mix of stuff defined by 
the architecture and stuff changing every nSec. I'm no registry fan, but 
at least it tries to keep things separate.

I wonder whether POSIX has anything instructive to say about this sort 
of thing?

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the Lazarus mailing list