[Lazarus] Process ID

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Thu Sep 13 17:33:25 CEST 2012


Jürgen Hestermann wrote:
> Am 2012-09-13 10:11, schrieb Michael Schnell:
>> IMHO its easier and more straight forward to do the functionality of 
>> "pidof" directly in pascal code:
>> - do a loop with a findnext() to handle all directories within "/proc"
>>  - in each of them test if a file "cmdline" exists
>>  - read cmdline in a staring
>>  - if this denotes the process you mean to access the directory name 
>> is the PID
>>
> Oh my god!
> Yet another approach of ransacking the whole disk.
> This time just to get a process ID.
> Is that state of the art software developement?
> There is no other way doing it on Linux?

[Sigh] /proc is a special filesystem which the kernel uses to expose 
information about each process. Apart from the fact that it is mounted 
into the standard filesystem namespace, it has absolutely nothing to do 
with a physical disc.

-- 
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